diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 3040448736..0000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -# These are supported funding model platforms -github: [kyleconroy] diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml new file mode 100644 index 0000000000..79381df51c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -0,0 +1,86 @@ +name: Bug Report +description: File a bug report +labels: [bug] +body: + - type: dropdown + id: version + attributes: + label: Version + description: What version of sqlc are you running? If you don't know, run `sqlc version`. + multiple: false + options: + - 1.30.0 + - 1.29.0 + - 1.28.0 + - 1.27.0 + - 1.26.0 + - 1.25.0 + - Other + validations: + required: true + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: "A bug happened!" + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: textarea + id: schema + attributes: + label: Database schema + description: Please include definitions for the relevant database tables. This will be automatically formatted as SQL, so no need for backticks. + render: sql + - type: textarea + id: queries + attributes: + label: SQL queries + description: Please include the SQL queries causing issues. This will be automatically formatted as SQL, so no need for backticks. + render: sql + - type: textarea + id: config + attributes: + label: Configuration + description: Please include the sqlc.(yaml|yml) or sqlc.json file you using in your project. This will be automatically formatted, so no need for backticks. + render: yaml + - type: input + id: playground + attributes: + label: Playground URL + description: "Link to a reproduction of the issue on the sqlc playground" + placeholder: "https://play.sqlc.dev/" + - type: dropdown + id: os + attributes: + label: What operating system are you using? + multiple: true + options: + - Linux + - Windows + - macOS + - type: dropdown + id: engines + attributes: + label: What database engines are you using? + multiple: true + options: + - MySQL + - PostgreSQL + - SQLite + - type: dropdown + id: languages + attributes: + label: What type of code are you generating? + multiple: true + options: + - Go + - Python + - Kotlin diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml new file mode 100644 index 0000000000..b3dd5b0a09 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -0,0 +1,30 @@ +name: Feature Request +description: Request a new feature or a change to an existing feature +labels: [enhancement] +body: + - type: textarea + id: feature + attributes: + label: What do you want to change? + placeholder: Tell us what you want + value: "Free unicorns!" + validations: + required: true + - type: dropdown + id: engines + attributes: + label: What database engines need to be changed? + multiple: true + options: + - PostgreSQL + - MySQL + - SQLite + - type: dropdown + id: languages + attributes: + label: What programming language backends need to be changed? + multiple: true + options: + - Go + - Python + - Kotlin diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d86c059c55..ecbac919d7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,11 @@ updates: directory: "/" schedule: interval: "daily" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" - package-ecosystem: "docker" directory: "/" schedule: @@ -12,3 +17,18 @@ 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" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" + diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml new file mode 100644 index 0000000000..fabfc40023 --- /dev/null +++ b/.github/workflows/buf.yml @@ -0,0 +1,9 @@ +name: buf +on: pull_request +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: bufbuild/buf-setup-action@v1 + - uses: bufbuild/buf-lint-action@v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..7595757ddd --- /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@v6 + - uses: actions/setup-go@v6 + with: + go-version: '1.25.0' + - name: install ./... + run: go build ./... + env: + CGO_ENABLED: "0" diff --git a/.github/workflows/ci-kotlin.yml b/.github/workflows/ci-kotlin.yml index f8a0c59821..b011cb997f 100644 --- a/.github/workflows/ci-kotlin.yml +++ b/.github/workflows/ci-kotlin.yml @@ -1,47 +1,27 @@ -name: gradle -on: [push, pull_request] +name: kotlin +on: + push: + branches: + - main + pull_request: 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@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: - java-version: 11 - - uses: eskatos/gradle-command-action@v1 - 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.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v6 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 new file mode 100644 index 0000000000..940a5008b0 --- /dev/null +++ b/.github/workflows/ci-python.yml @@ -0,0 +1,26 @@ +name: python +on: + push: + branches: + - main + pull_request: +jobs: + build: + if: false + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v6 + 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..d08c7ba8f0 --- /dev/null +++ b/.github/workflows/ci-typescript.yml @@ -0,0 +1,26 @@ +name: typescript +on: + push: + branches: + - main + pull_request: +jobs: + build: + if: false + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v6 + 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 511ab8cebb..a7235b2b0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,50 +1,74 @@ name: go -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: - build: - 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 - + strategy: + matrix: + goos: [darwin, linux, windows] + goarch: [amd64, arm64] + name: build ${{ matrix.goos }}/${{ matrix.goarch }} + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-go@v2 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: - go-version: '1.16' - + go-version: '1.25.0' - run: go build ./... + env: + CGO_ENABLED: "0" + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + test: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: '1.25.0' + + - name: install gotestsum + run: go install gotest.tools/gotestsum@latest + + - 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" + + - name: build internal/endtoend + run: go build ./... working-directory: internal/endtoend/testdata + env: + CGO_ENABLED: "0" - - name: Test sqlc - run: go test --tags=examples ./... + - name: install databases + run: go run ./cmd/sqlc-test-setup install + + - name: start databases + run: go run ./cmd/sqlc-test-setup start + + - name: test ./... + run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m -failfast ./... 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 + 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" + vuln_check: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + + steps: + - uses: golang/govulncheck-action@v1 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 2bebc327be..0000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: docker -on: - push: - branches: - - master -jobs: - docker: - name: push kjconroy/sqlc:devel - runs-on: ubuntu-latest - steps: - - name: Set created date - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - - uses: actions/checkout@v2 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 - with: - username: kjconroy - password: ${{ secrets.DOCKER_PASSWORD }} - - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - build-args: | - github_ref=${{ github.ref }} - github_sha=${{ github.sha }} - tags: kjconroy/sqlc:devel - labels: | - org.opencontainers.image.source=${{ github.event.repository.html_url }} - org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.revision=${{ github.sha }} - push: true diff --git a/.github/workflows/equinox.yml b/.github/workflows/equinox.yml deleted file mode 100644 index 2a41f0d11d..0000000000 --- a/.github/workflows/equinox.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: equinox - -on: - push: - branches: - - master - -jobs: - - windows: - name: release --platforms windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.16' - - uses: equinox-io/setup-release-tool@v1.1.0 - - name: equinox release - env: - EQUINOX_API_TOKEN: ${{ secrets.EQUINOX_API_TOKEN }} - EQUINOX_SIGNING_KEY: ${{ secrets.EQUINOX_SIGNING_KEY }} - run: go run scripts/release.go -draft windows_amd64 - - macos: - name: release --platforms darwin - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.16' - - uses: equinox-io/setup-release-tool@v1.1.0 - - name: equinox release - env: - EQUINOX_API_TOKEN: ${{ secrets.EQUINOX_API_TOKEN }} - EQUINOX_SIGNING_KEY: ${{ secrets.EQUINOX_SIGNING_KEY }} - run: go run scripts/release.go -draft darwin_amd64 - - linux: - name: release --platforms linux - runs-on: ubuntu-latest - needs: [macos, windows] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.16' - - uses: equinox-io/setup-release-tool@v1.1.0 - - name: equinox release - env: - EQUINOX_API_TOKEN: ${{ secrets.EQUINOX_API_TOKEN }} - EQUINOX_SIGNING_KEY: ${{ secrets.EQUINOX_SIGNING_KEY }} - run: go run scripts/release.go linux_amd64 - - diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml new file mode 100644 index 0000000000..eb83825c39 --- /dev/null +++ b/.github/workflows/gen.yml @@ -0,0 +1,39 @@ +name: sqlc-pg-gen +on: + workflow_dispatch: +jobs: + gen: + name: sqlc-pg-gen + runs-on: ubuntu-22.04 + services: + postgres: + image: postgres:15.0-alpine + 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@v6 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + check-latest: true + - run: go build -o sqlc-pg-gen ./internal/tools/sqlc-pg-gen + - run: mkdir -p gen/contrib + - run: ./sqlc-pg-gen gen + env: + PG_USER: postgres + PG_HOST: localhost + PG_DATABASE: postgres + PG_PASSWORD: postgres + PG_PORT: ${{ job.services.postgres.ports['5432'] }} + - name: Save results + uses: actions/upload-artifact@v6 + with: + name: sqlc-pg-gen-results + path: gen + diff --git a/.gitignore b/.gitignore index 57f1cb2a7a..39961ebb02 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ -/.idea/ \ No newline at end of file +/.idea/ +__pycache__ +.DS_Store +.*.swp + +# Devenv +.envrc +.direnv +.devenv* +devenv.local.nix + diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000..9712e405d1 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,22 @@ +# .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/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..d5d00188a7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "files.insertFinalNewline": true +} diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..6106f1288f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,269 @@ +# 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.25.0+** - 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 and MySQL for tests. Both commands are idempotent and safe to re-run. + +### 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 9 from Oracle's deb bundle +- 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`) +- Verify both 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` + +### 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 +``` + +## Test Types + +### 1. Unit Tests + +- **Location:** Throughout the codebase as `*_test.go` files +- **Run without:** Database or external dependencies +- **Examples:** + - `/internal/config/config_test.go` - Configuration parsing + - `/internal/compiler/selector_test.go` - Compiler logic + - `/internal/metadata/metadata_test.go` - Query metadata parsing + +### 2. 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 + +### 3. Example Tests + +- **Location:** `/examples/` directory +- **Requirements:** Tagged with "examples", requires live databases +- **Databases:** PostgreSQL, MySQL, SQLite examples + +## Database Services + +The `docker-compose.yml` provides test databases: + +- **PostgreSQL 16** - Port 5432 + - User: `postgres` + - Password: `mysecretpassword` + - Database: `postgres` + +- **MySQL 9** - 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.25.0 +- **Database Setup:** Uses `sqlc-test-setup` (not Docker) to install and start PostgreSQL and MySQL directly on the runner +- **Test Command:** `gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./...` +- **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 +- `/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. **Check for race conditions:** Use `-race` flag when testing concurrent code +3. **Use specific package tests:** Faster iteration during development +4. **Read existing tests:** Good examples in `/internal/engine/postgresql/*_test.go` + +## 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 0bfcec3008..05a93abf7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # STEP 1: Build sqlc -FROM golang:1.16.0 AS builder +FROM golang:1.25.5 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 692b35514d..b8745e57dc 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,27 @@ -.PHONY: build test test-examples regen start psql mysqlsh +.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto build: go build ./... +install: + go 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 ./... + test-examples: go test --tags=examples ./... -regen: sqlc-dev - go run ./scripts/regenerate/ +build-endtoend: + cd ./internal/endtoend/testdata && go build ./... + +test-ci: test-examples build-endtoend vet sqlc-dev: go build -o ~/bin/sqlc-dev ./cmd/sqlc/ @@ -18,11 +29,29 @@ sqlc-dev: sqlc-pg-gen: go build -o ~/bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen +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 ./... psql: PGPASSWORD=mysecretpassword psql --host=127.0.0.1 --port=5432 --username=postgres dinotest mysqlsh: mysqlsh --sql --user root --password mysecretpassword --database dinotest 127.0.0.1:3306 + +proto: + buf generate + +remote-proto: + protoc \ + --go_out=. --go_opt="Minternal/remote/gen.proto=github.com/sqlc-dev/sqlc/internal/remote" --go_opt=module=github.com/sqlc-dev/sqlc \ + --go-grpc_out=. --go-grpc_opt="Minternal/remote/gen.proto=github.com/sqlc-dev/sqlc/internal/remote" --go-grpc_opt=module=github.com/sqlc-dev/sqlc \ + internal/remote/gen.proto diff --git a/README.md b/README.md index e601ab0936..43fed122b9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # sqlc: A SQL Compiler -![go](https://github.com/kyleconroy/sqlc/workflows/go/badge.svg) -[![Go Report Card](https://goreportcard.com/badge/github.com/kyleconroy/sqlc)](https://goreportcard.com/report/github.com/kyleconroy/sqlc) +![go](https://github.com/sqlc-dev/sqlc/workflows/go/badge.svg) +[![Go Report Card](https://goreportcard.com/badge/github.com/sqlc-dev/sqlc)](https://goreportcard.com/report/github.com/sqlc-dev/sqlc) sqlc generates **type-safe code** from SQL. Here's how it works: @@ -9,7 +9,7 @@ sqlc generates **type-safe code** from SQL. Here's how it works: 1. You run sqlc to generate code with type-safe interfaces to those queries. 1. You write application code that calls the generated code. -Check out [an interactive example](https://play.sqlc.dev/) to see it in action. +Check out [an interactive example](https://play.sqlc.dev/) to see it in action, and the [introductory blog post](https://conroy.org/introducing-sqlc) for the motivation behind sqlc. ## Overview @@ -17,22 +17,47 @@ Check out [an interactive example](https://play.sqlc.dev/) to see it in action. - [Installation](https://docs.sqlc.dev/en/latest/overview/install.html) - [Playground](https://play.sqlc.dev) - [Website](https://sqlc.dev) +- [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 -- [Meter](https://meter.com) -- [ngrok](https://ngrok.com) +- [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). + +

+ Riza.io +

+ +

+ 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 new file mode 100644 index 0000000000..3acdb97914 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +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/grpc/go:v1.3.0 + out: internal + opt: paths=source_relative diff --git a/buf.lock b/buf.lock new file mode 100644 index 0000000000..c91b5810c2 --- /dev/null +++ b/buf.lock @@ -0,0 +1,2 @@ +# Generated by buf. DO NOT EDIT. +version: v1 diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 0000000000..0ad435358d --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - protos \ No newline at end of file diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000000..9b20e5b4dd --- /dev/null +++ b/cliff.toml @@ -0,0 +1,56 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}](https://github.com/sqlc-dev/sqlc/releases/tag/{{ version }}) +{% else %}\ + ## [unreleased] +{% endif %}\ + +Released {{ timestamp | date(format="%Y-%m-%d") }} + +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits %} + - {%if commit.scope %}({{commit.scope}}) {% endif %}{{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^feat", group = "Features"}, + { message = "^fix", group = "Bug Fixes"}, + { message = "^doc", group = "Documentation"}, + { message = "^perf", group = "Performance"}, + { message = "^refactor", group = "Refactor"}, + { message = "^style", group = "Styling"}, + { message = "^test", group = "Testing"}, + { message = "^chore\\(release\\): prepare for", skip = true}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v*beta" diff --git a/cmd/sqlc-gen-json/main.go b/cmd/sqlc-gen-json/main.go new file mode 100644 index 0000000000..05c804d082 --- /dev/null +++ b/cmd/sqlc-gen-json/main.go @@ -0,0 +1,47 @@ +package main + +import ( + "bufio" + "context" + "fmt" + "io" + "os" + + "github.com/sqlc-dev/sqlc/internal/codegen/json" + "github.com/sqlc-dev/sqlc/internal/plugin" + "google.golang.org/protobuf/proto" +) + +func main() { + if err := run(); err != nil { + fmt.Fprintf(os.Stderr, "error generating JSON: %s", err) + os.Exit(2) + } +} + +func run() error { + var req plugin.GenerateRequest + reqBlob, err := io.ReadAll(os.Stdin) + if err != nil { + return err + } + if err := proto.Unmarshal(reqBlob, &req); err != nil { + return err + } + resp, err := json.Generate(context.Background(), &req) + if err != nil { + return err + } + respBlob, err := proto.Marshal(resp) + if err != nil { + return err + } + w := bufio.NewWriter(os.Stdout) + if _, err := w.Write(respBlob); err != nil { + return err + } + if err := w.Flush(); err != nil { + return err + } + return nil +} diff --git a/cmd/sqlc-test-setup/main.go b/cmd/sqlc-test-setup/main.go new file mode 100644 index 0000000000..3a816f4502 --- /dev/null +++ b/cmd/sqlc-test-setup/main.go @@ -0,0 +1,463 @@ +package main + +import ( + "fmt" + "log" + "os" + "os/exec" + "strings" + "time" +) + +func main() { + log.SetFlags(log.Ltime) + log.SetPrefix("[sqlc-test-setup] ") + + if len(os.Args) < 2 { + fmt.Fprintln(os.Stderr, "usage: sqlc-test-setup ") + os.Exit(1) + } + + switch os.Args[1] { + case "install": + if err := runInstall(); err != nil { + log.Fatalf("install failed: %s", err) + } + case "start": + if err := runStart(); err != nil { + log.Fatalf("start failed: %s", err) + } + default: + fmt.Fprintf(os.Stderr, "unknown command: %s\nusage: sqlc-test-setup \n", os.Args[1]) + os.Exit(1) + } +} + +// 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 +} + +// isMySQLVersionOK checks if the mysqld --version output indicates MySQL 9+. +// 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 := strings.TrimLeft(ver[0], "0") + if major == "" { + return false + } + return major[0] >= '9' + } + } + } + return false +} + +// ---- install ---- + +func runInstall() error { + log.Println("=== Installing PostgreSQL and MySQL for test setup ===") + + if err := installAptProxy(); err != nil { + return fmt.Errorf("configuring apt proxy: %w", err) + } + + if err := installPostgreSQL(); err != nil { + return fmt.Errorf("installing postgresql: %w", err) + } + + if err := installMySQL(); err != nil { + return fmt.Errorf("installing mysql: %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 ---") + + if commandExists("psql") { + out, err := runOutput("psql", "--version") + if err == nil { + log.Printf("postgresql is already installed: %s", strings.TrimSpace(out)) + log.Println("skipping postgresql installation") + return nil + } + } + + log.Println("updating apt package lists") + if err := run("sudo", "apt-get", "update", "-qq"); err != nil { + return fmt.Errorf("apt-get update: %w", err) + } + + log.Println("installing postgresql package") + if err := run("sudo", "apt-get", "install", "-y", "-qq", "postgresql"); err != nil { + return fmt.Errorf("apt-get install postgresql: %w", err) + } + + log.Println("postgresql installed successfully") + return nil +} + +func installMySQL() error { + log.Println("--- Installing MySQL 9 ---") + + 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.Println("mysql version is 9+, skipping installation") + return nil + } + log.Println("mysql version is too old, upgrading to MySQL 9") + // 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 MySQL 9 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") + } + } + + bundleURL := "https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_9.1.0-1ubuntu24.04_amd64.deb-bundle.tar" + bundleTar := "/tmp/mysql-server-bundle.tar" + extractDir := "/tmp/mysql9" + + if _, err := os.Stat(bundleTar); err != nil { + log.Printf("downloading MySQL 9 bundle from %s", 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.Println("mysql 9 installed successfully") + return nil +} + +// ---- start ---- + +func runStart() error { + log.Println("=== Starting PostgreSQL and MySQL ===") + + if err := startPostgreSQL(); err != nil { + return fmt.Errorf("starting postgresql: %w", err) + } + + if err := startMySQL(); err != nil { + return fmt.Errorf("starting mysql: %w", err) + } + + log.Println("=== Both databases are running and configured ===") + log.Println("PostgreSQL: postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable") + log.Println("MySQL: root:mysecretpassword@tcp(127.0.0.1:3306)/mysql") + return nil +} + +func startPostgreSQL() error { + log.Println("--- Starting PostgreSQL ---") + + log.Println("starting postgresql service") + if err := run("sudo", "service", "postgresql", "start"); err != nil { + return fmt.Errorf("service postgresql start: %w", err) + } + + log.Println("setting password for postgres user") + if err := run("sudo", "-u", "postgres", "psql", "-c", "ALTER USER postgres PASSWORD 'postgres';"); err != nil { + return fmt.Errorf("setting postgres password: %w", err) + } + + log.Println("detecting postgresql config directory") + hbaPath, err := detectPgHBAPath() + if err != nil { + return fmt.Errorf("detecting pg_hba.conf path: %w", err) + } + + if err := ensurePgHBAEntry(hbaPath); err != nil { + return fmt.Errorf("configuring pg_hba.conf: %w", err) + } + + log.Println("reloading postgresql configuration") + if err := run("sudo", "service", "postgresql", "reload"); err != nil { + return fmt.Errorf("reloading postgresql: %w", err) + } + + log.Println("verifying postgresql connection") + if err := run("bash", "-c", "PGPASSWORD=postgres psql -h 127.0.0.1 -U postgres -c 'SELECT 1;'"); err != nil { + return fmt.Errorf("postgresql connection test failed: %w", err) + } + + log.Println("postgresql is running and configured") + return nil +} + +// detectPgHBAPath finds the pg_hba.conf file across different PostgreSQL versions. +func detectPgHBAPath() (string, error) { + out, err := runOutput("bash", "-c", "sudo -u postgres psql -t -c 'SHOW hba_file;'") + if err != nil { + return "", fmt.Errorf("querying hba_file: %w (output: %s)", err, out) + } + path := strings.TrimSpace(out) + if path == "" { + return "", fmt.Errorf("pg_hba.conf path is empty") + } + log.Printf("found pg_hba.conf at %s", path) + return path, nil +} + +// ensurePgHBAEntry adds the md5 auth line to pg_hba.conf if it's not already present. +func ensurePgHBAEntry(hbaPath string) error { + hbaLine := "host all all 127.0.0.1/32 md5" + + out, err := runOutput("sudo", "cat", hbaPath) + if err != nil { + return fmt.Errorf("reading pg_hba.conf: %w", err) + } + + if strings.Contains(out, "127.0.0.1/32 md5") { + log.Println("md5 authentication for 127.0.0.1/32 already configured in pg_hba.conf, skipping") + return nil + } + + log.Printf("enabling md5 authentication in %s", hbaPath) + cmd := fmt.Sprintf("echo '%s' | sudo tee -a %s", hbaLine, hbaPath) + return run("bash", "-c", cmd) +} + +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/main.go b/cmd/sqlc/main.go index 24dd1bcc5d..f003db4846 100644 --- a/cmd/sqlc/main.go +++ b/cmd/sqlc/main.go @@ -3,7 +3,7 @@ package main import ( "os" - "github.com/kyleconroy/sqlc/internal/cmd" + "github.com/sqlc-dev/sqlc/internal/cmd" ) func main() { diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000000..ff48a49f12 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,100 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1742659231, + "owner": "cachix", + "repo": "devenv", + "rev": "c651cb04013be972767aaecb3e9a98fc930d080e", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1742707865, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000000..8a25b78d5a --- /dev/null +++ b/devenv.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: + +{ + # https://devenv.sh/packages/ + packages = [ + pkgs.buf + pkgs.go_1_24 + pkgs.git + pkgs.git-cliff + pkgs.govulncheck + pkgs.gopls + pkgs.golint + pkgs.mysql-shell + pkgs.postgresql_15 + pkgs.python311 + ]; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000000..c7cb5cedad --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,3 @@ +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/docker-compose.yml b/docker-compose.yml index b4990c0225..f318d1ed93 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,21 @@ version: "3.8" services: mysql: - image: "mysql:8" + image: "mysql:9" ports: - "3306:3306" restart: always environment: MYSQL_DATABASE: dinotest - MYSQL_PASSWORD: mysecretpassword MYSQL_ROOT_PASSWORD: mysecretpassword - MYSQL_USER: root + MYSQL_ROOT_HOST: '%' postgresql: - image: "postgres:13" + image: "postgres:16" ports: - "5432:5432" restart: always environment: - POSTGRES_DB: dinotest + POSTGRES_DB: postgres POSTGRES_PASSWORD: mysecretpassword POSTGRES_USER: postgres diff --git a/docs/_static/customize.css b/docs/_static/customize.css new file mode 100644 index 0000000000..62b715840c --- /dev/null +++ b/docs/_static/customize.css @@ -0,0 +1,22 @@ +.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; +} + +#sponsorship > img { + width: 100%; + max-width: 200px; +} diff --git a/docs/_static/favicon.png b/docs/_static/favicon.png new file mode 100644 index 0000000000..17d8419a6c Binary files /dev/null and b/docs/_static/favicon.png differ diff --git a/docs/_static/logo.png b/docs/_static/logo.png new file mode 100644 index 0000000000..dd8a887094 Binary files /dev/null and b/docs/_static/logo.png differ diff --git a/docs/_templates/breadcrumbs.html b/docs/_templates/breadcrumbs.html new file mode 100644 index 0000000000..40a8b82be1 --- /dev/null +++ b/docs/_templates/breadcrumbs.html @@ -0,0 +1,7 @@ +{% extends "!breadcrumbs.html" %} + +{% block breadcrumbs %} +{% if show_banner %} +{% endif %} +{{ super() }} +{% endblock %} diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 0000000000..4b748dd160 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,16 @@ +{% extends "!layout.html" %} + +{% block extrahead %} + +{{ super() }} +{% endblock %} + +{% block menu %} +{{ super() }} +

Sponsored By

+
+ +Riza logo + +
+{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 5db84ed289..76638e65d3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,7 +10,7 @@ # 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 os # import sys # sys.path.insert(0, os.path.abspath('.')) import sphinx_rtd_theme @@ -18,11 +18,11 @@ # -- Project information ----------------------------------------------------- project = 'sqlc' -copyright = '2021, Kyle Conroy' -author = 'Kyle Conroy' +copyright = '2024, Riza, Inc.' +author = 'Riza, Inc.' # The full version, including alpha/beta/rc tags -release = '1.6.0' +release = '1.30.0' # -- General configuration --------------------------------------------------- @@ -31,8 +31,10 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'recommonmark', + 'myst_parser', 'sphinx_rtd_theme', + 'sphinx_favicon', + 'sphinxext.rediraffe', ] # Add any paths that contain templates here, relative to this directory. @@ -54,3 +56,28 @@ # 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", +] + +rediraffe_redirects = { + "howto/upload.md": "howto/push.md", +} diff --git a/docs/guides/development.md b/docs/guides/development.md index cf84beced6..f8196572be 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -8,6 +8,12 @@ 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 ``` @@ -24,7 +30,7 @@ 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,15 +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.sh` script. - -``` -make regen -``` - -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..b49ed69fda --- /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](../docs/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.30.0 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 new file mode 100644 index 0000000000..17660aaad4 --- /dev/null +++ b/docs/guides/migrating-to-sqlc-gen-kotlin.md @@ -0,0 +1,119 @@ +# Migrating to sqlc-gen-kotlin + +Starting in sqlc 1.16.0, built-in Kotlin support has been deprecated. It will +be fully removed in 1.17.0 in favor of sqlc-gen-kotlin. + +This guide will walk you through migrating to the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin, +which involves three steps. + +1. Add the sqlc-gen-kotlin plugin +2. Migrate each package +3. Re-generate the code + +## Add the sqlc-gen-kotlin plugin + +In your configuration file, add a `plugins` array if you don't have one +already. Add the following configuration for the plugin: + +```json +{ + "version": "2", + "plugins": [ + { + "name": "kt", + "wasm": { + "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm", + "sha256": "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c" + } + } + ] +} +``` + +```yaml +version: "2" +plugins: +- name: "kt" + wasm: + url: "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm" + sha256: "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c" +``` + +## Migrate each package + +Your package configuration should currently looks something like this for JSON. + +```json + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "kotlin": { + "out": "src/main/kotlin/com/example/foo", + "package": "com.example.foo" + } + } + } + ] +``` + +Or this if you're using YAML. + +```yaml + sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + kotlin: + out: "src/main/kotlin/com/example/foo" + package: "com.example.foo" +``` + +To use the plugin, you'll need to replace the `gen` mapping with the `codegen` +collection. Add the `plugin` field, setting it to `kt`. All fields other than +`out` need to be moved into the `options` mapping. + +After you're done, it should look like this for JSON. + +```json + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "src/main/kotlin/com/example/foo", + "plugin": "kt", + "options": { + "package": "com.example.foo" + } + } + ] + } + ] +``` + +Or this for YAML. + +```yaml + sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + codegen: + - plugin: "kt" + out: "src/main/kotlin/com/example/foo" + options: + package: "com.example.foo" +``` + +## Re-generate the code + +Run `sqlc generate`. The plugin will produce the same output, so you shouldn't +see any changes. The first time `sqlc generate` is run, the plugin must be +downloaded and compiled, resulting in a slightly longer runtime. Subsequent +`generate` calls will be fast. diff --git a/docs/guides/migrating-to-sqlc-gen-python.md b/docs/guides/migrating-to-sqlc-gen-python.md new file mode 100644 index 0000000000..e139ad0636 --- /dev/null +++ b/docs/guides/migrating-to-sqlc-gen-python.md @@ -0,0 +1,131 @@ +# Migrating to sqlc-gen-python + +Starting in sqlc 1.16.0, built-in Python support has been deprecated. It will +be fully removed in 1.17.0 in favor of sqlc-gen-python. + +This guide will walk you through migrating to the [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugin, +which involves three steps. + +1. Add the sqlc-gen-python plugin +2. Migrate each package +3. Re-generate the code + +## Add the sqlc-gen-python plugin + +In your configuration file, add a `plugins` array if you don't have one +already. Add the following configuration for the plugin: + +```json +{ + "version": "2", + "plugins": [ + { + "name": "py", + "wasm": { + "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm", + "sha256": "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" + } + } + ] +} +``` + +```yaml +version: "2" +plugins: + - name: "py" + wasm: + url: "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm" + sha256: "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" +``` + +## Migrate each package + +Your package configuration should currently looks something like this for JSON. + +```json + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "python": { + "out": "src", + "package": "foo", + "emit_sync_querier": true, + "emit_async_querier": true, + "query_parameter_limit": 5 + } + } + } + ] +``` + +Or this if you're using YAML. + +```yaml + sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + python: + out: "src" + package: "foo" + emit_sync_querier: true + emit_async_querier: true + query_parameter_limit: 5 +``` + +To use the plugin, you'll need to replace the `gen` mapping with the `codegen` +collection. Add the `plugin` field, setting it to `py`. All fields other than +`out` need to be moved into the `options` mapping. + +After you're done, it should look like this for JSON. + +```json + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "src", + "plugin": "py", + "options": { + "package": "authors", + "emit_sync_querier": true, + "emit_async_querier": true, + "query_parameter_limit": 5 + } + } + ] + } + ] +``` + +Or this for YAML. + +```yaml + sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + codegen: + - plugin: "py" + out: "src" + options: + package: "foo" + emit_sync_querier: true + emit_async_querier: true + query_parameter_limit: 5 +``` + +## Re-generate the code + +Run `sqlc generate`. The plugin will produce the same output, so you shouldn't +see any changes. The first time `sqlc generate` is run, the plugin must be +downloaded and compiled, resulting in a slightly longer runtime. Subsequent +`generate` calls will be fast. diff --git a/docs/guides/plugins.md b/docs/guides/plugins.md new file mode 100644 index 0000000000..b229f91732 --- /dev/null +++ b/docs/guides/plugins.md @@ -0,0 +1,104 @@ +# Using plugins + +To use plugins, you must be using [Version 2](../reference/config.md#version-2) of +the configuration file. The top-level `plugins` array defines the available +plugins. + +## WASM plugins + +> WASM plugins are fully sandboxed; they do not have access to the network, +> filesystem, or environment variables. + +In the `codegen` section, the `out` field dictates what directory will contain +the new files. The `plugin` key must reference a plugin defined in the +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. + + +```yaml +version: '2' +plugins: +- name: greeter + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-greeter/releases/download/v0.1.0/sqlc-gen-greeter.wasm + sha256: afc486dac2068d741d7a4110146559d12a013fd0286f42a2fc7dcd802424ad07 +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: greeter + options: + lang: en-US +``` + +For a complete working example see the following files: +- [sqlc-gen-greeter](https://github.com/sqlc-dev/sqlc-gen-greeter) + - A WASM plugin (written in Rust) that outputs a friendly message +- [wasm_plugin_sqlc_gen_greeter](https://github.com/sqlc-dev/sqlc/tree/main/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter) + - An example project showing how to use a WASM plugin + +## Process plugins + +> Process-based plugins offer minimal security. Only use plugins that you +> trust. Better yet, only use plugins that you've written yourself. + +In the `codegen` section, the `out` field dictates what directory will contain +the new files. The `plugin` key must reference a plugin defined in the +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. + +```yaml +version: '2' +plugins: +- name: jsonb + process: + cmd: sqlc-gen-json +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: jsonb + options: + indent: " " + filename: codegen.json +``` + +For a complete working example see the following files: +- [sqlc-gen-json](https://github.com/sqlc-dev/sqlc/tree/main/cmd/sqlc-gen-json) + - 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 + +By default, plugins do not inherit access to environment variables. Instead, +you can configure access on a per-variable basis. For example, if your plugin +needs the `PATH` environment variable, add `PATH` to the `env` list in the +`plugins` collection. + +```yaml +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: test +plugins: +- name: test + env: + - PATH + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm + sha256: 138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790 +``` + +A variable named `SQLC_VERSION` is always included in the plugin's +environment, set to the version of the `sqlc` executable invoking it. diff --git a/docs/guides/privacy.md b/docs/guides/privacy.md index 873f1a047b..da29fd8853 100644 --- a/docs/guides/privacy.md +++ b/docs/guides/privacy.md @@ -9,9 +9,9 @@ place. ## Our Privacy Pledge -The `sqlc` program does not collect any information. It does not send crash -reports to a third-party. It does not gather anonymous aggregate user behaviour -analytics. +The `sqlc` command line tool does not collect any information. It +does not send crash reports to a third-party. It does not gather anonymous +aggregate user behaviour analytics. No analytics. No finger-printing. @@ -19,7 +19,7 @@ No tracking. Not now and not in the future. -## Distribution Channels +### Distribution Channels We distribute sqlc using popular package managers such as [Homebrew](https://brew.sh/) and [Snapcraft](https://snapcraft.io/). These @@ -28,3 +28,28 @@ metrics. We use these services to make it easy to for users to install sqlc. There will always be an option to download sqlc from a stable URL. + +## Hosted Services + +We provide a few hosted services in addition to the sqlc command line tool. + +### sqlc.dev + +* Hosted on [GitHub Pages](https://pages.github.com/) +* Analytics with [Plausible](https://plausible.io/privacy-focused-web-analytics) + +### docs.sqlc.dev + +* Hosted on [Read the Docs](https://readthedocs.org/) +* Analytics with [Plausible](https://plausible.io/privacy-focused-web-analytics) + +### play.sqlc.dev + +* Hosted on [Heroku](https://heroku.com) +* Playground data stored in [Google Cloud Storage](https://cloud.google.com/storage) + * Automatically deleted after 30 days + +### app.sqlc.dev / api.sqlc.dev + +* Hosted on [Heroku](https://heroku.com) +* Error tracking and tracing with [Sentry](https://sentry.io) diff --git a/docs/guides/using-go-and-pgx.rst b/docs/guides/using-go-and-pgx.rst new file mode 100644 index 0000000000..68e2242926 --- /dev/null +++ b/docs/guides/using-go-and-pgx.rst @@ -0,0 +1,133 @@ +================ +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) + } + +.. note:: + For production applications, consider using pgxpool for connection pooling: + + .. code-block:: 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/howto/ci-cd.md b/docs/howto/ci-cd.md new file mode 100644 index 0000000000..302c6353a7 --- /dev/null +++ b/docs/howto/ci-cd.md @@ -0,0 +1,161 @@ +# 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 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. + +```diff +% sqlc diff +--- a/postgresql/query.sql.go ++++ b/postgresql/query.sql.go +@@ -55,7 +55,7 @@ + + const listAuthors = `-- name: ListAuthors :many + SELECT id, name, bio FROM authors +-ORDER BY name ++ORDER BY bio + ` +``` + +`sqlc vet` runs a set of lint rules against your SQL queries. These rules are +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). + +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 + +We provide the [setup-sqlc](https://github.com/marketplace/actions/setup-sqlc) +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. + +### diff + +The following GitHub Workflow configuration runs `sqlc diff` on every push. + +```yaml +name: sqlc +on: [push] +jobs: + diff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.30.0' + - run: sqlc diff +``` + +### vet + +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. + +```yaml +name: sqlc +on: [push] +jobs: + vet: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.30.0' + # 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 + +``` + +### 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 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: + 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.30.0' + - 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.30.0' + - 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.30.0' + - run: sqlc push + env: + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} +`````` diff --git a/docs/howto/ddl.md b/docs/howto/ddl.md index f7c46aa3f5..2d51af7fad 100644 --- a/docs/howto/ddl.md +++ b/docs/howto/ddl.md @@ -1,6 +1,7 @@ # Modifying the database schema -sqlc understands `ALTER TABLE` statements when parsing SQL. +sqlc parses `CREATE TABLE` and `ALTER TABLE` statements in order to generate +the necessary code. ```sql CREATE TABLE authors ( @@ -24,28 +25,38 @@ type Writer struct { ## Handling SQL migrations -sqlc will ignore rollback statements when parsing migration SQL files. The -following tools are current supported: +sqlc does not perform database migrations for you. However, sqlc is able to +differentiate between up and down migrations. sqlc ignores down migrations when +parsing SQL files. +sqlc supports parsing migrations from the following tools: + +- [atlas](https://github.com/ariga/atlas) - [dbmate](https://github.com/amacneil/dbmate) - [golang-migrate](https://github.com/golang-migrate/migrate) - [goose](https://github.com/pressly/goose) - [sql-migrate](https://github.com/rubenv/sql-migrate) - [tern](https://github.com/jackc/tern) -### goose +To enable migration parsing, specify the migration directory instead of a schema file: + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "db/migrations" + gen: + go: + package: "tutorial" + out: "tutorial" +``` -```sql --- +goose Up -CREATE TABLE post ( - id int NOT NULL, - title text, - body text, - PRIMARY KEY(id) -); +### atlas --- +goose Down -DROP TABLE post; +```sql +-- Create "post" table +CREATE TABLE "public"."post" ("id" integer NOT NULL, "title" text NULL, "body" text NULL, PRIMARY KEY ("id")); ``` ```go @@ -58,45 +69,52 @@ type Post struct { } ``` -### sql-migrate +### dbmate ```sql --- +migrate Up --- SQL in section 'Up' is executed when this migration is applied -CREATE TABLE people (id int); - +-- migrate:up +CREATE TABLE foo (bar INT NOT NULL); --- +migrate Down --- SQL section 'Down' is executed when this migration is rolled back -DROP TABLE people; +-- migrate:down +DROP TABLE foo; ``` ```go package db -type People struct { - ID int32 +type Foo struct { + Bar int32 } ``` -### tern +### golang-migrate -```sql -CREATE TABLE comment (id int NOT NULL, text text NOT NULL); ----- create above / drop below ---- -DROP TABLE comment; -``` +**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. -```go -package db +This doesn't work as intended. -type Comment struct { - ID int32 - Text string -} +``` +1_initial.up.sql +... +9_foo.up.sql +# this migration file will be parsed BEFORE 9_foo +10_bar.up.sql ``` -### golang-migrate +This worked as intended. + +``` +001_initial.up.sql +... +009_foo.up.sql +010_bar.up.sql +``` In `20060102.up.sql`: @@ -125,20 +143,90 @@ type Post struct { } ``` -### dbmate +### goose + +**Warning:** +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. + +This doesn't work as intended. + +``` +1_initial.sql +... +9_foo.sql +# this migration file will be parsed BEFORE 9_foo +10_bar.sql +``` + +This worked as intended. + +``` +001_initial.sql +... +009_foo.sql +010_bar.sql +``` ```sql --- migrate:up -CREATE TABLE foo (bar INT NOT NULL); +-- +goose Up +CREATE TABLE post ( + id int NOT NULL, + title text, + body text, + PRIMARY KEY(id) +); --- migrate:down -DROP TABLE foo; +-- +goose Down +DROP TABLE post; ``` ```go package db -type Foo struct { - Bar int32 +type Post struct { + ID int + Title sql.NullString + Body sql.NullString +} +``` + +### sql-migrate + +```sql +-- +migrate Up +-- SQL in section 'Up' is executed when this migration is applied +CREATE TABLE people (id int); + + +-- +migrate Down +-- SQL section 'Down' is executed when this migration is rolled back +DROP TABLE people; +``` + +```go +package db + +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 50b91277d6..95045a37a6 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{}) error + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) } func New(db DBTX) *Queries { diff --git a/docs/howto/embedding.md b/docs/howto/embedding.md new file mode 100644 index 0000000000..5ea8cbbc0a --- /dev/null +++ b/docs/howto/embedding.md @@ -0,0 +1,61 @@ +#### 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 +with students and test scores. + +```sql +CREATE TABLE students ( + id bigserial PRIMARY KEY, + name text NOT NULL, + age integer NOT NULL +); + +CREATE TABLE test_scores ( + student_id bigint NOT NULL, + score integer NOT NULL, + grade text NOT NULL +); +``` + +We want to select the student record and the scores they got on a test. +Here's how we'd usually do that: + +```sql +-- name: ScoreAndTests :many +SELECT students.*, test_scores.* +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +When using Go, sqlc will produce a struct like this: + +```go +type ScoreAndTestsRow struct { + ID int64 + Name string + Age int32 + StudentID int64 + Score int32 + Grade string +} +``` + +With embedding, the struct will contain a model for both tables instead of a +flattened list of columns. + +```sql +-- name: ScoreAndTests :many +SELECT sqlc.embed(students), sqlc.embed(test_scores) +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +``` +type ScoreAndTestsRow struct { + Student Student + TestScore TestScore +} +``` \ No newline at end of file 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 c29c5d9ae6..7bb02d6745 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{}) error + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) } func New(db DBTX) *Queries { @@ -45,26 +56,54 @@ func (q *Queries) CreateAuthor(ctx context.Context, bio string) error { sqlc has full support for the `RETURNING` statement. ```sql +-- Example queries for sqlc CREATE TABLE authors ( - id SERIAL PRIMARY KEY, - bio text NOT NULL + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text ); +``` --- name: Delete :exec -DELETE FROM authors WHERE id = $1; - --- name: DeleteAffected :execrows -DELETE FROM authors WHERE id = $1; +**PostgreSQL:** +```sql +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; --- name: DeleteID :one -DELETE FROM authors WHERE id = $1 +-- name: CreateAuthorAndReturnId :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) RETURNING id; +``` --- name: DeleteAuthor :one -DELETE FROM authors WHERE id = $1 +**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 @@ -73,66 +112,127 @@ import ( "database/sql" ) -type Author struct { - ID int - Bio string +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 } -type DBTX interface { - ExecContext(context.Context, string, ...interface{}) error - QueryRowContext(context.Context, string, ...interface{}) error +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 } -func New(db DBTX) *Queries { - return &Queries{db: db} +const createAuthorAndReturnId = `-- name: CreateAuthorAndReturnId :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id +` + +type CreateAuthorAndReturnIdParams struct { + Name string + Bio sql.NullString } -type Queries struct { - db DBTX +func (q *Queries) CreateAuthorAndReturnId(ctx context.Context, arg CreateAuthorAndReturnIdParams) (int64, error) { + row := q.db.QueryRowContext(ctx, createAuthorAndReturnId, arg.Name, arg.Bio) + var id int64 + err := row.Scan(&id) + return id, err } +``` -const delete = `-- name: Delete :exec -DELETE FROM authors WHERE id = $1 -` +## Using CopyFrom -func (q *Queries) Delete(ctx context.Context, id int) error { - _, err := q.db.ExecContext(ctx, delete, id) - return err -} +### PostgreSQL -const deleteAffected = `-- name: DeleteAffected :exec -DELETE FROM authors WHERE id = $1 -` +PostgreSQL supports the [COPY protocol](https://www.postgresql.org/docs/current/sql-copy.html) that can insert rows a lot faster than sequential inserts. You can use this easily with sqlc: -func (q *Queries) DeleteAffected(ctx context.Context, id int) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAffected, id) - if err != nil { - return 0, err - } - return result.RowsAffected() -} +```sql +CREATE TABLE authors ( + id SERIAL PRIMARY KEY, + name text NOT NULL, + bio text NOT NULL +); -const deleteID = `-- name: DeleteID :one -DELETE FROM authors WHERE id = $1 -RETURNING id -` +-- name: CreateAuthors :copyfrom +INSERT INTO authors (name, bio) VALUES ($1, $2); +``` -func (q *Queries) DeleteID(ctx context.Context, id int) (int, error) { - row := q.db.QueryRowContext(ctx, deleteID, id) - var i int - err := row.Scan(&i) - return i, err +```go +type CreateAuthorsParams struct { + Name string + Bio string } -const deleteAuhtor = `-- name: DeleteAuthor :one -DELETE FROM authors WHERE id = $1 -RETURNING id, bio -` +func (q *Queries) CreateAuthors(ctx context.Context, arg []CreateAuthorsParams) (int64, error) { + ... +} +``` -func (q *Queries) DeleteAuthor(ctx context.Context, id int) (Author, error) { - row := q.db.QueryRowContext(ctx, deleteAuhtor, id) - var i Author - err := row.Scan(&i.ID, &i.Bio) - return i, err +The `:copyfrom` command requires either `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" +``` + +### MySQL + +MySQL supports a similar feature using [LOAD DATA](https://dev.mysql.com/doc/refman/8.0/en/load-data.html). + +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 necessary. + +Check the [error handling](https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling) documentation for more information. + +```sql +CREATE TABLE foo (a text, b integer, c DATETIME, d DATE); + +-- name: InsertValues :copyfrom +INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?); +``` + +```go +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + ... } ``` + +The `:copyfrom` command requires setting the `sql_package` and `sql_driver` options. + +```yaml +version: "2" +sql: + - engine: "mysql" + queries: "query.sql" + schema: "query.sql" + gen: + go: + package: "db" + sql_package: "database/sql" + sql_driver: "github.com/go-sql-driver/mysql" + out: "db" +``` \ No newline at end of file diff --git a/docs/howto/managed-databases.md b/docs/howto/managed-databases.md new file mode 100644 index 0000000000..745524ea5f --- /dev/null +++ b/docs/howto/managed-databases.md @@ -0,0 +1,101 @@ +# Managed databases + +*Added in v1.22.0* + +`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. + +Managed databases are under active development, and we're interested in +supporting other use-cases. + +## Configuring managed databases + +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`. +Access to a running database server is required. Add a connection string to the `servers` mapping. + +```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 +``` + +An environment variable can also be used via the `${}` syntax. + +```yaml +version: '2' +servers: +- engine: postgresql + uri: ${DATABASE_URI} +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true +``` + +## 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 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) +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' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true + rules: + - sqlc/db-prepare +``` diff --git a/docs/howto/named_parameters.md b/docs/howto/named_parameters.md index 1212549fac..0837c70c15 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: @@ -17,8 +17,8 @@ RETURNING *; ```go type UpdateAuthorNameParams struct { - Column1 bool `json:""` - Column2_2 string `json:"_2"` + Column1 bool `json:""` + Column2_2 string `json:"_2"` } ``` @@ -38,14 +38,18 @@ RETURNING *; ```go type UpdateAuthorNameParams struct { - SetName bool `json:"set_name"` - Name string `json:"name"` + SetName bool `json:"set_name"` + Name string `json:"name"` } ``` 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 @@ -56,3 +60,35 @@ SET END RETURNING *; ``` + +## Nullable parameters + +sqlc infers the nullability of any specified parameters, and often does exactly +what you want. If you want finer control over the nullability of your +parameters, you may use `sqlc.narg()` (**n**ullable arg) to override the default +behavior. Using `sqlc.narg` tells sqlc to ignore whatever nullability it has +inferred and generate a nullable parameter instead. There is no nullable +equivalent of the `@` syntax. + +Here is an example that uses a single query to allow updating an author's +name, bio or both. + +```sql +-- name: UpdateAuthor :one +UPDATE author +SET + name = coalesce(sqlc.narg('name'), name), + bio = coalesce(sqlc.narg('bio'), bio) +WHERE id = sqlc.arg('id') +RETURNING *; +``` + +The following code is generated: + +```go +type UpdateAuthorParams struct { + Name sql.NullString + Bio sql.NullString + ID int64 +} +``` diff --git a/docs/howto/overrides.md b/docs/howto/overrides.md new file mode 100644 index 0000000000..8cdcbde6a2 --- /dev/null +++ b/docs/howto/overrides.md @@ -0,0 +1,188 @@ +# Overriding types + +:::{note} +Type overrides and field renaming are only fully-supported for Go. +::: + +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" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + sql_package: "pgx/v5" + overrides: + - db_type: "uuid" + nullable: true + go_type: + import: "github.com/google/uuid" + type: "UUID" + - column: "users.birthday" + go_type: "time.Time" +``` + +:::{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`: + - 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`: + - 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`: + - 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 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`, 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} +When generating code, `column` override configurations take precedence over `db_type` configurations. +::: + +### The `go_type` map + +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. +- `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 `true`, generated code will use a pointer to the type rather than the type itself. +- `slice`: + - If `true`, generated code will use a slice of the type rather than the type itself. + +An example: + +```yaml +version: "2" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + sql_package: "pgx/v5" + overrides: + - db_type: "uuid" + go_type: + import: "a/b/v2" + package: "b" + type: "MyType" + pointer: true +``` + +## 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/prepared_query.md b/docs/howto/prepared_query.md index 2ad205dc9f..c6eff3e722 100644 --- a/docs/howto/prepared_query.md +++ b/docs/howto/prepared_query.md @@ -1,5 +1,15 @@ # Preparing queries +If you're using `pgx/v5` you get its +[implicit support](https://github.com/jackc/pgx/wiki/Automatic-Prepared-Statement-Caching) +for prepared statements. No additional `sqlc` configuration is required. + +For other drivers, `sqlc` can give you the option to explicitly use prepared +queries. These prepared queries also work with transactions. + +You'll need to set `emit_prepared_queries` to `true` in your `sqlc` configuration +to generate code similar to the example below. + ```sql CREATE TABLE records ( id SERIAL PRIMARY KEY @@ -10,19 +20,17 @@ SELECT * FROM records WHERE id = $1; ``` -sqlc has an option to use perpared queries. These prepared queries also work -with transactions. - ```go package db import ( "context" "database/sql" + "fmt" ) type Record struct { - ID int + ID int32 } type DBTX interface { @@ -38,12 +46,12 @@ func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error if q.getRecordStmt, err = db.PrepareContext(ctx, getRecord); err != nil { - return nil, err + return nil, fmt.Errorf("error preparing query GetRecord: %w", err) } 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 ...interface{}) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) @@ -73,11 +81,9 @@ SELECT id FROM records WHERE id = $1 ` -func (q *Queries) GetRecord(ctx context.Context, id int) (Record, error) { +func (q *Queries) GetRecord(ctx context.Context, id int32) (int32, error) { row := q.queryRow(ctx, q.getRecordStmt, getRecord, id) - var i Record - err := row.Scan(&i.ID) - return i, err + err := row.Scan(&id) + return id, err } ``` - diff --git a/docs/howto/push.md b/docs/howto/push.md new file mode 100644 index 0000000000..337e127513 --- /dev/null +++ b/docs/howto/push.md @@ -0,0 +1,71 @@ +# `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 b9ff8d12d9..857d5f0530 100644 --- a/docs/howto/query_count.md +++ b/docs/howto/query_count.md @@ -54,8 +54,8 @@ ORDER BY 1 ` type CountAuthorsByTownRow struct { - Hometown string - Count int + Hometown string + Count int } func (q *Queries) CountAuthorsByTown(ctx context.Context) ([]CountAuthorsByTownRow, error) { diff --git a/docs/howto/rename.md b/docs/howto/rename.md new file mode 100644 index 0000000000..47ee05cf7e --- /dev/null +++ b/docs/howto/rename.md @@ -0,0 +1,122 @@ +# Renaming fields + +Struct field names are generated from column names using a simple algorithm: +split the column name on underscores and capitalize the first letter of each +part. + +``` +account -> Account +spotify_url -> SpotifyUrl +app_id -> AppID +``` + +If you're not happy with a field's generated name, use the `rename` mapping +to pick a new name. The keys are column names and the values are the struct +field name to use. + +```yaml +version: "2" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "postgresql" + rename: + spotify_url: "SpotifyURL" +``` + +## 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 and the `book_publishers` +table will generate a `BookPublisher` struct. + +```sql +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE book_publishers ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); +``` + +```go +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Publisher struct { + ID int64 + Name string +} +``` + +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' +packages: +- path: db + engine: postgresql + schema: query.sql + 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 +package db + +import ( + "database/sql" +) + +type Writer struct { + ID int64 + 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 map to different rename values. diff --git a/docs/howto/select.md b/docs/howto/select.md index b5ee0b5d2f..9a53a1d9ef 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,9 +23,20 @@ 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 -satisty this interface. +satisfy this interface. The database access methods are added to a `Queries` struct, which is created using the `New` method. @@ -72,10 +87,10 @@ WHERE id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, id int) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) - var i Author - err := row.Scan(&i.ID, &i.Bio, &i.BirthYear) - return i, err + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Bio, &i.BirthYear) + return i, err } const listAuthors = `-- name: ListAuthors :many @@ -84,26 +99,26 @@ ORDER BY id ` 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.Bio, &i.BirthYear); 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 + 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.Bio, &i.BirthYear); 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 } ``` @@ -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`. @@ -133,6 +148,10 @@ When selecting multiple columns, a row record (method-specific struct) is returned. In this case, `GetInfoForAuthor` returns a struct with two fields: `Bio` and `BirthYear`. +If a query result has no row records, a zero value and an `ErrNoRows` error are +returned instead of a zero value and `nil`. For instance, when the `GetBioForAuthor` +result has no rows, it will return `""` and `ErrNoRows`. + ```go package db @@ -175,9 +194,9 @@ type GetInfoForAuthorRow struct { BirthYear int } -func (q *Queries) GetBioForAuthor(ctx context.Context, id int) (GetBioForAuthor, error) { +func (q *Queries) GetInfoForAuthor(ctx context.Context, id int) (GetInfoForAuthorRow, error) { row := q.db.QueryRowContext(ctx, getInfoForAuthor, id) - var i GetBioForAuthor + var i GetInfoForAuthorRow err := row.Scan(&i.Bio, &i.BirthYear) return i, err } @@ -185,11 +204,13 @@ func (q *Queries) GetBioForAuthor(ctx context.Context, id int) (GetBioForAuthor, ## Passing a slice as a parameter to a query +### PostgreSQL + In PostgreSQL, [ANY](https://www.postgresql.org/docs/current/functions-comparisons.html#id-1.5.8.28.16) allows you to check if a value exists in an array expression. Queries using ANY with a single parameter will generate method signatures with slices as -arguments. +arguments. Use the postgres data types, eg: int, varchar, etc. ```sql CREATE TABLE authors ( @@ -212,7 +233,7 @@ import ( "context" "database/sql" - "github.com/lib/pq" + "github.com/lib/pq" ) type Author struct { @@ -240,25 +261,133 @@ WHERE id = ANY($1::int[]) ` func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors, pq.Array(ids)) - 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.Bio, &i.BirthYear); 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 + rows, err := q.db.QueryContext(ctx, listAuthors, pq.Array(ids)) + 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.Bio, &i.BirthYear); 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 +} +``` + +### MySQL and SQLite + +MySQL and SQLite differ from PostgreSQL in that placeholders must be generated based on +the number of elements in the slice you pass in. Though trivial it is still +something of a nuisance. The passed in slice must not be nil or empty or an +error will be returned (ie not a panic). The placeholder insertion location is +marked by the meta-function `sqlc.slice()` (which is similar to `sqlc.arg()` +that you see documented under [Naming parameters](named_parameters.md)). + +To rephrase, the `sqlc.slice('param')` behaves identically to `sqlc.arg()` it +terms of how it maps the explicit argument to the function signature, eg: + + * `sqlc.slice('ids')` maps to `ids []GoType` in the function signature + * `sqlc.slice(cust_ids)` maps to `custIds []GoType` in the function signature + (like `sqlc.arg()`, the parameter does not have to be quoted) + +This feature is not compatible with `emit_prepared_queries` statement found in the +[Configuration file](../reference/config.md). + +```sql +CREATE TABLE authors ( + id SERIAL PRIMARY KEY, + bio text NOT NULL, + birth_year int NOT NULL +); + +-- name: ListAuthorsByIDs :many +SELECT * FROM authors +WHERE id IN (sqlc.slice('ids')); +``` + +The above SQL will generate the following code: + +```go +package db + +import ( + "context" + "database/sql" + "fmt" + "strings" +) + +type Author struct { + ID int + Bio string + BirthYear int +} + +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 +} + +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, + } +} + +const listAuthorsByIDs = `-- name: ListAuthorsByIDs :many +SELECT id, bio, birth_year FROM authors +WHERE id IN (/*SLICE:ids*/?) +` + +func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int64) ([]Author, error) { + sql := listAuthorsByIDs + var queryParams []interface{} + if len(ids) == 0 { + return nil, fmt.Errorf("slice ids must have at least one element") + } + for _, v := range ids { + queryParams = append(queryParams, v) + } + sql = strings.Replace(sql, "/*SLICE:ids*/?", strings.Repeat(",?", len(ids))[1:], 1) + rows, err := q.db.QueryContext(ctx, sql, queryParams...) + 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.Bio, &i.BirthYear); 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/docs/howto/structs.md b/docs/howto/structs.md index 9d367361f4..c0b203df97 100644 --- a/docs/howto/structs.md +++ b/docs/howto/structs.md @@ -31,7 +31,8 @@ CREATE TABLE authors ( ); ``` -sqlc can generate structs with JSON tags. The JSON name for a field matches +sqlc can generate structs with JSON tags by adding the `emit_json_tags` key to the configuration file as it shows on [configuration reference](../reference/config.md). +The JSON name for a field matches the column name in the database. ```go @@ -46,3 +47,7 @@ type Author struct { CreatedAt time.Time `json:"created_at"` } ``` + +## More control + +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 a7f3a1ce51..9ed61b6a4d 100644 --- a/docs/howto/transactions.md +++ b/docs/howto/transactions.md @@ -1,30 +1,40 @@ # Using transactions +In the code generated by sqlc, the `WithTx` method allows a `Queries` instance to be associated with a transaction. +For example, with the following SQL structure: + +`schema.sql`: ```sql CREATE TABLE records ( - id SERIAL PRIMARY KEY + id SERIAL PRIMARY KEY, + counter INT NOT NULL ); +``` +`query.sql` +```sql -- name: GetRecord :one SELECT * FROM records WHERE id = $1; -``` -The `WithTx` method allows a `Queries` instance to be associated with a transaction. +-- name: UpdateRecord :exec +UPDATE records SET counter = $2 +WHERE id = $1; +``` +And the generated code from sqlc in `db.go`: ```go -package db +package tutorial import ( "context" "database/sql" ) -type Record struct { - ID int -} - 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 } @@ -36,19 +46,56 @@ type Queries struct { db DBTX } -func (*Queries) WithTx(tx *sql.Tx) *Queries { - return &Queries{db: tx} +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } } -const getRecord = `-- name: GetRecord :one -SELECT id FROM records -WHERE id = $1 -` +``` + +You'd use it like this: -func (q *Queries) GetRecord(ctx context.Context, id int) (Record, error) { - row := q.db.QueryRowContext(ctx, getRecord, id) - var i Record - err := row.Scan(&i.ID) - return i, err +```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 { + return err + } + defer tx.Rollback() + 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() } -``` + +// 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 2aeaf4c8c9..f96306d0f2 100644 --- a/docs/howto/update.md +++ b/docs/howto/update.md @@ -5,12 +5,78 @@ CREATE TABLE authors ( id SERIAL PRIMARY KEY, bio text NOT NULL ); +``` + +## Single parameter + +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 + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +const updateAuthorBios = `-- name: UpdateAuthorBios :exec +UPDATE authors SET bio = $1 +` + +func (q *Queries) UpdateAuthorBios(ctx context.Context, bio string) error { + _, err := q.db.ExecContext(ctx, updateAuthorBios, bio) + return err +} +``` +## Multiple parameters + +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 @@ -20,7 +86,7 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) error + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) } func New(db DBTX) *Queries { @@ -36,8 +102,14 @@ UPDATE authors SET bio = $2 WHERE id = $1 ` -func (q *Queries) UpdateAuthor(ctx context.Context, id int, bio string) error { - _, err := q.db.ExecContext(ctx, updateAuthor, id, bio) +type UpdateAuthorParams struct { + ID int32 + Bio string +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error { + _, err := q.db.ExecContext(ctx, updateAuthor, arg.ID, arg.Bio) return err } ``` + 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 new file mode 100644 index 0000000000..3f6c6a025b --- /dev/null +++ b/docs/howto/vet.md @@ -0,0 +1,286 @@ +# `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. + +## 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. + +```proto +message Config +{ + string version = 1; + string engine = 2 ; + repeated string schema = 3; + repeated string queries = 4; +} + +message Query +{ + // SQL body + string sql = 1; + // Name of the query + string name = 2; + // One of "many", "one", "exec", etc. + string cmd = 3; + // Query parameters, if any + repeated Parameter params = 4; +} + +message Parameter +{ + int32 number = 1; +} +``` + +In addition to this basic information, when you have a PostgreSQL or MySQL +[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. + +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 +of the types of rules you can write. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + rules: + - no-pg + - no-delete + - only-one-param + - no-exec +rules: + - name: no-pg + message: "invalid engine: postgresql" + rule: | + config.engine == "postgresql" + - name: no-delete + message: "don't use delete statements" + rule: | + query.sql.contains("DELETE") + - name: only-one-param + message: "too many parameters" + rule: | + query.params.size() > 1 + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" +``` + +### Rules using `EXPLAIN ...` output + +*Added in v1.20.0* + +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.md#database). + +For the `postgresql` engine, `sqlc` runs + +```sql +EXPLAIN (ANALYZE false, VERBOSE, COSTS, SETTINGS, BUFFERS, FORMAT JSON) ... +``` + +where `"..."` is your query string, and parses the output into a [`PostgreSQLExplain`](https://buf.build/sqlc/sqlc/docs/v1.20.0:vet#vet.PostgreSQLExplain) proto message. + +For the `mysql` engine, `sqlc` runs + +```sql +EXPLAIN FORMAT=JSON ... +``` + +where `"..."` is your query string, and parses the output into a [`MySQLExplain`](https://buf.build/sqlc/sqlc/docs/v1.20.0:vet#vet.MySQLExplain) proto message. + +These proto message definitions are too long to include here, but you can find them in the `protos` +directory within the `sqlc` source tree. + +The output from `EXPLAIN ...` depends on the structure of your query so it's a bit difficult +to offer generic examples. Refer to the +[PostgreSQL documentation](https://www.postgresql.org/docs/current/using-explain.html) and +[MySQL documentation](https://dev.mysql.com/doc/refman/en/explain-output.html) for more +information. + +```yaml +... +rules: +- name: postgresql-query-too-costly + message: "Query cost estimate is too high" + rule: "postgresql.explain.plan.total_cost > 1.0" +- name: postgresql-no-seq-scan + message: "Query plan results in a sequential scan" + rule: "postgresql.explain.plan.node_type == 'Seq Scan'" +- name: mysql-query-too-costly + message: "Query cost estimate is too high" + rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" +- name: mysql-must-use-primary-key + message: "Query plan doesn't use primary key" + rule: "has(mysql.explain.query_block.table.key) && mysql.explain.query_block.table.key != 'PRIMARY'" +``` + +When building rules that depend on `EXPLAIN ...` output, it may be helpful to see the actual JSON +returned from the database. `sqlc` will print it When you set the environment variable +`SQLCDEBUG=dumpexplain=1`. Use this environment variable together with a dummy rule to see +`EXPLAIN ...` output for all of your queries. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + database: + uri: "postgresql://postgres:postgres@localhost:5432/postgres" + gen: + go: + package: "db" + out: "db" + rules: + - debug +rules: +- name: debug + rule: "!has(postgresql.explain)" # A dummy rule to trigger explain +``` + +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.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: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + database: + uri: "postgresql://postgres:password@localhost:5432/postgres" + rules: + - 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). + +## Running lint rules + +When you add the name of a defined rule to the rules list +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. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + rules: + - no-delete +rules: + - name: no-pg + message: "invalid engine: postgresql" + rule: | + config.engine == "postgresql" + - name: no-delete + message: "don't use delete statements" + rule: | + query.sql.contains("DELETE") +``` + +### 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. 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; +``` diff --git a/docs/index.rst b/docs/index.rst index 536696ce42..f914f3ec41 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,7 +32,19 @@ code ever again. :caption: Tutorials :hidden: - tutorials/getting-started.md + tutorials/getting-started-mysql.md + tutorials/getting-started-postgresql.md + tutorials/getting-started-sqlite.md + +.. toctree:: + :maxdepth: 2 + :caption: Commands + :hidden: + + howto/generate.md + howto/push.md + howto/verify.md + howto/vet.md .. toctree:: :maxdepth: 2 @@ -51,15 +63,29 @@ code ever again. howto/ddl.md howto/structs.md + howto/embedding.md + howto/overrides.md + howto/rename.md .. toctree:: - :maxdepth: 2 + :maxdepth: 3 + :caption: sqlc Cloud + :hidden: + + howto/managed-databases.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:: @@ -67,5 +93,8 @@ code ever again. :caption: Conceptual Guides :hidden: + howto/ci-cd.md + guides/using-go-and-pgx.rst + guides/plugins.md guides/development.md guides/privacy.md diff --git a/docs/overview/install.md b/docs/overview/install.md index 05bcc6f5a1..354c65d249 100644 --- a/docs/overview/install.md +++ b/docs/overview/install.md @@ -14,34 +14,38 @@ brew install sqlc sudo snap install sqlc ``` -## go get +## go install + +Installing recent versions of sqlc requires Go 1.21+. ``` -go get github.com/kyleconroy/sqlc/cmd/sqlc +go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest ``` ## Docker ``` -docker pull kjconroy/sqlc +docker pull sqlc/sqlc ``` Run `sqlc` using `docker run`: ``` -docker run --rm -v $(pwd):/src -w /src kjconroy/sqlc generate +docker run --rm -v $(pwd):/src -w /src sqlc/sqlc generate ``` -## Downloads +Run `sqlc` using `docker run` in the Command Prompt on Windows (`cmd`): + +``` +docker run --rm -v "%cd%:/src" -w /src sqlc/sqlc generate +``` -Binaries for a given release can be downloaded from the [stable channel on -Equinox](https://dl.equinox.io/sqlc/sqlc/stable) or the latest [GitHub -release](https://github.com/kyleconroy/sqlc/releases). +## Downloads -## Tip Releases +Get pre-built binaries for *v1.30.0*: -Each commit is deployed to the [`devel` channel on Equinox](https://dl.equinox.io/sqlc/sqlc/devel): +- [Linux](https://downloads.sqlc.dev/sqlc_1.30.0_linux_amd64.tar.gz) +- [macOS](https://downloads.sqlc.dev/sqlc_1.30.0_darwin_amd64.zip) +- [Windows](https://downloads.sqlc.dev/sqlc_1.30.0_windows_amd64.zip) -- [Linux](https://bin.equinox.io/c/gvM95th6ps1/sqlc-devel-linux-amd64.tgz) -- [macOS](https://bin.equinox.io/c/gvM95th6ps1/sqlc-devel-darwin-amd64.zip) -- [Windows](https://bin.equinox.io/c/gvM95th6ps1/sqlc-devel-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 new file mode 100644 index 0000000000..cb8f1b8d63 --- /dev/null +++ b/docs/reference/changelog.md @@ -0,0 +1,2869 @@ +# Changelog +All notable changes to this project will be documented in this file. + +(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#with-other-tools) 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#with-other-tools) 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) +Released 2023-09-26 + +### Release notes + +#### Managed databases for `sqlc vet` + +If you're using [sqlc vet](../howto/vet.md) to write rules that require access to a running +database, `sqlc` can now start and manage that database for you. PostgreSQL +support is available today, with MySQL on the way. + +When you turn on managed databases, `sqlc` will use your schema to create a +template database that it can copy to make future runs of `sqlc vet` very +performant. + +This feature relies on configuration obtained via [sqlc +Cloud](https://dashboard.sqlc.dev). + +Read more in the [managed databases](../howto/managed-databases.md) documentation. + +### Changes + +#### Bug Fixes + +- (codegen/golang) Refactor imports code to match templates (#2709) +- (codegen/golang) Support name type (#2715) +- (wasm) Move Runner struct to shared file (#2725) +- (engine/sqlite) Fix grammer to avoid missing join_constraint (#2732) +- (convert) Support YAML anchors in plugin options (#2733) +- (mysql) Disallow time.Time in mysql :copyfrom queries, not all queries (#2768) +- (engine/sqlite) Fix convert process for VALUES (#2737) + +#### Documentation + +- Clarify nullable override behavior (#2753) +- Add managed databases to sidebar (#2764) +- Pull renaming and type overrides into separate sections (#2774) +- Update the docs banner for managed dbs (#2775) + +#### Features + +- (config) Enables the configuration of copyfrom.go similar to quierer and friends (#2727) +- (vet) Run rules against a managed database (#2751) +- (upload) Point upload command at new endpoint (#2772) +- (compiler) Support DO statements (#2777) + +#### Miscellaneous Tasks + +- (endtoend) Skip tests missing secrets (#2763) +- Skip certain tests on PRs (#2769) + +#### Testing + +- (endtoend) Verify all schemas in endtoend (#2744) +- (examples) Use a hosted database for example testing (#2749) +- (endtoend) Pull region from environment (#2750) + +#### Build + +- (deps) Bump golang from 1.21.0 to 1.21.1 (#2711) +- (deps) Bump google.golang.org/grpc from 1.57.0 to 1.58.1 (#2743) +- (deps) Bump wasmtime-go from v12 to v13 (#2756) +- (windows) Downgrade to mingw 11.2.0 (#2757) +- (deps) Bump urllib3 from 2.0.4 to 2.0.5 in /docs (#2747) +- (deps) Bump google.golang.org/grpc from 1.58.1 to 1.58.2 (#2758) +- (deps) Bump github.com/google/cel-go from 0.18.0 to 0.18.1 (#2778) + +#### Ci + +- Bump go version to latest in ci workflows (#2722) + + +(v1-21-0)= +## [1.21.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.21.0) +Released 2023-09-06 + +### Release notes + +This is primarily a bugfix release, along with some documentation and testing improvements. + +#### MySQL engine improvements + +`sqlc` previously didn't know how to parse a `CALL` statement when using the MySQL engine, +which meant it was impossible to use sqlc with stored procedures in MySQL databases. + +Additionally, `sqlc` now supports `IS [NOT] NULL` in queries. And `LIMIT` and `OFFSET` clauses +now work with `UNION`. + +#### SQLite engine improvements + +GitHub user [@orisano](https://github.com/orisano) continues to bring bugfixes and +improvements to `sqlc`'s SQLite engine. See the "Changes" section below for the +full list. + +#### Plugin access to environment variables + +If you're authoring a [sqlc plugin](../guides/plugins.html), you can now configure +sqlc to pass your plugin the values of specific environment variables. + +For example, if your plugin +needs the `PATH` environment variable, add `PATH` to the `env` list in the +`plugins` collection. + +```yaml +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: test +plugins: +- name: test + env: + - PATH + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm + sha256: 138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790 +``` + +A variable named `SQLC_VERSION` is always included in the plugin's +environment, set to the version of the `sqlc` executable invoking it. + +### Changes + +#### Bug Fixes + +- Myriad string formatting changes (#2558) +- (engine/sqlite) Support quoted identifier (#2556) +- (engine/sqlite) Fix compile error (#2564) +- (engine/sqlite) Fixed detection of column alias without AS (#2560) +- (ci) Bump go version to 1.20.7 (#2568) +- Remove references to deprecated `--experimental` flag (#2567) +- (postgres) Fixed a problem with array dimensions disappearing when using "ALTER TABLE ADD COLUMN" (#2572) +- Remove GitHub sponsor integration (#2574) +- (docs) Improve discussion of prepared statements support (#2604) +- (docs) Remove multidimensional array qualification in datatypes.md (#2619) +- (config) Go struct tag parsing (#2606) +- (compiler) Fix to not scan children under ast.RangeSubselect when retrieving table listing (#2573) +- (engine/sqlite) Support NOT IN (#2587) +- (codegen/golang) Fixed detection of the used package (#2597) +- (engine/dolphin) Fixed problem that LIMIT OFFSET cannot be used with `UNION ALL` (#2613) +- (compiler) Support identifiers with schema (#2579) +- (compiler) Fix column expansion to work with quoted non-keyword identifiers (#2576) +- (codegen/go) Compare define type in codegen (#2263) (#2578) +- (engine/sqlite) Fix ast when using compound operator (#2673) +- (engine/sqlite) Fix to handle join clauses correctly (#2674) +- (codegen) Use correct Go types for bit strings and cid/oid/tid/xid with pgx/v4 (#2668) +- (endtoend) Ensure all SQL works against PostgreSQL (#2684) + +#### Documentation + +- Update Docker installation instructions (#2552) +- Missing emit_pointers_for_null_types configuration option in version 2 (#2682) (#2683) +- Fix typo (#2697) +- Document sqlc.* macros (#2698) +- (mysql) Document parseTimet=true requirement (#2699) +- Add atlas to the list of supported migration frameworks (#2700) +- Minor updates to insert howto (#2701) + +#### Features + +- (endtoend/testdata) Added two sqlite `CAST` tests and rearranged postgres tests for same (#2551) +- (docs) Add a reference to type overriding in datatypes.md (#2557) +- (engine/sqlite) Support COLLATE for sqlite WHERE clause (#2554) +- (mysql) Add parser support for IS [NOT] NULL (#2651) +- (engine/dolphin) Support CALL statement (#2614) +- (codegen) Allow plugins to access environment variables (#2669) +- (config) Add JSON schema files for configs (#2703) + +#### Miscellaneous Tasks + +- Ignore Vim swap files (#2616) +- Fix typo (#2696) + +#### Refactor + +- (astutils) Remove redundant nil check in `Walk` (#2660) + +#### Build + +- (deps) Bump wasmtime from v8.0.0 to v11.0.0 (#2553) +- (deps) Bump golang from 1.20.6 to 1.20.7 (#2563) +- (deps) Bump chardet from 5.1.0 to 5.2.0 in /docs (#2562) +- (deps) Bump github.com/pganalyze/pg_query_go/v4 (#2583) +- (deps) Bump golang from 1.20.7 to 1.21.0 (#2596) +- (deps) Bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#2582) +- (deps) Bump pygments from 2.15.1 to 2.16.1 in /docs (#2584) +- (deps) Bump sphinxcontrib-applehelp from 1.0.4 to 1.0.7 in /docs (#2620) +- (deps) Bump sphinxcontrib-qthelp from 1.0.3 to 1.0.6 in /docs (#2622) +- (deps) Bump github.com/google/cel-go from 0.17.1 to 0.17.6 (#2650) +- (deps) Bump sphinxcontrib-serializinghtml in /docs (#2641) +- Upgrade from Go 1.20 to Go 1.21 (#2665) +- (deps) Bump sphinxcontrib-devhelp from 1.0.2 to 1.0.5 in /docs (#2621) +- (deps) Bump github.com/bytecodealliance/wasmtime-go from v11.0.0 to v12.0.0 (#2666) +- (deps) Bump sphinx-rtd-theme from 1.2.2 to 1.3.0 in /docs (#2670) +- (deps) Bump sphinxcontrib-htmlhelp from 2.0.1 to 2.0.4 in /docs (#2671) +- (deps) Bump github.com/google/cel-go from 0.17.6 to 0.18.0 (#2691) +- (deps) Bump actions/checkout from 3 to 4 (#2694) +- (deps) Bump pytz from 2023.3 to 2023.3.post1 in /docs (#2695) +- (devenv) Bump go from 1.20.7 to 1.21.0 (#2702) + +(v1-20-0)= +## [1.20.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.20.0) +Released 2023-07-31 + +### Release notes + +#### `kyleconroy/sqlc` is now `sqlc-dev/sqlc` + +We've completed our migration to the [sqlc-dev/sqlc](https://github.com/sqlc-dev/sqlc) repository. All existing links and installation instructions will continue to work. If you're using the `go` tool to install `sqlc`, you'll need to use the new import path to get v1.20.0 (and all future versions). + +```sh +# INCORRECT: old import path +go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.20.0 + +# CORRECT: new import path +go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.20.0 +``` + +We designed the upgrade process to be as smooth as possible. If you run into any issues, please [file a bug report](https://github.com/sqlc-dev/sqlc/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml) via GitHub. + +#### Use `EXPLAIN ...` output in lint rules + +`sqlc vet` can now run `EXPLAIN` on your queries and include the results for use in your lint rules. For example, this rule checks that `SELECT` queries use an index. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + database: + uri: "postgresql://postgres:postgres@localhost:5432/postgres" + gen: + go: + package: "db" + out: "db" + rules: + - has-index +rules: +- name: has-index + rule: > + query.sql.startsWith("SELECT") && + !(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.md#database). + +For the `postgresql` engine, `sqlc` runs + +```sql +EXPLAIN (ANALYZE false, VERBOSE, COSTS, SETTINGS, BUFFERS, FORMAT JSON) ... +``` + +where `"..."` is your query string, and parses the output into a [`PostgreSQLExplain`](https://buf.build/sqlc/sqlc/docs/v1.20.0:vet#vet.PostgreSQLExplain) proto message. + +For the `mysql` engine, `sqlc` runs + +```sql +EXPLAIN FORMAT=JSON ... +``` + +where `"..."` is your query string, and parses the output into a [`MySQLExplain`](https://buf.build/sqlc/sqlc/docs/v1.20.0:vet#vet.MySQLExplain) proto message. + +These proto message definitions are too long to include here, but you can find them in the `protos` directory within the `sqlc` source tree. + +The output from `EXPLAIN ...` depends on the structure of your query so it's a bit difficult to offer generic examples. Refer to the [PostgreSQL documentation](https://www.postgresql.org/docs/current/using-explain.html) and [MySQL documentation](https://dev.mysql.com/doc/refman/en/explain-output.html) for more information. + +```yaml +... +rules: +- name: postgresql-query-too-costly + message: "Query cost estimate is too high" + rule: "postgresql.explain.plan.total_cost > 1.0" +- name: postgresql-no-seq-scan + message: "Query plan results in a sequential scan" + rule: "postgresql.explain.plan.node_type == 'Seq Scan'" +- name: mysql-query-too-costly + message: "Query cost estimate is too high" + rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" +- name: mysql-must-use-primary-key + message: "Query plan doesn't use primary key" + rule: "has(mysql.explain.query_block.table.key) && mysql.explain.query_block.table.key != 'PRIMARY'" +``` + +When building rules that depend on `EXPLAIN ...` output, it may be helpful to see the actual JSON returned from the database. `sqlc` will print it When you set the environment variable `SQLCDEBUG=dumpexplain=1`. Use this environment variable together with a dummy rule to see `EXPLAIN ...` output for all of your queries. + +#### 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. + +```sql +/* name: GetAuthor :one */ +/* @sqlc-vet-disable */ +SELECT * FROM authors +WHERE id = ? LIMIT 1; +``` + +#### Bulk insert for MySQL + +_Developed by [@Jille](https://github.com/Jille)_ + +MySQL now supports the `:copyfrom` query annotation. The generated code uses the [LOAD DATA](https://dev.mysql.com/doc/refman/8.0/en/load-data.html) command to insert data quickly and efficiently. + +Use caution with this feature. 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 necessary. + +Check the [error handling](https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling) documentation for more information. + +```sql +CREATE TABLE foo (a text, b integer, c DATETIME, d DATE); + +-- name: InsertValues :copyfrom +INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?); +``` + +```go +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + ... +} +``` + +`LOAD DATA` support must be enabled in the MySQL server. + +#### CAST support for MySQL + +_Developed by [@ryanpbrewster](https://github.com/ryanpbrewster) and [@RadhiFadlillah](https://github.com/RadhiFadlillah)_ + +`sqlc` now understands `CAST` calls in MySQL queries, offering greater flexibility when generating code for complex queries. + +```sql +CREATE TABLE foo (bar BOOLEAN NOT NULL); + +-- name: SelectColumnCast :many +SELECT CAST(bar AS BIGINT) FROM foo; +``` + +```go +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT CAST(bar AS BIGINT) FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int64, error) { + ... +} +``` + +#### SQLite improvements + +A slew of fixes landed for our SQLite implementation, bringing it closer to parity with MySQL and PostgreSQL. We want to thank [@orisano](https://github.com/orisano) for their continued dedication to improving `sqlc`'s SQLite support. + +### Changes + +#### Features + +- (debug) Add debug flag and docs for dumping vet rule variables (#2521) +- (mysql) :copyfrom support via LOAD DATA INFILE (#2545) +- (mysql) Implement cast function parser (#2473) +- (postgresql) Add support for PostgreSQL multi-dimensional arrays (#2338) +- (sql/catalog) Support ALTER TABLE IF EXISTS (#2542) +- (sqlite) Virtual tables and fts5 supported (#2531) +- (vet) Add default query parameters for explain queries (#2543) +- (vet) Add output from `EXPLAIN ...` for queries to the CEL program environment (#2489) +- (vet) Introduce a query annotation to opt out of sqlc vet rules (#2474) +- Parse comment lines starting with `@symbol` as boolean flags associated with a query (#2464) + +#### Bug Fixes + +- (codegen/golang) Fix sqlc.embed to work with pq.Array (#2544) +- (compiler) Correctly validate alias in order/group by clauses for joins (#2537) +- (engine/sqlite) Added function to convert cast node (#2470) +- (engine/sqlite) Fix join_operator rule (#2434) +- (engine/sqlite) Fix table_alias rules (#2465) +- (engine/sqlite) Fixed IN operator precedence (#2428) +- (engine/sqlite) Fixed to be able to find relation from WITH clause (#2444) +- (engine/sqlite) Lowercase ast.ResTarget.Name (#2433) +- (engine/sqlite) Put logging statement behind debug flag (#2488) +- (engine/sqlite) Support for repeated table_option (#2482) +- (mysql) Generate unsigned param (#2522) +- (sql/catalog) Support pg_dump output (#2508) +- (sqlite) Code generation for sqlc.slice (#2431) +- (vet) Clean up unnecessary `prepareable()` func and a var name (#2509) +- (vet) Query.cmd was always set to ":" (#2525) +- (vet) Report an error when a query is unpreparable, close prepared statement connection (#2486) +- (vet) Split vet messages out of codegen.proto (#2511) + +#### Documentation + +- Add a description to the document for cases when a query result has no rows (#2462) +- Update copyright and author (#2490) +- Add example sqlc.yaml for migration parsing (#2479) +- Small updates (#2506) +- Point GitHub links to new repository location (#2534) + +#### Miscellaneous Tasks + +- Rename kyleconroy/sqlc to sqlc-dev/sqlc (#2523) +- (proto) Reformat protos using `buf format -w` (#2536) +- Update FEATURE_REQUEST.yml to include SQLite engine option +- Finish migration to sqlc-dev/sqlc (#2548) +- (compiler) Remove some duplicate code (#2546) + +#### Testing + +- Add profiles to docker compose (#2503) + +#### Build + +- Run all supported versions of MySQL / PostgreSQL (#2463) +- (deps) Bump pygments from 2.7.4 to 2.15.0 in /docs (#2485) +- (deps) Bump github.com/jackc/pgconn from 1.14.0 to 1.14.1 (#2483) +- (deps) Bump github.com/google/cel-go from 0.16.0 to 0.17.1 (#2484) +- (docs) Check Python dependencies via dependabot (#2497) +- (deps) Bump idna from 2.10 to 3.4 in /docs (#2499) +- (deps) Bump packaging from 20.9 to 23.1 in /docs (#2498) +- (deps) Bump pygments from 2.15.0 to 2.15.1 in /docs (#2500) +- (deps) Bump certifi from 2022.12.7 to 2023.7.22 in /docs (#2504) +- (deps) Bump sphinx from 4.4.0 to 6.1.0 in /docs (#2505) +- Add psql and mysqlsh to devenv (#2507) +- (deps) Bump urllib3 from 1.26.5 to 2.0.4 in /docs (#2516) +- (deps) Bump chardet from 4.0.0 to 5.1.0 in /docs (#2517) +- (deps) Bump snowballstemmer from 2.1.0 to 2.2.0 in /docs (#2519) +- (deps) Bump pytz from 2021.1 to 2023.3 in /docs (#2520) +- (deps) Bump sphinxcontrib-htmlhelp from 2.0.0 to 2.0.1 in /docs (#2518) +- (deps) Bump pyparsing from 2.4.7 to 3.1.0 in /docs (#2530) +- (deps) Bump alabaster from 0.7.12 to 0.7.13 in /docs (#2526) +- (docs) Ignore updates for sphinx (#2532) +- (deps) Bump babel from 2.9.1 to 2.12.1 in /docs (#2527) +- (deps) Bump sphinxcontrib-applehelp from 1.0.2 to 1.0.4 in /docs (#2533) +- (deps) Bump google.golang.org/grpc from 1.56.2 to 1.57.0 (#2535) +- (deps) Bump pyparsing from 3.1.0 to 3.1.1 in /docs (#2547) + + +## [1.19.1](https://github.com/sqlc-dev/sqlc/releases/tag/v1.19.1) +Released 2023-07-13 + +### Bug Fixes + +- Fix to traverse Sel in ast.In (#2414) +- (compiler) Validate UNION ... ORDER BY (#2446) +- (golang) Prevent duplicate enum output (#2447) + +### Miscellaneous Tasks + +- Replace codegen, test and docs references to github.com/tabbed repos (#2418) + +### Build + +- (deps) Bump google.golang.org/grpc from 1.56.1 to 1.56.2 (#2415) +- (deps) Bump golang from 1.20.5 to 1.20.6 (#2437) +- Pin Go to 1.20.6 (#2441) +- (deps) Bump github.com/jackc/pgx/v5 from 5.4.1 to 5.4.2 (#2436) + +## [1.19.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.19.0) +Released 2023-07-06 + +### Release notes + +#### sqlc vet + +[`sqlc vet`](../howto/vet.md) runs queries through a set of lint rules. + +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). +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 +rules you can write. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + rules: + - no-pg + - no-delete + - only-one-param + - no-exec +rules: + - name: no-pg + message: "invalid engine: postgresql" + rule: | + config.engine == "postgresql" + - name: no-delete + message: "don't use delete statements" + rule: | + query.sql.contains("DELETE") + - name: only-one-param + message: "too many parameters" + rule: | + query.params.size() > 1 + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" +``` + +##### Database connectivity + +`vet` also marks the first time that `sqlc` can connect to a live, running +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 +`sqlc/db-preapre` rule will attempt to prepare each of your +queries against the connected database and report any failures. + +```yaml +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + database: + uri: "postgresql://postgres:password@localhost:5432/postgres" + 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`. + +#### Omit unused structs + +Added a new configuration parameter `omit_unused_structs` which, when set to +true, filters out table and enum structs that aren't used in queries for a given +package. + +#### Suggested CI/CD setup + +With the addition of `sqlc diff` and `sqlc vet`, we encourage users to run sqlc +in your CI/CD pipelines. See our [suggested CI/CD setup](../howto/ci-cd.md) for +more information. + +#### Simplified plugin development + +The [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) and +[sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugins have been +updated use the upcoming [WASI](https://wasi.dev/) support in [Go +1.21](https://tip.golang.org/doc/go1.21#wasip1). Building these plugins no +longer requires [TinyGo](https://tinygo.org/). + +### Changes + +#### Bug Fixes + +- Pointers overrides skip imports in generated query files (#2240) +- CASE-ELSE clause is not properly parsed when a value is constant (#2238) +- Fix toSnakeCase to handle input in CamelCase format (#2245) +- Add location info to sqlite ast (#2298) +- Add override tags to result struct (#1867) (#1887) +- Override types of aliased columns and named parameters (#1884) +- Resolve duplicate fields generated when inheriting multiple tables (#2089) +- Check column references in ORDER BY (#1411) (#1915) +- MySQL slice shadowing database/sql import (#2332) +- Don't defer rows.Close() if pgx.BatchResults.Query() failed (#2362) +- Fix type overrides not working with sqlc.slice (#2351) +- Type overrides on columns for parameters inside an IN clause (#2352) +- Broken interaction between query_parameter_limit and pq.Array() (#2383) +- (codegen/golang) Bring :execlastid in line with the rest (#2378) + +#### Documentation + +- Update changelog.md with some minor edits (#2235) +- Add F# community plugin (#2295) +- Add a ReadTheDocs config file (#2327) +- Update query_parameter_limit documentation (#2374) +- Add launch announcement banner + +#### Features +- PostgreSQL capture correct line and column numbers for parse error (#2289) +- Add supporting COMMENT ON VIEW (#2249) +- To allow spaces between function name and arguments of functions to be rewritten (#2250) +- Add support for pgx/v5 emit_pointers_for_null_types flag (#2269) +- (mysql) Support unsigned integers (#1746) +- Allow use of table and column aliases for table functions returning unknown types (#2156) +- Support "LIMIT ?" in UPDATE and DELETE for MySQL (#2365) +- (internal/codegen/golang) Omit unused structs from output (#2369) +- Improve default names for BETWEEN ? AND ? to have prefixes from_ and to_ (#2366) +- (cmd/sqlc) Add the vet subcommand (#2344) +- (sqlite) Add support for UPDATE/DELETE with a LIMIT clause (#2384) +- Add support for BETWEEN sqlc.arg(min) AND sqlc.arg(max) (#2373) +- (cmd/vet) Prepare queries against a database (#2387) +- (cmd/vet) Prepare queries for MySQL (#2388) +- (cmd/vet) Prepare SQLite queries (#2389) +- (cmd/vet) Simplify environment variable substiution (#2393) +- (cmd/vet) Add built-in db-prepare rule +- Add compiler support for NOTIFY and LISTEN (PostgreSQL) (#2363) + +#### Miscellaneous Tasks + +- A few small staticcheck fixes (#2361) +- Remove a bunch of dead code (#2360) +- (scripts/regenerate) Should also update stderr.txt (#2379) + +#### Build + +- (deps) Bump requests from 2.25.1 to 2.31.0 in /docs (#2283) +- (deps) Bump golang from 1.20.3 to 1.20.4 (#2256) +- (deps) Bump google.golang.org/grpc from 1.54.0 to 1.55.0 (#2265) +- (deps) Bump github.com/mattn/go-sqlite3 from 1.14.16 to 1.14.17 (#2293) +- (deps) Bump golang.org/x/sync from 0.1.0 to 0.2.0 (#2266) +- (deps) Bump golang from 1.20.4 to 1.20.5 (#2301) +- Configure dependencies via devenv.sh (#2319) +- Configure dependencies via devenv.sh (#2326) +- (deps) Bump golang.org/x/sync from 0.2.0 to 0.3.0 (#2328) +- (deps) Bump google.golang.org/grpc from 1.55.0 to 1.56.0 (#2333) +- (deps) Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 (#2370) +- (deps) Bump actions/checkout from 2 to 3 (#2357) +- Run govulncheck on all builds (#2372) +- (deps) Bump google.golang.org/grpc from 1.56.0 to 1.56.1 (#2358) + +#### Cmd/sqlc + +- Show helpful output on missing subcommand (#2345) + +#### Codegen + +- Use catalog's default schema (#2310) +- (go) Add tests for tables with dashes (#2312) +- (go) Strip invalid characters from table and column names (#2314) +- (go) Support JSON tags for nullable enum structs (#2121) + +#### Internal/config + +- Support golang overrides for slices (#2339) + +#### Kotlin + +- Use latest version of sqlc-gen-kotlin (#2356) + +#### Postgres + +- Column merging for table inheritence (#2315) + +#### Protos + +- Add missing field name (#2354) + +#### Python + +- Use latest version of sqlc-gen-python (#2355) + +#### Remote + +- Use user-id/password auth (#2262) + +#### Sqlite + +- Fixed sqlite column type override (#1986) + + +## [1.18.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.18.0) +Released 2023-04-27 + +### Release notes + +#### Remote code generation + +_Developed by [@andrewmbenton](https://github.com/andrewmbenton)_ + +At its core, sqlc is powered by SQL engines, which include parsers, formatters, +analyzers and more. While our goal is to support each engine on each operating +system, it's not always possible. For example, the PostgreSQL engine does not +work on Windows. + +To bridge that gap, we're announcing remote code generation, currently in +private alpha. To join the private alpha, [sign up for the waitlist](https://docs.google.com/forms/d/e/1FAIpQLScDWrGtTgZWKt3mdlF5R2XCX6tL1pMkB4yuZx5yq684tTNN1Q/viewform?usp=sf_link). + +Remote code generation works like local code generation, except the heavy +lifting is performed in a consistent cloud environment. WASM-based plugins are +supported in the remote environment, but process-based plugins are not. + +To configure remote generation, add a `cloud` block in `sqlc.json`. + +```json +{ + "version": "2", + "cloud": { + "organization": "", + "project": "", + }, + ... +} +``` + +You'll also need to set the `SQLC_AUTH_TOKEN` environment variable. + +```bash +export SQLC_AUTH_TOKEN= +``` + +When the `cloud` configuration block exists, `sqlc generate` will default to remote +code generation. If you'd like to generate code locally without removing the `cloud` +block from your config, pass the `--no-remote` option. + + +```bash +sqlc generate --no-remote +``` + +Remote generation is off by default and requires an opt-in to use. + +#### sqlc.embed + +_Developed by [@nickjackson](https://github.com/nickjackson)_ + +Embedding allows you to reuse existing model structs in more queries, resulting +in less manual serialization work. First, imagine we have the following schema +with students and test scores. + + +```sql +CREATE TABLE students ( + id bigserial PRIMARY KEY, + name text, + age integer +) + +CREATE TABLE test_scores ( + student_id bigint, + score integer, + grade text +) +``` + +We want to select the student record and the highest score they got on a test. +Here's how we'd usually do that: + +```sql +-- name: HighScore :many +WITH high_scores AS ( + SELECT student_id, max(score) as high_score + FROM test_scores + GROUP BY 1 +) +SELECT students.*, high_score::integer +FROM students +JOIN high_scores ON high_scores.student_id = students.id; +``` + +When using Go, sqlc will produce a struct like this: + +``` +type HighScoreRow struct { + ID int64 + Name sql.NullString + Age sql.NullInt32 + HighScore int32 +} +``` + +With embedding, the struct will contain a model for the table instead of a +flattened list of columns. + +```sql +-- name: HighScoreEmbed :many +WITH high_scores AS ( + SELECT student_id, max(score) as high_score + FROM test_scores + GROUP BY 1 +) +SELECT sqlc.embed(students), high_score::integer +FROM students +JOIN high_scores ON high_scores.student_id = students.id; +``` + +``` +type HighScoreRow struct { + Student Student + HighScore int32 +} +``` + +#### sqlc.slice + +_Developed by Paul Cameron and Jille Timmermans_ + +The MySQL Go driver does not support passing slices to the IN operator. The +`sqlc.slice` function generates a dynamic query at runtime with the correct +number of parameters. + +```sql +/* name: SelectStudents :many */ +SELECT * FROM students +WHERE age IN (sqlc.slice("ages")) +``` + +```go +func (q *Queries) SelectStudents(ctx context.Context, ages []int32) ([]Student, error) { +``` + +This feature is only supported in MySQL and cannot be used with prepared +queries. + +#### Batch operation improvements + +When using batches with pgx, the error returned when a batch is closed is +exported by the generated package. This change allows for cleaner error +handling using `errors.Is`. + +```go +errors.Is(err, generated_package.ErrBatchAlreadyClosed) +``` + +Previously, you would have had to check match on the error message itself. + +``` +err.Error() == "batch already closed" +``` + +The generated code for batch operations always lived in `batch.go`. This file +name can now be configured via the `output_batch_file_name` configuration +option. + +#### Configurable query parameter limits for Go + +By default, sqlc will limit Go functions to a single parameter. If a query +includes more than one parameter, the generated method will use an argument +struct instead of positional arguments. This behavior can now be changed via +the `query_parameter_limit` configuration option. If set to `0`, every +genreated method will use a argument struct. + +### Changes + +#### Bug Fixes + +- Prevent variable redeclaration in single param conflict for pgx (#2058) +- Retrieve Larg/Rarg join query after inner join (#2051) +- Rename argument when conflicted to imported package (#2048) +- Pgx closed batch return pointer if need #1959 (#1960) +- Correct singularization of "waves" (#2194) +- Honor Package level renames in v2 yaml config (#2001) +- (mysql) Prevent UPDATE ... JOIN panic #1590 (#2154) +- Mysql delete join panic (#2197) +- Missing import with pointer overrides, solves #2168 #2125 (#2217) + +#### Documentation + +- (config.md) Add `sqlite` as engine option (#2164) +- Add first pass at pgx documentation (#2174) +- Add missed configuration option (#2188) +- `specifies parameter ":one" without containing a RETURNING clause` (#2173) + +#### Features + +- Add `sqlc.embed` to allow model re-use (#1615) +- (Go) Add query_parameter_limit conf to codegen (#1558) +- Add remote execution for codegen (#2214) + +#### Testing + +- Skip tests if required plugins are missing (#2104) +- Add tests for reanme fix in v2 (#2196) +- Regenerate batch output for filename tests +- Remove remote test (#2232) +- Regenerate test output + +#### Bin/sqlc + +- Add SQLCTMPDIR environment variable (#2189) + +#### Build + +- (deps) Bump github.com/antlr/antlr4/runtime/Go/antlr (#2109) +- (deps) Bump github.com/jackc/pgx/v4 from 4.18.0 to 4.18.1 (#2119) +- (deps) Bump golang from 1.20.1 to 1.20.2 (#2135) +- (deps) Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 (#2137) +- (deps) Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 (#2143) +- (deps) Bump golang from 1.20.2 to 1.20.3 (#2192) +- (deps) Bump actions/setup-go from 3 to 4 (#2150) +- (deps) Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 (#2151) +- (deps) Bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (#2193) +- (deps) Bump github.com/lib/pq from 1.10.7 to 1.10.8 (#2211) +- (deps) Bump github.com/lib/pq from 1.10.8 to 1.10.9 (#2229) +- (deps) Bump github.com/go-sql-driver/mysql from 1.7.0 to 1.7.1 (#2228) + +#### Cmd/sqlc + +- Remove --experimental flag (#2170) +- Add option to disable process-based plugins (#2180) +- Bump version to v1.18.0 + +#### Codegen + +- Correctly generate CopyFrom columns for single-column copyfroms (#2185) + +#### Config + +- Add top-level cloud configuration (#2204) + +#### Engine/postgres + +- Upgrade to pg_query_go/v4 (#2114) + +#### Ext/wasm + +- Check exit code on returned error (#2223) + +#### Parser + +- Generate correct types for `SELECT NOT EXISTS` (#1972) + +#### Sqlite + +- Add support for CREATE TABLE ... STRICT (#2175) + +#### Wasm + +- Upgrade to wasmtime v8.0.0 (#2222) + +## [1.17.2](https://github.com/sqlc-dev/sqlc/releases/tag/v1.17.2) +Released 2023-02-22 + +### Bug Fixes + +- Fix build on Windows (#2102) + +## [1.17.1](https://github.com/sqlc-dev/sqlc/releases/tag/v1.17.1) +Released 2023-02-22 + +### Bug Fixes + +- Prefer to use []T over pgype.Array[T] (#2090) +- Revert changes to Dockerfile (#2091) +- Do not throw error when IF NOT EXISTS is used on ADD COLUMN (#2092) + +### MySQL + +- Add `float` support to MySQL (#2097) + +### Build + +- (deps) Bump golang from 1.20.0 to 1.20.1 (#2082) + +## [1.17.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.17.0) +Released 2023-02-13 + +### Bug Fixes + +- Initialize generated code outside function (#1850) +- (engine/mysql) Take into account column's charset to distinguish text/blob, (var)char/(var)binary (#776) (#1895) +- The enum Value method returns correct type (#1996) +- Documentation for Inserting Rows (#2034) +- Add import statements even if only pointer types exist (#2046) +- Search from Rexpr if not found from Lexpr (#2056) + +### Documentation + +- Change ENTRYPOINT to CMD (#1943) +- Update samples for HOW-TO GUIDES (#1953) + +### Features + +- Add the diff command (#1963) + +### Build + +- (deps) Bump github.com/mattn/go-sqlite3 from 1.14.15 to 1.14.16 (#1913) +- (deps) Bump github.com/spf13/cobra from 1.6.0 to 1.6.1 (#1909) +- Fix devcontainer (#1942) +- Run sqlc-pg-gen via GitHub Actions (#1944) +- Move large arrays out of functions (#1947) +- Fix conflicts from pointer configuration (#1950) +- (deps) Bump github.com/go-sql-driver/mysql from 1.6.0 to 1.7.0 (#1988) +- (deps) Bump github.com/jackc/pgtype from 1.12.0 to 1.13.0 (#1978) +- (deps) Bump golang from 1.19.3 to 1.19.4 (#1992) +- (deps) Bump certifi from 2020.12.5 to 2022.12.7 in /docs (#1993) +- (deps) Bump golang from 1.19.4 to 1.19.5 (#2016) +- (deps) Bump golang from 1.19.5 to 1.20.0 (#2045) +- (deps) Bump github.com/jackc/pgtype from 1.13.0 to 1.14.0 (#2062) +- (deps) Bump github.com/jackc/pgx/v4 from 4.17.2 to 4.18.0 (#2063) + +### Cmd + +- Generate packages in parallel (#2026) + +### Cmd/sqlc + +- Bump version to v1.17.0 + +### Codegen + +- Remove built-in Kotlin support (#1935) +- Remove built-in Python support (#1936) + +### Internal/codegen + +- Cache pattern matching compilations (#2028) + +### Mysql + +- Add datatype tests (#1948) +- Fix blob tests (#1949) + +### Plugins + +- Upgrade to wasmtime 3.0.1 (#2009) + +### Sqlite + +- Supported between expr (#1958) (#1967) + +### Tools + +- Regenerate scripts skips dirs that contains diff exec command (#1987) + +### Wasm + +- Upgrade to wasmtime 5.0.0 (#2065) + +## [1.16.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.16.0) +Released 2022-11-09 + + +### Bug Fixes + +- (validate) Sqlc.arg & sqlc.narg are not "missing" (#1814) +- Emit correct comment for nullable enums (#1819) +- 🐛 Correctly switch `coalesce()` result `.NotNull` value (#1664) +- Prevent batch infinite loop with arg length (#1794) +- Support version 2 in error message (#1839) +- Handle empty column list in postgresql (#1843) +- Batch imports filter queries, update cmds having ret type (#1842) +- Named params contribute to batch parameter count (#1841) + +### Documentation + +- Add a getting started guide for SQLite (#1798) +- Various readability improvements (#1854) +- Add documentation for codegen plugins (#1904) +- Update migration guides with links (#1933) + +### Features + +- Add HAVING support to MySQL (#1806) + +### Miscellaneous Tasks + +- Upgrade wasmtime version (#1827) +- Bump wasmtime version to v1.0.0 (#1869) + +### Build + +- (deps) Bump github.com/jackc/pgconn from 1.12.1 to 1.13.0 (#1785) +- (deps) Bump github.com/mattn/go-sqlite3 from 1.14.13 to 1.14.15 (#1799) +- (deps) Bump github.com/jackc/pgx/v4 from 4.16.1 to 4.17.0 (#1786) +- (deps) Bump github.com/jackc/pgx/v4 from 4.17.0 to 4.17.1 (#1825) +- (deps) Bump github.com/bytecodealliance/wasmtime-go (#1826) +- (deps) Bump github.com/jackc/pgx/v4 from 4.17.1 to 4.17.2 (#1831) +- (deps) Bump golang from 1.19.0 to 1.19.1 (#1834) +- (deps) Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 (#1838) +- (deps) Bump github.com/lib/pq from 1.10.6 to 1.10.7 (#1835) +- (deps) Bump github.com/bytecodealliance/wasmtime-go (#1857) +- (deps) Bump github.com/spf13/cobra from 1.5.0 to 1.6.0 (#1893) +- (deps) Bump golang from 1.19.1 to 1.19.3 (#1920) + +### Cmd/sqlc + +- Bump to v1.16.0 + +### Codgen + +- Include serialized codegen options (#1890) + +### Compiler + +- Move Kotlin parameter logic into codegen (#1910) + +### Examples + +- Port Python examples to WASM plugin (#1903) + +### Pg-gen + +- Make sqlc-pg-gen the complete source of truth for pg_catalog.go (#1809) +- Implement information_schema shema (#1815) + +### Python + +- Port all Python tests to sqlc-gen-python (#1907) +- Upgrade to sqlc-gen-python v1.0.0 (#1932) + +## [1.15.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.15.0) +Released 2022-08-07 + +### Bug Fixes + +- (mysql) Typo (#1700) +- (postgresql) Add quotes for CamelCase columns (#1729) +- Cannot parse SQLite upsert statement (#1732) +- (sqlite) Regenerate test output for builtins (#1735) +- (wasm) Version modules by wasmtime version (#1734) +- Missing imports (#1637) +- Missing slice import for querier (#1773) + +### Documentation + +- Add process-based plugin docs (#1669) +- Add links to downloads.sqlc.dev (#1681) +- Update transactions how to example (#1775) + +### Features + +- More SQL Syntax Support for SQLite (#1687) +- (sqlite) Promote SQLite support to beta (#1699) +- Codegen plugins, powered by WASM (#1684) +- Set user-agent for plugin downloads (#1707) +- Null enums types (#1485) +- (sqlite) Support stdlib functions (#1712) +- (sqlite) Add support for returning (#1741) + +### Miscellaneous Tasks + +- Add tests for quoting columns (#1733) +- Remove catalog tests (#1762) + +### Testing + +- Add tests for fixing slice imports (#1736) +- Add test cases for returning (#1737) + +### Build + +- Upgrade to Go 1.19 (#1780) +- Upgrade to go-wasmtime 0.39.0 (#1781) + +### Plugins + +- (wasm) Change default cache location (#1709) +- (wasm) Change the SHA-256 config key (#1710) + +## [1.14.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.14.0) +Released 2022-06-09 + +### Bug Fixes + +- (postgresql) Remove extra newline with db argument (#1417) +- (sqlite) Fix DROP TABLE (#1443) +- (compiler) Fix left join nullability with table aliases (#1491) +- Regenerate testdata for CREATE TABLE AS (#1516) +- (bundler) Only close multipart writer once (#1528) +- (endtoend) Regenerate testdata for exex_lastid +- (pgx) Copyfrom imports (#1626) +- Validate sqlc function arguments (#1633) +- Fixed typo `sql.narg` in doc (#1668) + +### Features + +- (golang) Add Enum.Valid and AllEnumValues (#1613) +- (sqlite) Start expanding support (#1410) +- (pgx) Add support for batch operations (#1437) +- (sqlite) Add support for delete statements (#1447) +- (codegen) Insert comments in interfaces (#1458) +- (sdk) Add the plugin SDK package (#1463) +- Upload projects (#1436) +- Add sqlc version to generated Kotlin code (#1512) +- Add sqlc version to generated Go code (#1513) +- Pass sqlc version in codegen request (#1514) +- (postgresql) Add materialized view support (#1509) +- (python) Graduate Python support to beta (#1520) +- Run sqlc with docker on windows cmd (#1557) +- Add JSON "codegen" output (#1565) +- Add sqlc.narg() for nullable named params (#1536) +- Process-based codegen plugins (#1578) + +### Miscellaneous Tasks + +- Fix extra newline in comments for copyfrom (#1438) +- Generate marshal/unmarshal with vtprotobuf (#1467) + +### Refactor + +- (codegen) Port Kotlin codegen package to use plugin types (#1416) +- (codegen) Port Go to plugin types (#1460) +- (cmd) Simplify codegen selection logic (#1466) +- (sql/catalog) Improve Readability (#1595) +- Add basic fuzzing for config / overrides (#1500) + +## [1.13.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.13.0) +Released 2022-03-31 + +### Bug Fixes + +- (compiler) Fix left join nullability with table aliases (#1491) +- (postgresql) Remove extra newline with db argument (#1417) +- (sqlite) Fix DROP TABLE (#1443) + +### Features + +- (cli) Upload projects (#1436) +- (codegen) Add sqlc version to generated Go code (#1513) +- (codegen) Add sqlc version to generated Kotlin code (#1512) +- (codegen) Insert comments in interfaces (#1458) +- (codegen) Pass sqlc version in codegen request (#1514) +- (pgx) Add support for batch operations (#1437) +- (postgresql) Add materialized view support (#1509) +- (python) Graduate Python support to beta (#1520) +- (sdk) Add the plugin SDK package (#1463) +- (sqlite) Add support for delete statements (#1447) +- (sqlite) Start expanding support (#1410) + +### Miscellaneous Tasks + +- Fix extra newline in comments for copyfrom (#1438) +- Generate marshal/unmarshal with vtprotobuf (#1467) + +### Refactor + +- (codegen) Port Kotlin codegen package to use plugin types (#1416) +- (codegen) Port Go to plugin types (#1460) +- (cmd) Simplify codegen selection logic (#1466) + +### Config + +- Add basic fuzzing for config / overrides (#1500) + +## [1.12.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.12.0) +Released 2022-02-05 + +### Bug + +- ALTER TABLE SET SCHEMA (#1409) + +### Bug Fixes + +- Update ANTLR v4 go.mod entry (#1336) +- Check delete statements for CTEs (#1329) +- Fix validation of GROUP BY on field aliases (#1348) +- Fix imports when non-copyfrom queries needed imports that copyfrom queries didn't (#1386) +- Remove extra comment newline (#1395) +- Enable strict function checking (#1405) + +### Documentation + +- Bump version to 1.11.0 (#1308) + +### Features + +- Inheritance (#1339) +- Generate query code using ASTs instead of templates (#1338) +- Add support for CREATE TABLE a ( LIKE b ) (#1355) +- Add support for sql.NullInt16 (#1376) + +### Miscellaneous Tasks + +- Add tests for :exec{result,rows} (#1344) +- Delete template-based codegen (#1345) + +### Build + +- Bump github.com/jackc/pgx/v4 from 4.14.0 to 4.14.1 (#1316) +- Bump golang from 1.17.3 to 1.17.4 (#1331) +- Bump golang from 1.17.4 to 1.17.5 (#1337) +- Bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (#1343) +- Remove devel Docker build +- Bump golang from 1.17.5 to 1.17.6 (#1369) +- Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 (#1382) +- Format all Go code (#1387) + +## [1.11.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.11.0) +Released 2021-11-24 + + +### Bug Fixes + +- Update incorrect signatures (#1180) +- Correct aggregate func sig (#1182) +- Jsonb_build_object (#1211) +- Case-insensitive identifiers (#1216) +- Incorrect handling of meta (#1228) +- Detect invalid INSERT expression (#1231) +- Respect alias name for coalesce (#1232) +- Mark nullable when casting NULL (#1233) +- Support nullable fields in joins for MySQL engine (#1249) +- Fix between expression handling of table references (#1268) +- Support nullable fields in joins on same table (#1270) +- Fix missing binds in ORDER BY (#1273) +- Set RV for TargetList items on updates (#1252) +- Fix MySQL parser for query without trailing semicolon (#1282) +- Validate table alias references (#1283) +- Add support for MySQL ON DUPLICATE KEY UPDATE (#1286) +- Support references to columns in joined tables in UPDATE statements (#1289) +- Add validation for GROUP BY clause column references (#1285) +- Prevent variable redeclaration in single param conflict (#1298) +- Use common params struct field for same named params (#1296) + +### Documentation + +- Replace deprecated go get with go install (#1181) +- Fix package name referenced in tutorial (#1202) +- Add environment variables (#1264) +- Add go.17+ install instructions (#1280) +- Warn about golang-migrate file order (#1302) + +### Features + +- Instrument compiler via runtime/trace (#1258) +- Add MySQL support for BETWEEN arguments (#1265) + +### Refactor + +- Move from io/ioutil to io and os package (#1164) + +### Styling + +- Apply gofmt to sample code (#1261) + +### Build + +- Bump golang from 1.17.0 to 1.17.1 (#1173) +- Bump eskatos/gradle-command-action from 1 to 2 (#1220) +- Bump golang from 1.17.1 to 1.17.2 (#1227) +- Bump github.com/pganalyze/pg_query_go/v2 (#1234) +- Bump actions/checkout from 2.3.4 to 2.3.5 (#1238) +- Bump babel from 2.9.0 to 2.9.1 in /docs (#1245) +- Bump golang from 1.17.2 to 1.17.3 (#1272) +- Bump actions/checkout from 2.3.5 to 2.4.0 (#1267) +- Bump github.com/lib/pq from 1.10.3 to 1.10.4 (#1278) +- Bump github.com/jackc/pgx/v4 from 4.13.0 to 4.14.0 (#1303) + +### Cmd/sqlc + +- Bump version to v1.11.0 + +## [1.10.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.10.0) +Released 2021-09-07 + + +### Documentation + +- Fix invalid language support table (#1161) +- Add a getting started guide for MySQL (#1163) + +### Build + +- Bump golang from 1.16.7 to 1.17.0 (#1129) +- Bump github.com/lib/pq from 1.10.2 to 1.10.3 (#1160) + +### Ci + +- Upgrade Go to 1.17 (#1130) + +### Cmd/sqlc + +- Bump version to v1.10.0 (#1165) + +### Codegen/golang + +- Consolidate import logic (#1139) +- Add pgx support for range types (#1146) +- Use pgtype for hstore when using pgx (#1156) + +### Codgen/golang + +- Use p[gq]type for network address types (#1142) + +### Endtoend + +- Run `go test` in CI (#1134) + +### Engine/mysql + +- Add support for LIKE (#1162) + +### Golang + +- Output NullUUID when necessary (#1137) + +## [1.9.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.9.0) +Released 2021-08-13 + + +### Documentation + +- Update documentation (a bit) for v1.9.0 (#1117) + +### Build + +- Bump golang from 1.16.6 to 1.16.7 (#1107) + +### Cmd/sqlc + +- Bump version to v1.9.0 (#1121) + +### Compiler + +- Add tests for COALESCE behavior (#1112) +- Handle subqueries in SELECT statements (#1113) + +## [1.8.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.8.0) +Released 2021-05-03 + + +### Documentation + +- Add language support Matrix (#920) + +### Features + +- Add case style config option (#905) + +### Python + +- Eliminate runtime package and use sqlalchemy (#939) + +### Build + +- Bump github.com/google/go-cmp from 0.5.4 to 0.5.5 (#926) +- Bump github.com/lib/pq from 1.9.0 to 1.10.0 (#931) +- Bump golang from 1.16.0 to 1.16.1 (#935) +- Bump golang from 1.16.1 to 1.16.2 (#942) +- Bump github.com/jackc/pgx/v4 from 4.10.1 to 4.11.0 (#956) +- Bump github.com/go-sql-driver/mysql from 1.5.0 to 1.6.0 (#961) +- Bump github.com/pganalyze/pg_query_go/v2 (#965) +- Bump urllib3 from 1.26.3 to 1.26.4 in /docs (#968) +- Bump golang from 1.16.2 to 1.16.3 (#963) +- Bump github.com/lib/pq from 1.10.0 to 1.10.1 (#980) + +### Cmd + +- Add the --experimental flag (#929) +- Fix sqlc init (#959) + +### Cmd/sqlc + +- Bump version to v1.7.1-devel (#913) +- Bump version to v1.8.0 + +### Codegen + +- Generate valid enum names for symbols (#972) + +### Postgresql + +- Support generated columns +- Add test for PRIMARY KEY INCLUDE +- Add tests for CREATE TABLE PARTITION OF +- CREATE TRIGGER EXECUTE FUNCTION +- Add support for renaming types (#971) + +### Sql/ast + +- Resolve return values from functions (#964) + +### Workflows + +- Only run tests once (#924) + +## [1.7.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.7.0) +Released 2021-02-28 + + +### Bug Fixes + +- Struct tag formatting (#833) + +### Documentation + +- Include all the existing Markdown files (#877) +- Split docs into four sections (#882) +- Reorganize and consolidate documentation +- Add link to Windows download (#888) +- Shorten the README (#889) + +### Features + +- Adding support for pgx/v4 +- Adding support for pgx/v4 + +### README + +- Add Go Report Card badge (#891) + +### Build + +- Bump github.com/google/go-cmp from 0.5.3 to 0.5.4 (#813) +- Bump github.com/lib/pq from 1.8.0 to 1.9.0 (#820) +- Bump golang from 1.15.5 to 1.15.6 (#822) +- Bump github.com/jackc/pgx/v4 from 4.9.2 to 4.10.0 (#823) +- Bump github.com/jackc/pgx/v4 from 4.10.0 to 4.10.1 (#839) +- Bump golang from 1.15.6 to 1.15.7 (#855) +- Bump golang from 1.15.7 to 1.15.8 (#881) +- Bump github.com/spf13/cobra from 1.1.1 to 1.1.2 (#892) +- Bump golang from 1.15.8 to 1.16.0 (#897) +- Bump github.com/lfittl/pg_query_go from 1.0.1 to 1.0.2 (#901) +- Bump github.com/spf13/cobra from 1.1.2 to 1.1.3 (#893) + +### Catalog + +- Improve alter column type (#818) + +### Ci + +- Uprade to Go 1.15 (#887) + +### Cmd + +- Allow config file location to be specified (#863) + +### Cmd/sqlc + +- Bump to version v1.6.1-devel (#807) +- Bump version to v1.7.0 (#912) + +### Codegen/golang + +- Make sure to import net package (#858) + +### Compiler + +- Support UNION query + +### Dolphin + +- Generate bools for tinyint(1) +- Support joins in update statements (#883) +- Add support for union query + +### Endtoend + +- Add tests for INTERSECT and EXCEPT + +### Go.mod + +- Update to go 1.15 and run 'go mod tidy' (#808) + +### Mysql + +- Compile tinyint(1) to bool (#873) + +### Sql/ast + +- Add enum values for SetOperation + +## [1.6.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.6.0) +Released 2020-11-23 + + +### Dolphin + +- Implement Rename (#651) +- Skip processing view drops (#653) + +### README + +- Update language / database support (#698) + +### Astutils + +- Fix Params rewrite call (#674) + +### Build + +- Bump golang from 1.14 to 1.15.3 (#765) +- Bump docker/build-push-action from v1 to v2.1.0 (#764) +- Bump github.com/google/go-cmp from 0.4.0 to 0.5.2 (#766) +- Bump github.com/spf13/cobra from 1.0.0 to 1.1.1 (#767) +- Bump github.com/jackc/pgx/v4 from 4.6.0 to 4.9.2 (#768) +- Bump github.com/lfittl/pg_query_go from 1.0.0 to 1.0.1 (#773) +- Bump github.com/google/go-cmp from 0.5.2 to 0.5.3 (#783) +- Bump golang from 1.15.3 to 1.15.5 (#782) +- Bump github.com/lib/pq from 1.4.0 to 1.8.0 (#769) + +### Catalog + +- Improve variadic argument support (#804) + +### Cmd/sqlc + +- Bump to version v1.6.0 (#806) + +### Codegen + +- Fix errant database/sql imports (#789) + +### Compiler + +- Use engine-specific reserved keywords (#677) + +### Dolphi + +- Add list of builtin functions (#795) + +### Dolphin + +- Update to the latest MySQL parser (#665) +- Add ENUM() support (#676) +- Add test for table aliasing (#684) +- Add MySQL ddl_create_table test (#685) +- Implete TRUNCATE table (#697) +- Represent tinyint as int32 (#797) +- Add support for coalesce (#802) +- Add function signatures (#796) + +### Endtoend + +- Add MySQL json test (#692) +- Add MySQL update set multiple test (#696) + +### Examples + +- Use generated enum constants in db_test (#678) +- Port ondeck to MySQL (#680) +- Add MySQL authors example (#682) + +### Internal/cmd + +- Print correct config file on parse failure (#749) + +### Kotlin + +- Remove runtime dependency (#774) + +### Metadata + +- Support multiple comment prefixes (#683) + +### Postgresql + +- Support string concat operator (#701) + +### Sql/catalog + +- Add support for variadic functions (#798) + +## [1.5.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.5.0) +Released 2020-08-05 + + +### Documentation + +- Build sqlc using Go 1.14 (#549) + +### Cmd + +- Add debugging support (#573) + +### Cmd/sqlc + +- Bump version to v1.4.1-devel (#548) +- Bump version to v1.5.0 + +### Compiler + +- Support calling functions with defaults (#635) +- Skip func args without a paramRef (#636) +- Return a single column from coalesce (#639) + +### Config + +- Add emit_empty_slices to version one (#552) + +### Contrib + +- Add generated code for contrib + +### Dinosql + +- Remove deprecated package (#554) + +### Dolphin + +- Add support for column aliasing (#566) +- Implement star expansion for subqueries (#619) +- Implement exapansion with reserved words (#620) +- Implement parameter refs (#621) +- Implement limit and offest (#622) +- Implement inserts (#623) +- Implement delete (#624) +- Implement simple update statements (#625) +- Implement INSERT ... SELECT (#626) +- Use test driver instead of TiDB driver (#629) +- Implement named parameters via sqlc.arg() (#632) + +### Endtoend + +- Add MySQL test for SELECT * JOIN (#565) +- Add MySQL test for inflection (#567) + +### Engine + +- Create engine package (#556) + +### Equinox + +- Use the new equinox-io/setup action (#586) + +### Examples + +- Run tests for MySQL booktest (#627) + +### Golang + +- Add support for the money type (#561) +- Generate correct types for int2 and int8 (#579) + +### Internal + +- Rm catalog, pg, postgres packages (#555) + +### Mod + +- Downgrade TiDB package to fix build (#603) + +### Mysql + +- Upgrade to the latest vitess commit (#562) +- Support to infer type of a duplicated arg (#615) +- Allow some builtin functions to be nullable (#616) + +### Postgresql + +- Generate all functions in pg_catalog (#550) +- Remove pg_catalog schema from tests (#638) +- Move contrib code to a package + +### Sql/catalog + +- Fix comparison of pg_catalog types (#637) + +### Tools + +- Generate functions for all of contrib + +### Workflow + +- Migrate to equinox-io/setup-release-tool (#614) + +## [1.4.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.4.0) +Released 2020-06-17 + + +### Dockerfile + +- Add version build argument (#487) + +### MySQL + +- Prevent Panic when WHERE clause contains parenthesis. (#531) + +### README + +- Document emit_exact_table_names (#486) + +### All + +- Remove the exp build tag (#507) + +### Catalog + +- Support functions with table parameters (#541) + +### Cmd + +- Bump to version 1.3.1-devel (#485) + +### Cmd/sqlc + +- Bump version to v1.4.0 (#547) + +### Codegen + +- Add the new codegen packages (#513) +- Add the :execresult query annotation (#542) + +### Compiler + +- Validate function calls (#505) +- Port bottom of parseQuery (#510) +- Don't mutate table name (#517) +- Enable experimental parser by default (#518) +- Apply rename rules to enum constants (#523) +- Temp fix for typecast function parameters (#530) + +### Endtoend + +- Standardize JSON formatting (#490) +- Add per-test configuration files (#521) +- Read expected stderr failures from disk (#527) + +### Internal/dinosql + +- Check parameter style before ref (#488) +- Remove unneeded column suffix (#492) +- Support named function arguments (#494) + +### Internal/postgresql + +- Fix NamedArgExpr rewrite (#491) + +### Multierr + +- Move dinosql.ParserErr to a new package (#496) + +### Named + +- Port parameter style validation to SQL (#504) + +### Parser + +- Support columns from subselect statements (#489) + +### Rewrite + +- Move parameter rewrite to package (#499) + +### Sqlite + +- Use convert functions instead of the listener (#519) + +### Sqlpath + +- Move ReadSQLFiles into a separate package (#495) + +### Validation + +- Move query validation to separate package (#498) + +## [1.3.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.3.0) +Released 2020-05-12 + + +### Makefile + +- Update target (#449) + +### README + +- Add Myles as a sponsor (#469) + +### Testing + +- Make sure all Go examples build (#480) + +### Cmd + +- Bump version to v1.3.0 (#484) + +### Cmd/sqlc + +- Bump version to v1.2.1-devel (#442) + +### Dinosql + +- Inline addFile (#446) +- Add PostgreSQL support for TRUNCATE (#448) + +### Gen + +- Emit json.RawMessage for JSON columns (#461) + +### Go.mod + +- Use latest lib/pq (#471) + +### Parser + +- Use same function to load SQL files (#483) + +### Postgresql + +- Fix panic walking CreateTableAsStmt (#475) + +## [1.2.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.2.0) +Released 2020-04-07 + + +### Documentation + +- Publish to Docker Hub (#422) + +### README + +- Docker installation docs (#424) + +### Cmd/sqlc + +- Bump version to v1.1.1-devel (#407) +- Bump version to v1.2.0 (#441) + +### Gen + +- Add special case for "campus" (#435) +- Properly quote reserved keywords on expansion (#436) + +### Migrations + +- Move migration parsing to new package (#427) + +### Parser + +- Generate correct types for SELECT EXISTS (#411) + +## [1.1.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.1.0) +Released 2020-03-17 + + +### README + +- Add installation instructions (#350) +- Add section on running tests (#357) +- Fix typo (#371) + +### Ast + +- Add AST for ALTER TABLE ADD / DROP COLUMN (#376) +- Add support for CREATE TYPE as ENUM (#388) +- Add support for CREATE / DROP SCHEMA (#389) + +### Astutils + +- Apply changes to the ValuesList slice (#372) + +### Cmd + +- Return v1.0.0 (#348) +- Return next bug fix version (#349) + +### Cmd/sqlc + +- Bump version to v1.1.0 (#406) + +### Compiler + +- Wire up the experimental parsers + +### Config + +- Remove "emit_single_file" option (#367) + +### Dolphin + +- Add experimental parser for MySQL + +### Gen + +- Add option to emit single file for Go (#366) +- Add support for the ltree extension (#385) + +### Go.mod + +- Add packages for MySQL and SQLite parsers + +### Internal/dinosql + +- Support Postgres macaddr type in Go (#358) + +### Internal/endtoend + +- Remove %w (#354) + +### Kotlin + +- Add Query class to support timeout and cancellation (#368) + +### Postgresql + +- Add experimental parser for MySQL + +### Sql + +- Add generic SQL AST + +### Sql/ast + +- Port support for COMMENT ON (#391) +- Implement DROP TYPE (#397) +- Implement ALTER TABLE RENAME (#398) +- Implement ALTER TABLE RENAME column (#399) +- Implement ALTER TABLE SET SCHEMA (#400) + +### Sql/catalog + +- Port tests over from catalog pkg (#402) + +### Sql/errors + +- Add a new errors package (#390) + +### Sqlite + +- Add experimental parser for SQLite + +## [1.0.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.0.0) +Released 2020-02-18 + + +### Documentation + +- Add documentation for query commands (#270) +- Add named parameter documentation (#332) + +### README + +- Add sponsors section (#333) + +### Cmd + +- Remove parse subcommand (#322) + +### Config + +- Parse V2 config format +- Add support for YAML (#336) + +### Examples + +- Add the jets and booktest examples (#237) +- Move sqlc.json into examples folder (#238) +- Add the authors example (#241) +- Add build tag to authors tests (#319) + +### Internal + +- Allow CTE to be used with UPDATE (#268) +- Remove the PackageMap from settings (#295) + +### Internal/config + +- Create new config package (#313) + +### Internal/dinosql + +- Emit Querier interface (#240) +- Strip leading "go-" or trailing "-go" from import (#262) +- Overrides can now be basic types (#271) +- Import needed types for Querier (#285) +- Handle schema-scoped enums (#310) +- Ignore golang-migrate rollbacks (#320) + +### Internal/endtoend + +- Move more tests to the record/replay framework +- Add update test for named params (#329) + +### Internal/mysql + +- Fix flaky test (#242) +- Port tests to endtoend package (#315) + +### Internal/parser + +- Resolve nested CTEs (#324) +- Error if last query is missing (#325) +- Support joins with aliases (#326) +- Remove print statement (#327) + +### Internal/sqlc + +- Add support for composite types (#311) + +### Kotlin + +- Support primitives +- Arrays, enums, and dates +- Generate examples +- README for examples +- Factor out db setup extension +- Fix enums, use List instead of Array +- Port Go tests for examples +- Rewrite numbered params to positional params +- Always use use, fix indents +- Unbox query params + +### Parser + +- Attach range vars to insert params +- Attach range vars to insert params (#342) +- Remove dead code (#343) + +## [0.1.0](https://github.com/sqlc-dev/sqlc/releases/tag/v0.1.0) +Released 2020-01-07 + + +### Documentation + +- Replace remaining references to DinoSQL with sqlc (#149) + +### README + +- Fix download links (#66) +- Add LIMIT 1 to query that should return one (#99) + +### Catalog + +- Support "ALTER TABLE ... DROP CONSTRAINT ..." (#34) +- Differentiate functions with different argument types (#51) + +### Ci + +- Enable tests on pull requests + +### Cmd + +- Include filenames in error messages (#69) +- Do not output any changes on error (#72) + +### Dinosql/internal + +- Add lower and upper functions (#215) +- Ignore alter sequence commands (#219) + +### Gen + +- Add DO NOT EDIT comments to generated code (#50) +- Include all schemas when generating models (#90) +- Prefix structs with schema name (#91) +- Generate single import for uuid package (#98) +- Use same import logic for all Go files +- Pick correct struct to return for queries (#107) +- Create consistent JSON tags (#110) +- Add Close method to Queries struct (#127) +- Ignore empty override settings (#128) +- Turn SQL comments into Go comments (#136) + +### Internal/catalog + +- Parse unnamed function arguments (#166) + +### Internal/dinosql + +- Prepare() with no GoQueries still valid (#95) +- Fix multiline comment rendering (#142) +- Dereference alias nodes on walk (#158) +- Ignore sql-migrate rollbacks (#160) +- Sort imported packages (#165) +- Add support for timestamptz (#169) +- Error on missing queries (#180) +- Use more database/sql null types (#182) +- Support the pg_temp schema (#183) +- Override columns with array type (#184) +- Implement robust expansion +- Implement robust expansion (#186) +- Add COMMENT ON support (#191) +- Add DATE support +- Add DATE support (#196) +- Filter out invalid characters (#198) +- Quote reserved keywords (#205) +- Return parser errors first (#207) +- Implement advisory locks (#212) +- Error on duplicate query names (#221) +- Fix incorrect enum names (#223) +- Add support for numeric types +- Add support for numeric types (#228) + +### Internal/dinosql/testdata/ondeck + +- Add Makefile (#156) + +### Ondeck + +- Move all tests to GitHub CI (#58) + +### ParseQuery + +- Return either a query or an error (#178) + +### Parser + +- Use schema when resolving catalog refs (#82) +- Support function calls in expressions (#104) +- Correctly handle single files (#119) +- Return error if missing RETURNING (#131) +- Add support for mathmatical operators (#132) +- Add support for simple case expressions (#134) +- Error on mismatched INSERT input (#135) +- Set IsArray on joined columns (#139) + +### Pg + +- Store functions in the catalog (#41) +- Add location to errors (#73) + + diff --git a/docs/reference/cli.md b/docs/reference/cli.md index ec55f3b9e1..fc244da3ae 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -1,18 +1,27 @@ # CLI -``` +```sh Usage: sqlc [command] Available Commands: compile Statically check SQL for syntax and type errors - generate Generate Go code from SQL + 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 source code from SQL help Help about any command init Create an empty sqlc.yaml settings file + 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 Flags: - -h, --help help for sqlc + -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. ``` diff --git a/docs/reference/config.md b/docs/reference/config.md index cbd6ab907b..ff8bcd0890 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -1,36 +1,142 @@ -# Configuration file (version 1) +# Configuration -The `sqlc` tool is configured via a `sqlc.yaml` or `sqlc.json` file. This file must be -in the directory where the `sqlc` command is run. +The `sqlc` tool is configured via a `sqlc.(yaml|yml)` or `sqlc.json` file. This +file must be in the directory where the `sqlc` command is run. + +## Version 2 ```yaml -version: "1" -packages: - - name: "db" - path: "internal/db" - queries: "./sql/query/" - schema: "./sql/schema/" - engine: "postgresql" - emit_json_tags: true - emit_prepared_queries: true - emit_interface: false - emit_exact_table_names: false - emit_empty_slices: false +version: "2" +cloud: + project: "" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "postgresql" + database: + managed: true + rules: + - sqlc/db-prepare +- schema: "mysql/schema.sql" + queries: "mysql/query.sql" + engine: "mysql" + gen: + go: + package: "authors" + out: "mysql" ``` -Each package document has the following keys: +### sql + +Each mapping in the `sql` collection has the following keys: + - `name`: - - The package name to use for the generated code. Defaults to `path` basename -- `path`: - - Output directory for generated code -- `queries`: - - Directory of SQL queries or path to single SQL file; or a list of paths -- `schema`: - - Directory of SQL migrations or path to single SQL file; or a list of paths + - An human-friendly identifier for this query set. Optional. - `engine`: - - Either `postgresql` or `mysql`. Defaults to `postgresql`. MySQL support is experimental -- `emit_json_tags`: - - If true, add JSON tags to generated structs. Defaults to `false`. + - One of `postgresql`, `mysql` or `sqlite`. +- `schema`: + - Directory of SQL migrations or path to single SQL file; or a list of paths. +- `queries`: + - Directory of SQL queries or path to single SQL file; or a list of paths. +- `codegen`: + - A collection of mappings to configure code generators. See [codegen](#codegen) for the supported keys. +- `gen`: + - A mapping to configure built-in code generators. See [gen](#gen) for the supported keys. +- `database`: + - 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 + +The `codegen` mapping supports the following keys: + +- `out`: + - Output directory for generated code. +- `plugin`: + - The name of the plugin. Must be defined in the `plugins` collection. +- `options`: + - A mapping of plugin-specific options. + +```yaml +version: '2' +plugins: +- name: py + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-python/releases/download/v0.16.0-alpha/sqlc-gen-python.wasm + sha256: 428476c7408fd4c032da4ec74e8a7344f4fa75e0f98a5a3302f238283b9b95f2 +sql: +- schema: "schema.sql" + queries: "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 +``` + +### database + +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 + +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: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + uri: postgresql://postgres:${PG_PASSWORD}@localhost:5432/authors + gen: + go: + 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: + +#### go + +- `package`: + - The package name to use for the generated code. Defaults to `out` basename. +- `out`: + - 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`: @@ -41,62 +147,333 @@ Each package document has the following keys: - If true, struct names will mirror table names. Otherwise, sqlc attempts to singularize plural table names. Defaults to `false`. - `emit_empty_slices`: - If true, slices returned by `:many` queries will be empty instead of `nil`. Defaults to `false`. +- `emit_exported_queries`: + - If true, autogenerated SQL statement can be exported to be accessed by another package. +- `emit_json_tags`: + - If true, add JSON tags to generated structs. Defaults to `false`. +- `emit_result_struct_pointers`: + - If true, query results are returned as pointers to structs. Queries returning multiple results are returned as slices of pointers. Defaults to `false`. +- `emit_params_struct_pointers`: + - If true, parameters are passed as pointers to structs. Defaults to `false`. +- `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, 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`. +- `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`: + - `camel` for camelCase, `pascal` for PascalCase, `snake` for snake_case or `none` to use the column name in the DB. Defaults to `none`. +- `omit_unused_structs`: + - If `true`, sqlc won't generate table and enum structs that aren't used in queries for a given package. Defaults to `false`. +- `output_batch_file_name`: + - Customize the name of the batch file. Defaults to `batch.go`. +- `output_db_file_name`: + - Customize the name of the db file. Defaults to `db.go`. +- `output_models_file_name`: + - Customize the name of the models file. Defaults to `models.go`. +- `output_querier_file_name`: + - Customize the name of the querier file. Defaults to `querier.go`. +- `output_copyfrom_file_name`: + - Customize the name of the copyfrom file. Defaults to `copyfrom.go`. +- `output_files_suffix`: + - If specified the suffix will be added to the name of the generated files. +- `query_parameter_limit`: + - The number of positional arguments that will be generated for Go functions. To always emit a parameter struct, set this to `0`. Defaults to `1`. +- `rename`: + - Customize the name of generated struct fields. See [Renaming fields](../howto/rename.md) for usage information. +- `overrides`: + - A collection of configurations to override sqlc's default Go type choices. See [Overriding types](../howto/overrides.md) for usage information. + +##### overrides + +See [Overriding types](../howto/overrides.md) for an in-depth guide to using type overrides. -## Type Overrides +#### kotlin -The default mapping of PostgreSQL types to Go types only uses packages outside -the standard library when it must. +> 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. + +- `package`: + - The package name to use for the generated code. +- `out`: + - Output directory for generated code. +- `emit_exact_table_names`: + - If true, use the exact table name for generated models. Otherwise, guess a singular form. Defaults to `false`. + +#### 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. + +- `package`: + - The package name to use for the generated code. +- `out`: + - Output directory for generated code. +- `emit_exact_table_names`: + - If true, use the exact table name for generated models. Otherwise, guess a singular form. Defaults to `false`. +- `emit_sync_querier`: + - If true, generate a class with synchronous methods. Defaults to `false`. +- `emit_async_querier`: + - If true, generate a class with asynchronous methods. Defaults to `false`. +- `emit_pydantic_models`: + - If true, generate classes that inherit from `pydantic.BaseModel`. Otherwise, define classes using the `dataclass` decorator. Defaults to `false`. -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. +#### json +- `out`: + - Output directory for the generated JSON. +- `filename`: + - Filename for the generated JSON document. Defaults to `codegen_request.json`. +- `indent`: + - Indent string to use in the JSON document. Defaults to ` `. + +### plugins + +Each mapping in the `plugins` collection has the following keys: + +- `name`: + - The name of this plugin. Required +- `env` + - A list of environment variables to pass to the plugin. By default, no environment variables are passed. +- `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. + - `sha256` + - The SHA256 checksum for the downloaded file. + ```yaml -version: "1" -packages: [...] -overrides: - - go_type: "github.com/gofrs/uuid.UUID" - db_type: "uuid" +version: "2" +plugins: +- name: "py" + wasm: + url: "https://github.com/sqlc-dev/sqlc-gen-python/releases/download/v0.16.0-alpha/sqlc-gen-python.wasm" + sha256: "428476c7408fd4c032da4ec74e8a7344f4fa75e0f98a5a3302f238283b9b95f2" +- name: "js" + env: + - PATH + process: + cmd: "sqlc-gen-json" ``` -Each override document has the following keys: -- `db_type`: - - The PostgreSQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/kyleconroy/sqlc/blob/master/internal/codegen/golang/postgresql_type.go#L12). -- `go_type`: - - A fully qualified name to a Go type to use in the generated code. -- `nullable`: - - If true, use this type when a column is nullable. Defaults to `false`. +### rules -## Per-Column Type Overrides +Each mapping in the `rules` collection has the following keys: -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. +- `name`: + - The name of this rule. Required +- `rule`: + - A [Common Expression Language (CEL)](https://github.com/google/cel-spec) expression. Required. +- `message`: + - An optional message shown when this rule evaluates to `true`. + +See the [vet](../howto/vet.md) documentation for a list of built-in rules and +help writing custom rules. + +```yaml +version: "2" +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + rules: + - no-pg + - no-delete + - only-one-param + - no-exec +rules: + - name: no-pg + message: "invalid engine: postgresql" + rule: | + config.engine == "postgresql" + - name: no-delete + message: "don't use delete statements" + rule: | + query.sql.contains("DELETE") + - name: only-one-param + message: "too many parameters" + rule: | + query.params.size() > 1 + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" +``` + +### Global overrides -This may be configured by specifying the `column` property in the override definition. `column` -should be of the form `table.column` buy you may be even more specify by specifying `schema.table.column` -or `catalog.schema.table.column`. +Sometimes, the same configuration must be done across various specifications of +code generation. Then a global definition for type overriding and field +renaming can be done using the `overrides` mapping the following manner: ```yaml -version: "1" -packages: [...] +version: "2" overrides: - - column: "authors.id" - go_type: "github.com/segmentio/ksuid.KSUID" + go: + rename: + id: "Identifier" + overrides: + - db_type: "pg_catalog.timestamptz" + nullable: true + engine: "postgresql" + go_type: + import: "gopkg.in/guregu/null.v4" + package: "null" + type: "Time" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "postgresql" +- schema: "mysql/schema.sql" + queries: "mysql/query.sql" + engine: "mysql" + gen: + go: + package: "authors" + out: "mysql" ``` -## Package Level Overrides +With the previous configuration, whenever a struct field is generated from a +table column that is called `id`, it will generated as `Identifier`. + +Also, whenever there is a nullable `timestamp with time zone` column in a +Postgres table, it will be generated as `null.Time`. Note that the mapping for +global type overrides has a field called `engine` that is absent in the regular +type overrides. This field is only used when there are multiple definitions +using multiple engines. Otherwise, the value of the `engine` key +defaults to the engine that is currently being used. + +Currently, type overrides and field renaming, both global and regular, are only +fully supported in Go. -Overrides can be configured globally, as demonstrated in the previous sections, or they can be configured on a per-package which -scopes the override behavior to just a single package: +## Version 1 ```yaml version: "1" packages: - - overrides: [...] + - name: "db" + path: "internal/db" + queries: "./sql/query/" + schema: "./sql/schema/" + engine: "postgresql" + emit_db_tags: false + emit_prepared_queries: true + emit_interface: false + emit_exact_table_names: false + emit_empty_slices: false + emit_exported_queries: false + emit_json_tags: true + emit_result_struct_pointers: false + emit_params_struct_pointers: false + emit_methods_with_db_argument: false + emit_pointers_for_null_types: false + emit_enum_valid_method: false + emit_all_enum_values: false + build_tags: "some_tag" + json_tags_case_style: "camel" + omit_unused_structs: false + output_batch_file_name: "batch.go" + output_db_file_name: "db.go" + output_models_file_name: "models.go" + output_querier_file_name: "querier.go" + output_copyfrom_file_name: "copyfrom.go" + query_parameter_limit: 1 ``` -## Renaming Struct Fields +### packages + +Each mapping in the `packages` collection has the following keys: + +- `name`: + - The package name to use for the generated code. Defaults to `path` basename. +- `path`: + - Output directory for generated code. +- `queries`: + - Directory of SQL queries or path to single SQL file; or a list of paths. +- `schema`: + - Directory of SQL migrations or path to single SQL file; or a list of paths. +- `engine`: + - 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`: + - If true, include support for prepared queries. Defaults to `false`. +- `emit_interface`: + - If true, output a `Querier` interface in the generated package. Defaults to `false`. +- `emit_exact_table_names`: + - If true, struct names will mirror table names. Otherwise, sqlc attempts to singularize plural table names. Defaults to `false`. +- `emit_empty_slices`: + - If true, slices returned by `:many` queries will be empty instead of `nil`. Defaults to `false`. +- `emit_exported_queries`: + - If true, autogenerated SQL statement can be exported to be accessed by another package. +- `emit_json_tags`: + - If true, add JSON tags to generated structs. Defaults to `false`. +- `emit_result_struct_pointers`: + - If true, query results are returned as pointers to structs. Queries returning multiple results are returned as slices of pointers. Defaults to `false`. +- `emit_params_struct_pointers`: + - If true, parameters are passed as pointers to structs. Defaults to `false`. +- `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`. +- `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. +- `build_tags`: + - If set, add a `//go:build ` directive at the beginning of each generated Go file. +- `json_tags_case_style`: + - `camel` for camelCase, `pascal` for PascalCase, `snake` for snake_case or `none` to use the column name in the DB. Defaults to `none`. +- `omit_unused_structs`: + - If `true`, sqlc won't generate table and enum structs that aren't used in queries for a given package. Defaults to `false`. +- `output_batch_file_name`: + - Customize the name of the batch file. Defaults to `batch.go`. +- `output_db_file_name`: + - Customize the name of the db file. Defaults to `db.go`. +- `output_models_file_name`: + - Customize the name of the models file. Defaults to `models.go`. +- `output_querier_file_name`: + - Customize the name of the querier file. Defaults to `querier.go`. +- `output_copyfrom_file_name`: + - Customize the name of the copyfrom file. Defaults to `copyfrom.go`. +- `output_files_suffix`: + - If specified the suffix will be added to the name of the generated files. +- `query_parameter_limit`: + - Positional arguments that will be generated in Go functions (`>= 0`). To always emit a parameter struct, you would need to set it to `0`. Defaults to `1`. + +### overrides + +See the version 1 configuration section of the [Overriding types](../howto/overrides.md#version-1-configuration) guide for details. + +### rename Struct field names are generated from column names using a simple algorithm: split the column name on underscores and capitalize the first letter of each @@ -108,7 +485,7 @@ spotify_url -> SpotifyUrl app_id -> AppID ``` -If you're not happy with a field's generated name, use the `rename` dictionary +If you're not happy with a field's generated name, use the `rename` mapping to pick a new name. The keys are column names and the values are the struct field name to use. @@ -118,5 +495,3 @@ packages: [...] rename: spotify_url: "SpotifyURL" ``` - - diff --git a/docs/reference/datatypes.md b/docs/reference/datatypes.md index 052cfc63a0..14ceb42a3f 100644 --- a/docs/reference/datatypes.md +++ b/docs/reference/datatypes.md @@ -1,10 +1,15 @@ # Datatypes +`sqlc` attempts to make reasonable default choices when mapping internal +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.md#overrides) in your `sqlc` config file. + ## Arrays PostgreSQL [arrays](https://www.postgresql.org/docs/current/arrays.html) are -materialized as Go slices. Currently, only one-dimensional arrays are -supported. +materialized as Go slices. ```sql CREATE TABLE places ( @@ -22,11 +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, @@ -39,8 +49,8 @@ CREATE TABLE authors ( package db import ( - "time" "database/sql" + "time" ) type Author struct { @@ -52,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 @@ -86,7 +96,7 @@ type Store struct { ## Null For structs, null values are represented using the appropriate type from the -`database/sql` package. +`database/sql` or `pgx` package. ```sql CREATE TABLE authors ( @@ -113,7 +123,7 @@ 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. +sqlc uses the excellent `github.com/google/uuid` package. The pgx/v5 sql package uses `pgtype.UUID`. ```sql CREATE TABLE records ( @@ -129,6 +139,186 @@ import ( ) type Author struct { - ID uuid.UUID + ID uuid.UUID +} +``` + +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": [ + { + "column": "*.uuid", + "go_type": "github.com/google/uuid.UUID" + } + ] +} +``` + +## 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 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 + +type BookData struct { + Genres []string `json:"genres"` + Title string `json:"title"` + Published bool `json:"published"` +} +``` + +```sql +CREATE TABLE books ( + data jsonb +); +``` + +```json +{ + "overrides": [ + { + "column": "books.data", + "go_type": { + "import":"example.com/db", + "package": "dto", + "type":"BookData", + "pointer": true + } + } + ] +} +``` + +```go +package db + +import ( + "example.com/db/dto" +) + +type Book struct { + Data *dto.BookData +} +``` + +## 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. See [Overriding types](../howto/overrides.md) for more information. + +```sql +-- Multipolygons in British National Grid (epsg:27700) +create table shapes( + id serial, + name varchar, + geom geometry(Multipolygon, 27700) +); + +-- name: GetShapes :many +SELECT * FROM shapes; +``` + +```json +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "query.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "db_type": "geometry", + "go_type": "github.com/twpayne/go-geom.MultiPolygon" + }, + { + "db_type": "geometry", + "go_type": "github.com/twpayne/go-geom.MultiPolygon", + "nullable": true + } + ] } ``` diff --git a/docs/reference/environment-variables.md b/docs/reference/environment-variables.md new file mode 100644 index 0000000000..837dd13980 --- /dev/null +++ b/docs/reference/environment-variables.md @@ -0,0 +1,165 @@ +# 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 +``` + +Currently, no experiments are defined. Experiments will be documented here as +they are introduced. + +## SQLCCACHE + +The `SQLCCACHE` environment variable dictates where `sqlc` will store cached +WASM-based plugins and modules. By default `sqlc` follows the [XDG Base +Directory +Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). + +## SQLCDEBUG + +The `SQLCDEBUG` variable controls debugging variables within the runtime. It is +a comma-separated list of name=val pairs settings. + +### dumpast + +The `dumpast` command shows the SQL AST that was generated by the parser. Note +that this is the generic SQL AST, not the engine-specific SQL AST. + +``` +SQLCDEBUG=dumpast=1 +``` + +``` +([]interface {}) (len=1 cap=1) { + (*catalog.Catalog)(0xc0004f48c0)({ + Comment: (string) "", + DefaultSchema: (string) (len=6) "public", + Name: (string) "", + Schemas: ([]*catalog.Schema) (len=3 cap=4) { + (*catalog.Schema)(0xc0004f4930)({ + Name: (string) (len=6) "public", + Tables: ([]*catalog.Table) (len=1 cap=1) { + (*catalog.Table)(0xc00052ff20)({ + Rel: (*ast.TableName)(0xc00052fda0)({ + Catalog: (string) "", + Schema: (string) "", + Name: (string) (len=7) "authors" + }), +``` + +### dumpcatalog + +The `dumpcatalog` command outputs the entire catalog. If you're using MySQL or +PostgreSQL, this can be a bit overwhelming. Expect this output to change in +future versions. + +``` +SQLCDEBUG=dumpcatalog=1 +``` + +``` +([]interface {}) (len=1 cap=1) { + (*catalog.Catalog)(0xc00050d1f0)({ + Comment: (string) "", + DefaultSchema: (string) (len=6) "public", + Name: (string) "", + Schemas: ([]*catalog.Schema) (len=3 cap=4) { + (*catalog.Schema)(0xc00050d260)({ + Name: (string) (len=6) "public", + Tables: ([]*catalog.Table) (len=1 cap=1) { + (*catalog.Table)(0xc0000c0840)({ + Rel: (*ast.TableName)(0xc0000c06c0)({ + Catalog: (string) "", + Schema: (string) "", + Name: (string) (len=7) "authors" + }), +``` + +### trace + +The `trace` command is helpful for tracking down performance issues. + +`SQLCDEBUG=trace=1` + +By default, the trace output is written to `trace.out` in the current working +directory. You can configure a different path if needed. + +`SQLCDEBUG=trace=name.out` + +View the execution trace using the Go `trace` tool. + +``` +go tool trace trace.out +``` + +There's a ton of different views for the trace output, but here's an example +log showing the execution time for each package. + +``` +0.000043897 . 1 task sqlc (id 1, parent 0) created +0.000144923 . 101026 1 region generate started (duration: 47.619781ms) +0.001048975 . 904052 1 region package started (duration: 14.588456ms) +0.001054616 . 5641 1 name=authors dir=/Users/kyle/projects/sqlc/examples/python language=python +0.001071257 . 16641 1 region parse started (duration: 7.966549ms) +0.009043960 . 7972703 1 region codegen started (duration: 6.587086ms) +0.009171704 . 127744 1 new goroutine 35: text/template/parse.lex·dwrap·1 +0.010361654 . 1189950 1 new goroutine 36: text/template/parse.lex·dwrap·1 +0.015641815 . 5280161 1 region package started (duration: 10.904938ms) +0.015644943 . 3128 1 name=booktest dir=/Users/kyle/projects/sqlc/examples/python language=python +0.015647431 . 2488 1 region parse started (duration: 4.207749ms) +0.019860308 . 4212877 1 region codegen started (duration: 6.681624ms) +0.020028488 . 168180 1 new goroutine 37: text/template/parse.lex·dwrap·1 +0.021020310 . 991822 1 new goroutine 8: text/template/parse.lex·dwrap·1 +0.026551163 . 5530853 1 region package started (duration: 9.217294ms) +0.026554368 . 3205 1 name=jets dir=/Users/kyle/projects/sqlc/examples/python language=python +0.026556804 . 2436 1 region parse started (duration: 3.491005ms) +0.030051911 . 3495107 1 region codegen started (duration: 5.711931ms) +0.030213937 . 162026 1 new goroutine 20: text/template/parse.lex·dwrap·1 +0.031099938 . 886001 1 new goroutine 38: text/template/parse.lex·dwrap·1 +0.035772637 . 4672699 1 region package started (duration: 10.267039ms) +0.035775688 . 3051 1 name=ondeck dir=/Users/kyle/projects/sqlc/examples/python language=python +0.035778150 . 2462 1 region parse started (duration: 4.094518ms) +0.039877181 . 4099031 1 region codegen started (duration: 6.156341ms) +0.040010771 . 133590 1 new goroutine 39: text/template/parse.lex·dwrap·1 +0.040894567 . 883796 1 new goroutine 40: text/template/parse.lex·dwrap·1 +0.046042779 . 5148212 1 region writefiles started (duration: 1.718259ms) +0.047767781 . 1725002 1 task end +``` + +### processplugins + +Setting this value to `0` disables process-based plugins. If a process-based +plugin is declared in the configuration file, running any `sqlc` command will +return an error. + +`SQLCDEBUG=processplugins=0` + +### dumpvetenv + +The `dumpvetenv` command prints the variables available to a `sqlc vet` rule +during evaluation. + +`SQLCDEBUG=dumpvetenv=1` + +### dumpexplain + +The `dumpexplain` command prints the JSON-formatted result from running +`EXPLAIN ...` on a query when a `sqlc vet` rule evaluation requires its output. + +`SQLCDEBUG=dumpexplain=1` + +## SQLCTMPDIR + +If specified, use the given directory as the base for temporary folders. Only +applies when using WASM-based codegen plugins. When not specified, this +defaults to passing an empty string to +[`os.MkdirTemp`](https://pkg.go.dev/os#MkdirTemp). diff --git a/docs/reference/language-support.rst b/docs/reference/language-support.rst new file mode 100644 index 0000000000..20de2817d6 --- /dev/null +++ b/docs/reference/language-support.rst @@ -0,0 +1,56 @@ +Database and language support +############################# + +========== ======================= ============ ============ =============== +Language Plugin MySQL PostgreSQL SQLite +========== ======================= ============ ============ =============== +Go (built-in) Stable Stable Beta +Go `sqlc-gen-go`_ Stable Stable Beta +Kotlin `sqlc-gen-kotlin`_ Beta Beta Not implemented +Python `sqlc-gen-python`_ Beta Beta Not implemented +TypeScript `sqlc-gen-typescript`_ Beta Beta Not implemented +========== ======================= ============ ============ =============== + +Community language support +************************** + +New languages can be added via :doc:`plugins <../guides/plugins>`. + +======== ================================== =============== =============== =============== +Language Plugin MySQL PostgreSQL SQLite +======== ================================== =============== =============== =============== +C# `DaredevilOSS/sqlc-gen-csharp`_ Stable Stable Stable +F# `kaashyapan/sqlc-gen-fsharp`_ N/A Beta Beta +Java `tandemdude/sqlc-gen-java`_ Beta Beta N/A +PHP `lcarilla/sqlc-plugin-php-dbal`_ Beta N/A N/A +Ruby `DaredevilOSS/sqlc-gen-ruby`_ Beta Beta Beta +Zig `tinyzimmer/sqlc-gen-zig`_ N/A Beta Beta +Python `rayakame/sqlc-gen-better-python`_ N/A Beta Beta +[Any] `fdietze/sqlc-gen-from-template`_ Stable Stable Stable +======== ================================== =============== =============== =============== + +Plugins developed by our Community can also be found using our `github topic`_. + +Community projects +****************** + +======== ================================= =============== =============== =============== +Language Project MySQL PostgreSQL SQLite +======== ================================= =============== =============== =============== +Gleam `daniellionel01/parrot`_ Stable Stable Stable +======== ================================= =============== =============== =============== + +.. _sqlc-gen-go: https://github.com/sqlc-dev/sqlc-gen-go +.. _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 +.. _sqlc-gen-typescript: https://github.com/sqlc-dev/sqlc-gen-typescript +.. _DaredevilOSS/sqlc-gen-csharp: https://github.com/DaredevilOSS/sqlc-gen-csharp +.. _DaredevilOSS/sqlc-gen-ruby: https://github.com/DaredevilOSS/sqlc-gen-ruby +.. _fdietze/sqlc-gen-from-template: https://github.com/fdietze/sqlc-gen-from-template +.. _lcarilla/sqlc-plugin-php-dbal: https://github.com/lcarilla/sqlc-plugin-php-dbal +.. _tandemdude/sqlc-gen-java: https://github.com/tandemdude/sqlc-gen-java +.. _tinyzimmer/sqlc-gen-zig: https://github.com/tinyzimmer/sqlc-gen-zig +.. _daniellionel01/parrot: https://github.com/daniellionel01/parrot +.. _rayakame/sqlc-gen-better-python: https://github.com/rayakame/sqlc-gen-better-python +.. _github topic: https://github.com/topics/sqlc-plugin diff --git a/docs/reference/macros.md b/docs/reference/macros.md new file mode 100644 index 0000000000..36c7c92420 --- /dev/null +++ b/docs/reference/macros.md @@ -0,0 +1,119 @@ +# Macros + +## `sqlc.arg` + +Attach a name to a parameter in a SQL query. This macro expands to an +engine-specific parameter placeholder. The name of the parameter is noted and +used during code generation. + +```sql +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = sqlc.arg(name); + +-- >>> EXPANDS TO >>> + +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = ?; +``` + +See more examples in [Naming parameters](../howto/named_parameters). + +## `sqlc.embed` + +Embedding allows you to reuse existing model structs in more queries, resulting +in less manual serialization work. First, imagine we have the following schema +with students and test scores. + +```sql +CREATE TABLE students ( + id bigserial PRIMARY KEY, + name text, + age integer +); + +CREATE TABLE test_scores ( + student_id bigint, + score integer, + grade text +); +``` + +```sql +-- name: GetStudentAndScore :one +SELECT sqlc.embed(students), sqlc.embed(test_scores) +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; + +-- >>> EXPANDS TO >>> + +-- name: GetStudentAndScore :one +SELECT students.*, test_scores.* +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +The Go method will return a struct with a field for the `Student` and field for +the test `TestScore` instead of each column existing on the struct. + +```go +type GetStudentAndScoreRow struct { + Student Student + TestScore TestScore +} + +func (q *Queries) GetStudentAndScore(ctx context.Context, id int64) (GetStudentAndScoreRow, error) { + // ... +} +``` + +See a full example in [Embedding structs](../howto/embedding). + +## `sqlc.narg` + +The same as `sqlc.arg`, but always marks the parameter as nullable. + +```sql +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = sqlc.narg(name); + +-- >>> EXPANDS TO >>> + +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE LOWER(name) = ?; +``` + +See more examples in [Naming parameters](../howto/named_parameters). + +## `sqlc.slice` + +For drivers that do not support passing slices to the IN operator, the +`sqlc.slice` macro generates a dynamic query at runtime with the correct +number of parameters. + +```sql +/* name: SelectStudents :many */ +SELECT * FROM students +WHERE age IN (sqlc.slice("ages")) + +-- >>> EXPANDS TO >>> + +/* name: SelectStudents :many */ +SELECT id, name, age FROM authors +WHERE age IN (/*SLICE:ages*/?) +``` + +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.md#mysql-and-sqlite). diff --git a/docs/reference/query-annotations.md b/docs/reference/query-annotations.md index c16bb03a18..4fabe05aae 100644 --- a/docs/reference/query-annotations.md +++ b/docs/reference/query-annotations.md @@ -20,8 +20,8 @@ WHERE id = $1; ```go func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) - return err + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err } ``` @@ -37,7 +37,7 @@ DELETE FROM authors; ```go func (q *Queries) DeleteAllAuthors(ctx context.Context) (sql.Result, error) { - return q.db.ExecContext(ctx, deleteAllAuthors) + return q.db.ExecContext(ctx, deleteAllAuthors) } ``` @@ -54,8 +54,26 @@ DELETE FROM authors; ```go func (q *Queries) DeleteAllAuthors(ctx context.Context) (int64, error) { - _, err := q.db.ExecContext(ctx, deleteAllAuthors) - // ... + _, err := q.db.ExecContext(ctx, deleteAllAuthors) + // ... +} +``` + +## `:execlastid` + +The generated method will return the number generated by the database from the +[result](https://golang.org/pkg/database/sql/#Result) returned by +[ExecContext](https://golang.org/pkg/database/sql/#DB.ExecContext). + +```sql +-- name: InsertAuthor :execlastid +INSERT INTO authors (name) VALUES (?); +``` + +```go +func (q *Queries) InsertAuthor(ctx context.Context, name string) (int64, error) { + _, err := q.db.ExecContext(ctx, insertAuthor, name) + // ... } ``` @@ -72,8 +90,8 @@ ORDER BY name; ```go func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) - // ... + rows, err := q.db.QueryContext(ctx, listAuthors) + // ... } ``` @@ -90,7 +108,123 @@ WHERE id = $1 LIMIT 1; ```go func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) - // ... + row := q.db.QueryRowContext(ctx, getAuthor, id) + // ... +} +``` + +## `:batchexec` + +__NOTE: This command only works with PostgreSQL using the `pgx/v4` and `pgx/v5` drivers and outputting Go code.__ + +The generated method will return a batch object. The batch object will have +the following methods: +- `Exec`, that takes a `func(int, error)` parameter, +- `Close`, to close the batch operation early. + +```sql +-- name: DeleteBook :batchexec +DELETE FROM books +WHERE book_id = $1; +``` + +```go +type DeleteBookBatchResults struct { + br pgx.BatchResults + ind int +} + +func (q *Queries) DeleteBook(ctx context.Context, bookID []int32) *DeleteBookBatchResults { + //... +} +func (b *DeleteBookBatchResults) Exec(f func(int, error)) { + //... +} +func (b *DeleteBookBatchResults) Close() error { + //... +} +``` + +## `:batchmany` + +__NOTE: This command only works with PostgreSQL using the `pgx/v4` and `pgx/v5` drivers and outputting Go code.__ + +The generated method will return a batch object. The batch object will have +the following methods: +- `Query`, that takes a `func(int, []T, error)` parameter, where `T` is your query's return type +- `Close`, to close the batch operation early. + +```sql +-- name: BooksByTitleYear :batchmany +SELECT * FROM books +WHERE title = $1 AND year = $2; +``` + +```go +type BooksByTitleYearBatchResults struct { + br pgx.BatchResults + ind int +} +type BooksByTitleYearParams struct { + Title string `json:"title"` + Year int32 `json:"year"` +} + +func (q *Queries) BooksByTitleYear(ctx context.Context, arg []BooksByTitleYearParams) *BooksByTitleYearBatchResults { + //... +} +func (b *BooksByTitleYearBatchResults) Query(f func(int, []Book, error)) { + //... +} +func (b *BooksByTitleYearBatchResults) Close() error { + //... } ``` + +## `:batchone` + +__NOTE: This command only works with PostgreSQL using the `pgx/v4` and `pgx/v5` drivers and outputting Go code.__ + +The generated method will return a batch object. The batch object will have +the following methods: +- `QueryRow`, that takes a `func(int, T, error)` parameter, where `T` is your query's return type +- `Close`, to close the batch operation early. + +```sql +-- name: CreateBook :batchone +INSERT INTO books ( + author_id, + isbn +) VALUES ( + $1, + $2 +) +RETURNING book_id, author_id, isbn +``` + +```go +type CreateBookBatchResults struct { + br pgx.BatchResults + ind int +} +type CreateBookParams struct { + AuthorID int32 `json:"author_id"` + Isbn string `json:"isbn"` +} + +func (q *Queries) CreateBook(ctx context.Context, arg []CreateBookParams) *CreateBookBatchResults { + //... +} +func (b *CreateBookBatchResults) QueryRow(f func(int, Book, error)) { + //... +} +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 index 409d54778c..ae7506b14f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,26 +1,27 @@ -alabaster==0.7.12 -Babel==2.9.0 -certifi==2020.12.5 -chardet==4.0.0 +Babel==2.17.0 +Jinja2==3.1.6 +MarkupSafe==3.0.3 +Pygments==2.19.2 +Sphinx==7.4.7 +certifi==2026.1.4 +chardet==5.2.0 commonmark==0.9.1 -docutils==0.16 -idna==2.10 -imagesize==1.2.0 -Jinja2==2.11.3 -MarkupSafe==1.1.1 -packaging==20.9 -Pygments==2.7.4 -pyparsing==2.4.7 -pytz==2021.1 -recommonmark==0.7.1 -requests==2.25.1 -snowballstemmer==2.1.0 -Sphinx==3.4.3 -sphinx-rtd-theme==0.5.1 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==1.0.3 +docutils==0.20.1 +idna==3.11 +imagesize==1.4.1 +myst-parser==4.0.1 +packaging==25.0 +pyparsing==3.3.1 +pytz==2025.2 +requests==2.32.5 +snowballstemmer==3.0.1 +sphinx-favicon==1.0.1 +sphinx-rtd-theme==3.0.2 +sphinxcontrib-applehelp==2.0.0 +sphinxcontrib-devhelp==2.0.0 +sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.4 -urllib3==1.26.3 +sphinxcontrib-qthelp==2.0.0 +sphinxcontrib-serializinghtml==2.0.0 +sphinxext-rediraffe==0.3.0 +urllib3==2.6.2 diff --git a/docs/tutorials/getting-started-mysql.md b/docs/tutorials/getting-started-mysql.md new file mode 100644 index 0000000000..1c436e7e6a --- /dev/null +++ b/docs/tutorials/getting-started-mysql.md @@ -0,0 +1,221 @@ +# Getting started with MySQL + +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.rst) 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` + +```shell +go mod init tutorial.sqlc.dev/app +``` + +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current +directory. In our new directory, create a file named `sqlc.yaml` with the +following contents: + +```yaml +version: "2" +sql: + - engine: "mysql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" +``` + +## 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 ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name text NOT NULL, + bio text +); +``` + +Next, create a `query.sql` file with the following four queries: + +```sql +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ? LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :execresult +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +); + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; +``` + +## 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` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: + +``` +├── go.mod +├── query.sql +├── schema.sql +├── sqlc.yaml +└── tutorial + ├── db.go + ├── models.go + └── query.sql.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" + + _ "github.com/go-sql-driver/mysql" + + "tutorial.sqlc.dev/app/tutorial" +) + +func run() error { + ctx := context.Background() + + db, err := sql.Open("mysql", "user:password@/dbname?parseTime=true") + if err != nil { + return err + } + + queries := tutorial.New(db) + + // list all authors + authors, err := queries.ListAuthors(ctx) + if err != nil { + return err + } + log.Println(authors) + + // create an author + result, 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}, + }) + if err != nil { + return err + } + + insertedAuthorID, err := result.LastInsertId() + if err != nil { + return err + } + log.Println(insertedAuthorID) + + // get the author we just inserted + fetchedAuthor, err := queries.GetAuthor(ctx, insertedAuthorID) + if err != nil { + return err + } + + // prints true + log.Println(reflect.DeepEqual(insertedAuthorID, fetchedAuthor.ID)) + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} +``` + +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 ./... +``` + +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. + +## 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 new file mode 100644 index 0000000000..a98c32ff37 --- /dev/null +++ b/docs/tutorials/getting-started-postgresql.md @@ -0,0 +1,248 @@ +# Getting started with PostgreSQL + +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.rst) 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`: + +```shell +go mod init tutorial.sqlc.dev/app +``` + +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current +directory. In our new directory, create a file named `sqlc.yaml` with the +following contents: + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + gen: + 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: + +```sql +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); +``` + +Next, create a `query.sql` file with the following five queries: + +```sql +-- 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: UpdateAuthor :exec +UPDATE authors + set name = $2, + bio = $3 +WHERE id = $1; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; +``` + +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: + +```sql +-- name: UpdateAuthor :one +UPDATE authors + set name = $2, + bio = $3 +WHERE id = $1 +RETURNING *; +``` + +## 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` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: + +``` +├── go.mod +├── query.sql +├── schema.sql +├── sqlc.yaml +└── tutorial + ├── db.go + ├── models.go + └── query.sql.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" + "log" + "reflect" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "tutorial.sqlc.dev/app/tutorial" +) + +func run() error { + ctx := context.Background() + + conn, err := pgx.Connect(ctx, "user=pqgotest dbname=pqgotest sslmode=verify-full") + if err != nil { + return err + } + defer conn.Close(ctx) + + queries := tutorial.New(conn) + + // list all authors + authors, err := queries.ListAuthors(ctx) + if err != nil { + return err + } + log.Println(authors) + + // create an author + insertedAuthor, err := queries.CreateAuthor(ctx, tutorial.CreateAuthorParams{ + Name: "Brian Kernighan", + Bio: pgtype.Text{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + }) + if err != nil { + return err + } + log.Println(insertedAuthor) + + // get the author we just inserted + fetchedAuthor, err := queries.GetAuthor(ctx, insertedAuthor.ID) + if err != nil { + return err + } + + // prints true + log.Println(reflect.DeepEqual(insertedAuthor, fetchedAuthor)) + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} +``` + +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 ./... +``` + +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" +``` + +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 new file mode 100644 index 0000000000..b3c2a570df --- /dev/null +++ b/docs/tutorials/getting-started-sqlite.md @@ -0,0 +1,201 @@ +# Getting started with SQLite + +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.rst) 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.sqlc.dev/app` + +```shell +go mod init tutorial.sqlc.dev/app +``` + +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current +directory. In our new directory, create a file named `sqlc.yaml` with the +following contents: + +```yaml +version: "2" +sql: + - engine: "sqlite" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" +``` + +## 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 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +); +``` + +Next, create a `query.sql` file with the following five queries: + +```sql +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ? LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +RETURNING *; + +-- name: UpdateAuthor :exec +UPDATE authors +set name = ?, +bio = ? +WHERE id = ?; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; +``` + +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: + +```sql +-- name: UpdateAuthor :one +UPDATE authors +set name = ?, +bio = ? +WHERE id = ? +RETURNING *; +``` + +## 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` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: + +``` +├── go.mod +├── query.sql +├── schema.sql +├── sqlc.yaml +└── tutorial + ├── db.go + ├── models.go + └── query.sql.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" + _ "embed" + "log" + "reflect" + + _ "modernc.org/sqlite" + + "tutorial.sqlc.dev/app/tutorial" +) + +//go:embed schema.sql +var ddl string + +func run() error { + ctx := context.Background() + + db, err := sql.Open("sqlite", ":memory:") + if err != nil { + return err + } + + // create tables + if _, err := db.ExecContext(ctx, ddl); err != nil { + return err + } + + queries := tutorial.New(db) + + // list all authors + authors, err := queries.ListAuthors(ctx) + if err != nil { + return err + } + log.Println(authors) + + // 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}, + }) + if err != nil { + return err + } + log.Println(insertedAuthor) + + // get the author we just inserted + fetchedAuthor, err := queries.GetAuthor(ctx, insertedAuthor.ID) + if err != nil { + return err + } + + // prints true + log.Println(reflect.DeepEqual(insertedAuthor, fetchedAuthor)) + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} +``` + +Before this code will compile you'll need to fetch the relevant SQLite driver: + +```shell +go get modernc.org/sqlite +go build ./... +``` + +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/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md deleted file mode 100644 index a5f9f587dd..0000000000 --- a/docs/tutorials/getting-started.md +++ /dev/null @@ -1,173 +0,0 @@ -# Getting started - -Okay, enough hype, let's see it in action. - -First you pass the following SQL to `sqlc generate`: - -```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; -``` - -And then in your application code you'd write: - -```go - -// list all authors -authors, err := db.ListAuthors(ctx) -if err != nil { - return err -} -fmt.Println(authors) - -// create an author -insertedAuthor, err := db.CreateAuthor(ctx, db.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 { - return err -} -fmt.Println(insertedAuthor) - -// get the author we just inserted -fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) -if err != nil { - return err -} -// prints true -fmt.Println(reflect.DeepEqual(insertedAuthor, fetchedAuthor)) -``` - -To make that possible, sqlc generates readable, **idiomatic** Go code that you -otherwise would have had to write yourself. Take a look: - -```go -package db - -import ( - "context" - "database/sql" -) - -type Author struct { - ID int64 - Name string - Bio sql.NullString -} - -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 -} - -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 -} - -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/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/mysql/db.go b/examples/authors/mysql/db.go index 05882b80ef..fc409f7e3f 100644 --- a/examples/authors/mysql/db.go +++ b/examples/authors/mysql/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package authors diff --git a/examples/authors/mysql/db_test.go b/examples/authors/mysql/db_test.go index 08c112282b..96ec363f77 100644 --- a/examples/authors/mysql/db_test.go +++ b/examples/authors/mysql/db_test.go @@ -1,4 +1,4 @@ -// +build examples +//go:build examples package authors @@ -7,14 +7,20 @@ import ( "database/sql" "testing" - "github.com/kyleconroy/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 b6915849c4..24e47df1ef 100644 --- a/examples/authors/mysql/models.go +++ b/examples/authors/mysql/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package authors diff --git a/examples/authors/mysql/query.sql.go b/examples/authors/mysql/query.sql.go index 97496a5691..03aeb2ca83 100644 --- a/examples/authors/mysql/query.sql.go +++ b/examples/authors/mysql/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package authors diff --git a/examples/authors/postgresql/db.go b/examples/authors/postgresql/db.go index 05882b80ef..e1f93c6f1d 100644 --- a/examples/authors/postgresql/db.go +++ b/examples/authors/postgresql/db.go @@ -1,17 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row } func New(db DBTX) *Queries { @@ -22,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 45f3188011..0fdd8824be 100644 --- a/examples/authors/postgresql/db_test.go +++ b/examples/authors/postgresql/db_test.go @@ -1,33 +1,39 @@ -// +build examples +//go:build examples package authors import ( "context" - "database/sql" "testing" - "github.com/kyleconroy/sqlc/internal/sqltest" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() - db := New(sdb) + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) + if err != nil { + t.Fatal(err) + } + defer db.Close(ctx) + + q := New(db) // list all authors - authors, err := db.ListAuthors(ctx) + authors, err := q.ListAuthors(ctx) if err != nil { t.Fatal(err) } t.Log(authors) // create an author - insertedAuthor, err := db.CreateAuthor(ctx, CreateAuthorParams{ + 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) @@ -35,7 +41,7 @@ func TestAuthors(t *testing.T) { t.Log(insertedAuthor) // get the author we just inserted - fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) + fetchedAuthor, err := q.GetAuthor(ctx, insertedAuthor.ID) if err != nil { t.Fatal(err) } diff --git a/examples/authors/postgresql/models.go b/examples/authors/postgresql/models.go index b6915849c4..7845b91a3d 100644 --- a/examples/authors/postgresql/models.go +++ b/examples/authors/postgresql/models.go @@ -1,13 +1,15 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 795a6de4c7..c3325a8524 100644 --- a/examples/authors/postgresql/query.sql.go +++ b/examples/authors/postgresql/query.sql.go @@ -1,11 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package authors import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5/pgtype" ) const createAuthor = `-- name: CreateAuthor :one @@ -19,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 @@ -35,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 } @@ -45,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 @@ -57,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 } @@ -70,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.json b/examples/authors/sqlc.json deleted file mode 100644 index 58feec2d4c..0000000000 --- a/examples/authors/sqlc.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "2", - "sql": [ - { - "schema": "postgresql/schema.sql", - "queries": "postgresql/query.sql", - "engine": "postgresql", - "gen": { - "go": { - "package": "authors", - "out": "postgresql" - } - } - }, - { - "schema": "mysql/schema.sql", - "queries": "mysql/query.sql", - "engine": "mysql", - "gen": { - "go": { - "package": "authors", - "out": "mysql" - } - } - } - ] -} diff --git a/examples/authors/sqlc.yaml b/examples/authors/sqlc.yaml new file mode 100644 index 0000000000..57f2319ea1 --- /dev/null +++ b/examples/authors/sqlc.yaml @@ -0,0 +1,52 @@ +version: '2' +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: +- name: postgresql + schema: postgresql/schema.sql + queries: postgresql/query.sql + engine: postgresql + database: + uri: "${VET_TEST_EXAMPLES_POSTGRES_AUTHORS}" + analyzer: + database: false + rules: + - sqlc/db-prepare + - postgresql-query-too-costly + gen: + go: + package: authors + sql_package: pgx/v5 + out: postgresql +- name: mysql + schema: mysql/schema.sql + queries: mysql/query.sql + engine: mysql + database: + uri: "${VET_TEST_EXAMPLES_MYSQL_AUTHORS}" + rules: + - sqlc/db-prepare + # - mysql-query-too-costly + gen: + go: + package: authors + out: mysql +- name: sqlite + schema: sqlite/schema.sql + queries: sqlite/query.sql + engine: sqlite + database: + uri: file:authors?mode=memory&cache=shared + rules: + - sqlc/db-prepare + gen: + go: + package: authors + out: sqlite +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" diff --git a/examples/authors/sqlite/db.go b/examples/authors/sqlite/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/examples/authors/sqlite/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/db_test.go b/examples/authors/sqlite/db_test.go new file mode 100644 index 0000000000..e10ce46069 --- /dev/null +++ b/examples/authors/sqlite/db_test.go @@ -0,0 +1,48 @@ +//go:build examples + +package authors + +import ( + "context" + "database/sql" + "testing" + + "github.com/sqlc-dev/sqlc/internal/sqltest" +) + +func TestAuthors(t *testing.T) { + sdb, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer sdb.Close() + defer cleanup() + + ctx := context.Background() + db := New(sdb) + + // list all authors + authors, err := db.ListAuthors(ctx) + if err != nil { + t.Fatal(err) + } + t.Log(authors) + + // create an author + result, 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) + } + authorID, err := result.LastInsertId() + if err != nil { + t.Fatal(err) + } + t.Log(authorID) + + // get the author we just inserted + fetchedAuthor, err := db.GetAuthor(ctx, authorID) + if err != nil { + t.Fatal(err) + } + t.Log(fetchedAuthor) +} diff --git a/examples/authors/sqlite/models.go b/examples/authors/sqlite/models.go new file mode 100644 index 0000000000..24e47df1ef --- /dev/null +++ b/examples/authors/sqlite/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/examples/authors/sqlite/query.sql b/examples/authors/sqlite/query.sql new file mode 100644 index 0000000000..c3b5866149 --- /dev/null +++ b/examples/authors/sqlite/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 :execresult */ +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +); + +/* name: DeleteAuthor :exec */ +DELETE FROM authors +WHERE id = ?; diff --git a/examples/authors/sqlite/query.sql.go b/examples/authors/sqlite/query.sql.go new file mode 100644 index 0000000000..03aeb2ca83 --- /dev/null +++ b/examples/authors/sqlite/query.sql.go @@ -0,0 +1,78 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :execresult +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { + return q.db.ExecContext(ctx, createAuthor, 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 = ? 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/sqlite/schema.sql b/examples/authors/sqlite/schema.sql new file mode 100644 index 0000000000..9b81ece0e4 --- /dev/null +++ b/examples/authors/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id integer PRIMARY KEY AUTOINCREMENT, + name text NOT NULL, + bio text +); diff --git a/examples/batch/postgresql/batch.go b/examples/batch/postgresql/batch.go new file mode 100644 index 0000000000..44ab41b920 --- /dev/null +++ b/examples/batch/postgresql/batch.go @@ -0,0 +1,404 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package batch + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const booksByYear = `-- name: BooksByYear :batchmany +SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books +WHERE year = $1 +` + +type BooksByYearBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) BooksByYear(ctx context.Context, year []int32) *BooksByYearBatchResults { + batch := &pgx.Batch{} + for _, a := range year { + vals := []interface{}{ + a, + } + batch.Queue(booksByYear, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &BooksByYearBatchResults{br, len(year), false} +} + +func (b *BooksByYearBatchResults) Query(f func(int, []Book, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []Book + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var i Book + if err := rows.Scan( + &i.BookID, + &i.AuthorID, + &i.Isbn, + &i.BookType, + &i.Title, + &i.Year, + &i.Available, + &i.Tags, + ); err != nil { + return err + } + items = append(items, i) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *BooksByYearBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const createBook = `-- name: CreateBook :batchone +INSERT INTO books ( + author_id, + isbn, + book_type, + title, + year, + available, + tags +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 +) +RETURNING book_id, author_id, isbn, book_type, title, year, available, tags +` + +type CreateBookBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +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 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{}{ + a.AuthorID, + a.Isbn, + a.BookType, + a.Title, + a.Year, + a.Available, + a.Tags, + } + batch.Queue(createBook, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &CreateBookBatchResults{br, len(arg), false} +} + +func (b *CreateBookBatchResults) QueryRow(f func(int, Book, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var i Book + if b.closed { + if f != nil { + f(t, i, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan( + &i.BookID, + &i.AuthorID, + &i.Isbn, + &i.BookType, + &i.Title, + &i.Year, + &i.Available, + &i.Tags, + ) + if f != nil { + f(t, i, err) + } + } +} + +func (b *CreateBookBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const deleteBook = `-- name: DeleteBook :batchexec +DELETE FROM books +WHERE book_id = $1 +` + +type DeleteBookBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) DeleteBook(ctx context.Context, bookID []int32) *DeleteBookBatchResults { + batch := &pgx.Batch{} + for _, a := range bookID { + vals := []interface{}{ + a, + } + batch.Queue(deleteBook, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &DeleteBookBatchResults{br, len(bookID), false} +} + +func (b *DeleteBookBatchResults) 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 *DeleteBookBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const deleteBookNamedFunc = `-- name: DeleteBookNamedFunc :batchexec +DELETE FROM books +WHERE book_id = $1 +` + +type DeleteBookNamedFuncBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) DeleteBookNamedFunc(ctx context.Context, bookID []int32) *DeleteBookNamedFuncBatchResults { + batch := &pgx.Batch{} + for _, a := range bookID { + vals := []interface{}{ + a, + } + batch.Queue(deleteBookNamedFunc, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &DeleteBookNamedFuncBatchResults{br, len(bookID), false} +} + +func (b *DeleteBookNamedFuncBatchResults) 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 *DeleteBookNamedFuncBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const deleteBookNamedSign = `-- name: DeleteBookNamedSign :batchexec +DELETE FROM books +WHERE book_id = $1 +` + +type DeleteBookNamedSignBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) DeleteBookNamedSign(ctx context.Context, bookID []int32) *DeleteBookNamedSignBatchResults { + batch := &pgx.Batch{} + for _, a := range bookID { + vals := []interface{}{ + a, + } + batch.Queue(deleteBookNamedSign, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &DeleteBookNamedSignBatchResults{br, len(bookID), false} +} + +func (b *DeleteBookNamedSignBatchResults) 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 *DeleteBookNamedSignBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const getBiography = `-- name: GetBiography :batchone +SELECT biography FROM authors +WHERE author_id = $1 +` + +type GetBiographyBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) GetBiography(ctx context.Context, authorID []int32) *GetBiographyBatchResults { + batch := &pgx.Batch{} + for _, a := range authorID { + vals := []interface{}{ + a, + } + batch.Queue(getBiography, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &GetBiographyBatchResults{br, len(authorID), false} +} + +func (b *GetBiographyBatchResults) QueryRow(f func(int, []byte, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var biography []byte + if b.closed { + if f != nil { + f(t, biography, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&biography) + if f != nil { + f(t, biography, err) + } + } +} + +func (b *GetBiographyBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const updateBook = `-- name: UpdateBook :batchexec +UPDATE books +SET title = $1, tags = $2 +WHERE book_id = $3 +` + +type UpdateBookBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type UpdateBookParams struct { + Title string `json:"title"` + Tags []string `json:"tags"` + BookID int32 `json:"book_id"` +} + +func (q *Queries) UpdateBook(ctx context.Context, arg []UpdateBookParams) *UpdateBookBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.Title, + a.Tags, + a.BookID, + } + batch.Queue(updateBook, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &UpdateBookBatchResults{br, len(arg), false} +} + +func (b *UpdateBookBatchResults) 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 *UpdateBookBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/examples/batch/postgresql/db.go b/examples/batch/postgresql/db.go new file mode 100644 index 0000000000..b61e314055 --- /dev/null +++ b/examples/batch/postgresql/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package batch + +import ( + "context" + + "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 + 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/examples/batch/postgresql/db_test.go b/examples/batch/postgresql/db_test.go new file mode 100644 index 0000000000..122fa1aa73 --- /dev/null +++ b/examples/batch/postgresql/db_test.go @@ -0,0 +1,153 @@ +//go:build examples + +package batch + +import ( + "context" + "testing" + "time" + + "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 := local.PostgreSQL(t, []string{"schema.sql"}) + + ctx := context.Background() + + db, err := pgx.Connect(ctx, uri) + if err != nil { + t.Fatal(err) + } + defer db.Close(ctx) + + dq := New(db) + + // create an author + a, err := dq.CreateAuthor(ctx, "Unknown Master") + if err != nil { + t.Fatal(err) + } + + now := pgtype.Timestamptz{Time: time.Now(), Valid: true} + + // batch insert new books + newBooksParams := []CreateBookParams{ + { + AuthorID: a.AuthorID, + Isbn: "1", + Title: "my book title", + BookType: BookTypeFICTION, + Year: 2016, + Available: now, + Tags: []string{}, + }, + { + AuthorID: a.AuthorID, + Isbn: "2", + Title: "the second book", + BookType: BookTypeFICTION, + Year: 2016, + Available: now, + Tags: []string{"cool", "unique"}, + }, + { + AuthorID: a.AuthorID, + Isbn: "3", + Title: "the third book", + BookType: BookTypeFICTION, + Year: 2001, + Available: now, + Tags: []string{"cool"}, + }, + { + AuthorID: a.AuthorID, + Isbn: "4", + Title: "4th place finisher", + BookType: BookTypeNONFICTION, + Year: 2011, + Available: now, + Tags: []string{"other"}, + }, + } + newBooks := make([]Book, len(newBooksParams)) + var cnt int + dq.CreateBook(ctx, newBooksParams).QueryRow(func(i int, b Book, err error) { + if err != nil { + t.Fatalf("failed inserting book (%s): %s", b.Title, err) + } + newBooks[i] = b + cnt = i + }) + // first i was 0, so add 1 + cnt++ + numBooksExpected := len(newBooks) + if cnt != numBooksExpected { + t.Fatalf("expected to insert %d books; got %d", numBooksExpected, cnt) + } + + // batch update the title and tags + updateBooksParams := []UpdateBookParams{ + { + BookID: newBooks[1].BookID, + Title: "changed second title", + Tags: []string{"cool", "disastor"}, + }, + } + dq.UpdateBook(ctx, updateBooksParams).Exec(func(i int, err error) { + if err != nil { + t.Fatalf("error updating book %d: %s", updateBooksParams[i].BookID, err) + } + }) + + // batch many to retrieve books by year + selectBooksByTitleYearParams := []int32{2001, 2016} + var books0 []Book + dq.BooksByYear(ctx, selectBooksByTitleYearParams).Query(func(i int, books []Book, err error) { + if err != nil { + t.Fatal(err) + } + t.Logf("num books for %d: %d", selectBooksByTitleYearParams[i], len(books)) + books0 = append(books0, books...) + }) + + for _, book := range books0 { + 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) + } + t.Logf("Book %d author: %s\n", book.BookID, author.Name) + } + + // batch delete books + deleteBooksParams := make([]int32, len(newBooks)) + for i, book := range newBooks { + deleteBooksParams[i] = book.BookID + } + batchDelete := dq.DeleteBook(ctx, deleteBooksParams) + numDeletesProcessed := 0 + wantNumDeletesProcessed := 2 + batchDelete.Exec(func(i int, err error) { + if err != nil && err.Error() != "batch already closed" { + t.Fatalf("error deleting book %d: %s", deleteBooksParams[i], err) + } + + if err == nil { + numDeletesProcessed++ + } + + if i == wantNumDeletesProcessed-1 { + // close batch operation before processing all errors from delete operation + if err := batchDelete.Close(); err != nil { + t.Fatalf("failed to close batch operation: %s", err) + } + } + }) + if numDeletesProcessed != wantNumDeletesProcessed { + t.Fatalf("expected Close to short-circuit record processing (expected %d; got %d)", wantNumDeletesProcessed, numDeletesProcessed) + } +} diff --git a/examples/batch/postgresql/models.go b/examples/batch/postgresql/models.go new file mode 100644 index 0000000000..5165b316d1 --- /dev/null +++ b/examples/batch/postgresql/models.go @@ -0,0 +1,71 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package batch + +import ( + "database/sql/driver" + "fmt" + + "github.com/jackc/pgx/v5/pgtype" +) + +type BookType string + +const ( + BookTypeFICTION BookType = "FICTION" + BookTypeNONFICTION BookType = "NONFICTION" +) + +func (e *BookType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = BookType(s) + case string: + *e = BookType(s) + default: + return fmt.Errorf("unsupported scan type for BookType: %T", src) + } + return nil +} + +type NullBookType struct { + BookType BookType `json:"book_type"` + Valid bool `json:"valid"` // Valid is true if BookType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullBookType) Scan(value interface{}) error { + if value == nil { + ns.BookType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.BookType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullBookType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.BookType), nil +} + +type Author struct { + 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 pgtype.Timestamptz `json:"available"` + Tags []string `json:"tags"` +} diff --git a/examples/batch/postgresql/querier.go b/examples/batch/postgresql/querier.go new file mode 100644 index 0000000000..d0ad76db3c --- /dev/null +++ b/examples/batch/postgresql/querier.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package batch + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" +) + +type Querier interface { + BooksByYear(ctx context.Context, year []int32) *BooksByYearBatchResults + CreateAuthor(ctx context.Context, name string) (Author, error) + CreateBook(ctx context.Context, arg []CreateBookParams) *CreateBookBatchResults + DeleteBook(ctx context.Context, bookID []int32) *DeleteBookBatchResults + DeleteBookExecResult(ctx context.Context, bookID int32) (pgconn.CommandTag, error) + DeleteBookNamedFunc(ctx context.Context, bookID []int32) *DeleteBookNamedFuncBatchResults + DeleteBookNamedSign(ctx context.Context, bookID []int32) *DeleteBookNamedSignBatchResults + GetAuthor(ctx context.Context, authorID int32) (Author, error) + GetBiography(ctx context.Context, authorID []int32) *GetBiographyBatchResults + UpdateBook(ctx context.Context, arg []UpdateBookParams) *UpdateBookBatchResults +} + +var _ Querier = (*Queries)(nil) diff --git a/examples/batch/postgresql/query.sql b/examples/batch/postgresql/query.sql new file mode 100644 index 0000000000..4e21f25285 --- /dev/null +++ b/examples/batch/postgresql/query.sql @@ -0,0 +1,56 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE author_id = $1; + +-- name: DeleteBookExecResult :execresult +DELETE FROM books +WHERE book_id = $1; + +-- name: DeleteBook :batchexec +DELETE FROM books +WHERE book_id = $1; + +-- name: DeleteBookNamedFunc :batchexec +DELETE FROM books +WHERE book_id = sqlc.arg (book_id); + +-- name: DeleteBookNamedSign :batchexec +DELETE FROM books +WHERE book_id = @book_id; + +-- name: BooksByYear :batchmany +SELECT * FROM books +WHERE year = $1; + +-- name: CreateAuthor :one +INSERT INTO authors (name) VALUES ($1) +RETURNING *; + +-- name: CreateBook :batchone +INSERT INTO books ( + author_id, + isbn, + book_type, + title, + year, + available, + tags +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 +) +RETURNING *; + +-- name: UpdateBook :batchexec +UPDATE books +SET title = $1, tags = $2 +WHERE book_id = $3; + +-- name: GetBiography :batchone +SELECT biography FROM authors +WHERE author_id = $1; diff --git a/examples/batch/postgresql/query.sql.go b/examples/batch/postgresql/query.sql.go new file mode 100644 index 0000000000..b72dd3be28 --- /dev/null +++ b/examples/batch/postgresql/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package batch + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (name) VALUES ($1) +RETURNING author_id, name, biography +` + +func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { + row := q.db.QueryRow(ctx, createAuthor, name) + var i Author + err := row.Scan(&i.AuthorID, &i.Name, &i.Biography) + return i, err +} + +const deleteBookExecResult = `-- name: DeleteBookExecResult :execresult +DELETE FROM books +WHERE book_id = $1 +` + +func (q *Queries) DeleteBookExecResult(ctx context.Context, bookID int32) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, deleteBookExecResult, bookID) +} + +const getAuthor = `-- name: GetAuthor :one +SELECT author_id, name, biography FROM authors +WHERE author_id = $1 +` + +func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { + row := q.db.QueryRow(ctx, getAuthor, authorID) + var i Author + err := row.Scan(&i.AuthorID, &i.Name, &i.Biography) + return i, err +} diff --git a/examples/batch/postgresql/schema.sql b/examples/batch/postgresql/schema.sql new file mode 100644 index 0000000000..b79f773f27 --- /dev/null +++ b/examples/batch/postgresql/schema.sql @@ -0,0 +1,21 @@ +CREATE TABLE authors ( + author_id SERIAL PRIMARY KEY, + name text NOT NULL DEFAULT '', + biography JSONB +); + +CREATE TYPE book_type AS ENUM ( + 'FICTION', + 'NONFICTION' +); + +CREATE TABLE books ( + book_id SERIAL PRIMARY KEY, + author_id integer NOT NULL REFERENCES authors(author_id), + isbn text NOT NULL DEFAULT '' UNIQUE, + book_type book_type NOT NULL DEFAULT 'FICTION', + title text NOT NULL DEFAULT '', + year integer NOT NULL DEFAULT 2000, + available timestamp with time zone NOT NULL DEFAULT 'NOW()', + tags varchar[] NOT NULL DEFAULT '{}' +); diff --git a/examples/batch/sqlc.json b/examples/batch/sqlc.json new file mode 100644 index 0000000000..2f6b9a9e7e --- /dev/null +++ b/examples/batch/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, + "packages": [ + { + "path": "postgresql", + "name": "batch", + "schema": "postgresql/schema.sql", + "queries": "postgresql/query.sql", + "engine": "postgresql", + "database": { + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BATCH}" + }, + "analyzer": { + "database": false + }, + "rules": [ + "sqlc/db-prepare" + ], + "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 c6f85ff8b8..548c1a9fbe 100644 --- a/examples/booktest/mysql/db.go +++ b/examples/booktest/mysql/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package booktest diff --git a/examples/booktest/mysql/db_test.go b/examples/booktest/mysql/db_test.go index d6b3aa5196..6f97178c94 100644 --- a/examples/booktest/mysql/db_test.go +++ b/examples/booktest/mysql/db_test.go @@ -1,20 +1,27 @@ -// +build examples +//go:build examples package booktest import ( "context" + "database/sql" "testing" "time" - "github.com/kyleconroy/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 @@ -54,7 +61,7 @@ func TestBooks(t *testing.T) { AuthorID: int32(authorID), Isbn: "2", Title: "the second book", - BookType: BooksBookTypeFICTION , + BookType: BooksBookTypeFICTION, Yr: 2016, Available: now, Tags: "cool,unique", @@ -150,7 +157,7 @@ func TestBooks(t *testing.T) { t.Fatal(err) } for _, ab := range res { - t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tags: '%v'\n", ab.BookID, ab.Title, ab.Name, ab.Isbn, ab.Tags) + 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) diff --git a/examples/booktest/mysql/models.go b/examples/booktest/mysql/models.go index 6606a69b6e..1340059137 100644 --- a/examples/booktest/mysql/models.go +++ b/examples/booktest/mysql/models.go @@ -1,8 +1,11 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package booktest import ( + "database/sql/driver" "fmt" "time" ) @@ -26,6 +29,29 @@ func (e *BooksBookType) Scan(src interface{}) error { return nil } +type NullBooksBookType struct { + BooksBookType BooksBookType + Valid bool // Valid is true if BooksBookType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullBooksBookType) Scan(value interface{}) error { + if value == nil { + ns.BooksBookType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.BooksBookType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullBooksBookType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.BooksBookType), nil +} + type Author struct { AuthorID int32 Name string diff --git a/examples/booktest/mysql/query.sql.go b/examples/booktest/mysql/query.sql.go index 8c59971412..887af77ce9 100644 --- a/examples/booktest/mysql/query.sql.go +++ b/examples/booktest/mysql/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package booktest @@ -24,7 +26,7 @@ WHERE tags = ? type BooksByTagsRow struct { BookID int32 Title string - Name string + Name sql.NullString Isbn string Tags string } diff --git a/examples/booktest/postgresql/db.go b/examples/booktest/postgresql/db.go index c6f85ff8b8..cec8f99059 100644 --- a/examples/booktest/postgresql/db.go +++ b/examples/booktest/postgresql/db.go @@ -1,17 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row } func New(db DBTX) *Queries { @@ -22,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 b5c6cd4c33..ae71593852 100644 --- a/examples/booktest/postgresql/db_test.go +++ b/examples/booktest/postgresql/db_test.go @@ -1,4 +1,4 @@ -// +build examples +//go:build examples package booktest @@ -7,14 +7,21 @@ import ( "testing" "time" - "github.com/kyleconroy/sqlc/internal/sqltest" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - db, cleanup := sqltest.PostgreSQL(t, []string{"schema.sql"}) - defer cleanup() - 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(ctx) + dq := New(db) // create an author @@ -24,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) } @@ -32,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", @@ -99,7 +106,7 @@ func TestBooks(t *testing.T) { } // tx commit - err = tx.Commit() + err = tx.Commit(ctx) if err != nil { t.Fatal(err) } @@ -124,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) @@ -139,10 +146,21 @@ func TestBooks(t *testing.T) { t.Fatal(err) } for _, ab := range res { - t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tags: '%v'\n", ab.BookID, ab.Title, ab.Name, ab.Isbn, ab.Tags) + 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 e6d81bb8b7..7df113ef89 100644 --- a/examples/booktest/postgresql/models.go +++ b/examples/booktest/postgresql/models.go @@ -1,10 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package booktest import ( + "database/sql/driver" "fmt" - "time" + + "github.com/jackc/pgx/v5/pgtype" ) type BookType string @@ -26,6 +30,29 @@ func (e *BookType) Scan(src interface{}) error { return nil } +type NullBookType struct { + BookType BookType + Valid bool // Valid is true if BookType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullBookType) Scan(value interface{}) error { + if value == nil { + ns.BookType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.BookType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullBookType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.BookType), nil +} + type Author struct { AuthorID int32 Name string @@ -38,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 ff690ed6c8..dd2d557bbd 100644 --- a/examples/booktest/postgresql/query.sql.go +++ b/examples/booktest/postgresql/query.sql.go @@ -1,13 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package booktest import ( "context" - "time" - "github.com/lib/pq" + "github.com/jackc/pgx/v5/pgtype" ) const booksByTags = `-- name: BooksByTags :many @@ -25,13 +26,13 @@ WHERE tags && $1::varchar[] type BooksByTagsRow struct { BookID int32 Title string - Name string + 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 } @@ -44,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 } @@ -70,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 } @@ -86,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 } @@ -107,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 @@ -140,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( @@ -163,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 } @@ -174,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 } @@ -184,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 @@ -196,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, @@ -206,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 @@ -224,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 } @@ -242,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 419a759f19..b0b0d71d01 100644 --- a/examples/booktest/sqlc.json +++ b/examples/booktest/sqlc.json @@ -1,19 +1,51 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "name": "booktest", "path": "postgresql", "schema": "postgresql/schema.sql", "queries": "postgresql/query.sql", - "engine": "postgresql" + "engine": "postgresql", + "sql_package": "pgx/v5", + "database": { + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BOOKTEST}" + }, + "analyzer": { + "database": false + }, + "rules": [ + "sqlc/db-prepare" + ] }, { "name": "booktest", "path": "mysql", "schema": "mysql/schema.sql", "queries": "mysql/query.sql", - "engine": "mysql" + "engine": "mysql", + "database": { + "uri": "${VET_TEST_EXAMPLES_MYSQL_BOOKTEST}" + }, + "rules": [ + "sqlc/db-prepare" + ] + }, + { + "name": "booktest", + "path": "sqlite", + "schema": "sqlite/schema.sql", + "queries": "sqlite/query.sql", + "engine": "sqlite", + "database": { + "uri": "file:booktest?mode=memory&cache=shared" + }, + "rules": [ + "sqlc/db-prepare" + ] } ] } diff --git a/examples/booktest/sqlite/db.go b/examples/booktest/sqlite/db.go new file mode 100644 index 0000000000..548c1a9fbe --- /dev/null +++ b/examples/booktest/sqlite/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package booktest + +import ( + "context" + "database/sql" +) + +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 +} + +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/booktest/sqlite/db_test.go b/examples/booktest/sqlite/db_test.go new file mode 100644 index 0000000000..42a8b396b1 --- /dev/null +++ b/examples/booktest/sqlite/db_test.go @@ -0,0 +1,163 @@ +//go:build examples + +package booktest + +import ( + "context" + "testing" + "time" + + "github.com/sqlc-dev/sqlc/internal/sqltest" +) + +// TODO: Enum is not yet supported +const ( + BooksBookTypeFICTION string = "FICTION" + BooksBookTypeNONFICTION string = "NONFICTION" +) + +func TestBooks(t *testing.T) { + db, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer db.Close() + defer cleanup() + + ctx := context.Background() + dq := New(db) + + // create an author + a, err := dq.CreateAuthor(ctx, "Unknown Master") + if err != nil { + t.Fatal(err) + } + + // create transaction + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + + tq := dq.WithTx(tx) + + // save first book + now := time.Now() + _, err = tq.CreateBook(ctx, CreateBookParams{ + AuthorID: a.AuthorID, + Isbn: "1", + Title: "my book title", + BookType: BooksBookTypeFICTION, + Yr: 2016, + Available: now, + Tag: "", + }) + if err != nil { + t.Fatal(err) + } + + // save second book + b1, err := tq.CreateBook(ctx, CreateBookParams{ + AuthorID: a.AuthorID, + Isbn: "2", + Title: "the second book", + BookType: BooksBookTypeFICTION, + Yr: 2016, + Available: now, + Tag: "unique", + }) + if err != nil { + t.Fatal(err) + } + + // update the title and tags + err = tq.UpdateBook(ctx, UpdateBookParams{ + BookID: b1.BookID, + Title: "changed second title", + Tag: "disastor", + }) + if err != nil { + t.Fatal(err) + } + + // save third book + _, err = tq.CreateBook(ctx, CreateBookParams{ + AuthorID: a.AuthorID, + Isbn: "3", + Title: "the third book", + BookType: BooksBookTypeFICTION, + Yr: 2001, + Available: now, + Tag: "cool", + }) + if err != nil { + t.Fatal(err) + } + + // save fourth book + b3, err := tq.CreateBook(ctx, CreateBookParams{ + AuthorID: a.AuthorID, + Isbn: "4", + Title: "4th place finisher", + BookType: BooksBookTypeFICTION, + Yr: 2011, + Available: now, + Tag: "other", + }) + if err != nil { + t.Fatal(err) + } + + // tx commit + err = tx.Commit() + if err != nil { + t.Fatal(err) + } + + // upsert, changing ISBN and title + err = dq.UpdateBookISBN(ctx, UpdateBookISBNParams{ + BookID: b3.BookID, + Isbn: "NEW ISBN", + Title: "never ever gonna finish, a quatrain", + Tag: "someother", + }) + if err != nil { + t.Fatal(err) + } + + // retrieve first book + books0, err := dq.BooksByTitleYear(ctx, BooksByTitleYearParams{ + Title: "my book title", + Yr: 2016, + }) + if err != nil { + 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)) + author, err := dq.GetAuthor(ctx, book.AuthorID) + if err != nil { + t.Fatal(err) + } + t.Logf("Book %d author: %s\n", book.BookID, author.Name) + } + + // find a book with either "cool" or "other" or "someother" tag + t.Logf("---------\nTag search results:\n") + res, err := dq.BooksByTags(ctx, []string{"cool", "other", "someother"}) + if err != nil { + t.Fatal(err) + } + for _, ab := range res { + t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tag: '%v'\n", ab.BookID, ab.Title, ab.Name.String, ab.Isbn, ab.Tag) + } + + // TODO: call say_hello(varchar) + + // get book 4 and delete + b5, err := dq.GetBook(ctx, b3.BookID) + if err != nil { + t.Fatal(err) + } + if err := dq.DeleteBook(ctx, b5.BookID); err != nil { + t.Fatal(err) + } + +} diff --git a/examples/booktest/sqlite/models.go b/examples/booktest/sqlite/models.go new file mode 100644 index 0000000000..11bfe05d99 --- /dev/null +++ b/examples/booktest/sqlite/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package booktest + +import ( + "time" +) + +type Author struct { + AuthorID int64 + Name string +} + +type Book struct { + BookID int64 + AuthorID int64 + Isbn string + BookType string + Title string + Yr int64 + Available time.Time + Tag string +} diff --git a/examples/booktest/sqlite/query.sql b/examples/booktest/sqlite/query.sql new file mode 100644 index 0000000000..4022c7ea53 --- /dev/null +++ b/examples/booktest/sqlite/query.sql @@ -0,0 +1,64 @@ +/* name: GetAuthor :one */ +SELECT * FROM authors +WHERE author_id = ?; + +/* name: GetBook :one */ +SELECT * FROM books +WHERE book_id = ?; + +/* name: DeleteBook :exec */ +DELETE FROM books +WHERE book_id = ?; + +/* name: BooksByTitleYear :many */ +SELECT * FROM books +WHERE title = ? AND yr = ?; + +/* name: BooksByTags :many */ +SELECT + book_id, + title, + name, + isbn, + tag +FROM books +LEFT JOIN authors ON books.author_id = authors.author_id +WHERE tag IN (sqlc.slice(tags)); + +/* name: CreateAuthor :one */ +INSERT INTO authors (name) VALUES (?) +RETURNING *; + +/* name: CreateBook :one */ +INSERT INTO books ( + author_id, + isbn, + book_type, + title, + yr, + available, + tag +) VALUES ( + ?, + ?, + ?, + ?, + ?, + ?, + ? +) +RETURNING *; + +/* name: UpdateBook :exec */ +UPDATE books +SET title = ?1, tag = ?2 +WHERE book_id = ?3; + +/* name: UpdateBookISBN :exec */ +UPDATE books +SET title = ?1, tag = ?2, isbn = ?4 +WHERE book_id = ?3; + +/* name: DeleteAuthorBeforeYear :exec */ +DELETE FROM books +WHERE yr < ? AND author_id = ?; diff --git a/examples/booktest/sqlite/query.sql.go b/examples/booktest/sqlite/query.sql.go new file mode 100644 index 0000000000..435399a965 --- /dev/null +++ b/examples/booktest/sqlite/query.sql.go @@ -0,0 +1,279 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package booktest + +import ( + "context" + "database/sql" + "strings" + "time" +) + +const booksByTags = `-- name: BooksByTags :many +SELECT + book_id, + title, + name, + isbn, + tag +FROM books +LEFT JOIN authors ON books.author_id = authors.author_id +WHERE tag IN (/*SLICE:tags*/?) +` + +type BooksByTagsRow struct { + BookID int64 + Title string + Name sql.NullString + Isbn string + Tag string +} + +func (q *Queries) BooksByTags(ctx context.Context, tags []string) ([]BooksByTagsRow, error) { + query := booksByTags + var queryParams []interface{} + if len(tags) > 0 { + for _, v := range tags { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:tags*/?", strings.Repeat(",?", len(tags))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:tags*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BooksByTagsRow + for rows.Next() { + var i BooksByTagsRow + if err := rows.Scan( + &i.BookID, + &i.Title, + &i.Name, + &i.Isbn, + &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 booksByTitleYear = `-- name: BooksByTitleYear :many +SELECT book_id, author_id, isbn, book_type, title, yr, available, tag FROM books +WHERE title = ? AND yr = ? +` + +type BooksByTitleYearParams struct { + Title string + Yr int64 +} + +func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { + rows, err := q.db.QueryContext(ctx, booksByTitleYear, arg.Title, arg.Yr) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Book + for rows.Next() { + var i Book + if err := rows.Scan( + &i.BookID, + &i.AuthorID, + &i.Isbn, + &i.BookType, + &i.Title, + &i.Yr, + &i.Available, + &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 createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (name) VALUES (?) +RETURNING author_id, name +` + +func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, name) + var i Author + err := row.Scan(&i.AuthorID, &i.Name) + return i, err +} + +const createBook = `-- name: CreateBook :one +INSERT INTO books ( + author_id, + isbn, + book_type, + title, + yr, + available, + tag +) VALUES ( + ?, + ?, + ?, + ?, + ?, + ?, + ? +) +RETURNING book_id, author_id, isbn, book_type, title, yr, available, tag +` + +type CreateBookParams struct { + AuthorID int64 + Isbn string + BookType string + Title string + Yr int64 + Available time.Time + Tag string +} + +func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) { + row := q.db.QueryRowContext(ctx, createBook, + arg.AuthorID, + arg.Isbn, + arg.BookType, + arg.Title, + arg.Yr, + arg.Available, + arg.Tag, + ) + var i Book + err := row.Scan( + &i.BookID, + &i.AuthorID, + &i.Isbn, + &i.BookType, + &i.Title, + &i.Yr, + &i.Available, + &i.Tag, + ) + return i, err +} + +const deleteAuthorBeforeYear = `-- name: DeleteAuthorBeforeYear :exec +DELETE FROM books +WHERE yr < ? AND author_id = ? +` + +type DeleteAuthorBeforeYearParams struct { + Yr int64 + AuthorID int64 +} + +func (q *Queries) DeleteAuthorBeforeYear(ctx context.Context, arg DeleteAuthorBeforeYearParams) error { + _, err := q.db.ExecContext(ctx, deleteAuthorBeforeYear, arg.Yr, arg.AuthorID) + return err +} + +const deleteBook = `-- name: DeleteBook :exec +DELETE FROM books +WHERE book_id = ? +` + +func (q *Queries) DeleteBook(ctx context.Context, bookID int64) error { + _, err := q.db.ExecContext(ctx, deleteBook, bookID) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT author_id, name FROM authors +WHERE author_id = ? +` + +func (q *Queries) GetAuthor(ctx context.Context, authorID int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, authorID) + var i Author + err := row.Scan(&i.AuthorID, &i.Name) + return i, err +} + +const getBook = `-- name: GetBook :one +SELECT book_id, author_id, isbn, book_type, title, yr, available, tag FROM books +WHERE book_id = ? +` + +func (q *Queries) GetBook(ctx context.Context, bookID int64) (Book, error) { + row := q.db.QueryRowContext(ctx, getBook, bookID) + var i Book + err := row.Scan( + &i.BookID, + &i.AuthorID, + &i.Isbn, + &i.BookType, + &i.Title, + &i.Yr, + &i.Available, + &i.Tag, + ) + return i, err +} + +const updateBook = `-- name: UpdateBook :exec +UPDATE books +SET title = ?1, tag = ?2 +WHERE book_id = ?3 +` + +type UpdateBookParams struct { + Title string + Tag string + BookID int64 +} + +func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { + _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.Tag, arg.BookID) + return err +} + +const updateBookISBN = `-- name: UpdateBookISBN :exec +UPDATE books +SET title = ?1, tag = ?2, isbn = ?4 +WHERE book_id = ?3 +` + +type UpdateBookISBNParams struct { + Title string + Tag string + BookID int64 + Isbn string +} + +func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { + _, err := q.db.ExecContext(ctx, updateBookISBN, + arg.Title, + arg.Tag, + arg.BookID, + arg.Isbn, + ) + return err +} diff --git a/examples/booktest/sqlite/schema.sql b/examples/booktest/sqlite/schema.sql new file mode 100644 index 0000000000..fe47c9d0d6 --- /dev/null +++ b/examples/booktest/sqlite/schema.sql @@ -0,0 +1,20 @@ +CREATE TABLE authors ( + author_id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + name text NOT NULL +); + +CREATE INDEX authors_name_idx ON authors(name); + +CREATE TABLE books ( + book_id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + author_id integer NOT NULL, + isbn varchar(255) NOT NULL DEFAULT '' UNIQUE, + book_type text NOT NULL DEFAULT 'FICTION', + title text NOT NULL, + yr integer NOT NULL DEFAULT 2000, + available datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + tag text NOT NULL, + CHECK (book_type = 'FICTION' OR book_type = 'NONFICTION') +); + +CREATE INDEX books_title_idx ON books(title, yr); diff --git a/examples/jets/db.go b/examples/jets/db.go deleted file mode 100644 index 2a9cc0bc83..0000000000 --- a/examples/jets/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package jets - -import ( - "context" - "database/sql" -) - -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 -} - -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/jets/models.go b/examples/jets/models.go deleted file mode 100644 index 7bc33b6bda..0000000000 --- a/examples/jets/models.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package jets - -import () - -type Jet struct { - ID int32 - PilotID int32 - Age int32 - Name string - Color string -} - -type Language struct { - ID int32 - Language string -} - -type Pilot struct { - ID int32 - Name string -} - -type PilotLanguage struct { - PilotID int32 - LanguageID int32 -} diff --git a/examples/jets/postgresql/db.go b/examples/jets/postgresql/db.go new file mode 100644 index 0000000000..bccada1806 --- /dev/null +++ b/examples/jets/postgresql/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package jets + +import ( + "context" + + "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 +} + +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/examples/jets/postgresql/models.go b/examples/jets/postgresql/models.go new file mode 100644 index 0000000000..166bf06f3d --- /dev/null +++ b/examples/jets/postgresql/models.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package jets + +type Jet struct { + ID int32 + PilotID int32 + Age int32 + Name string + Color string +} + +type Language struct { + ID int32 + Language string +} + +type Pilot struct { + ID int32 + Name string +} + +type PilotLanguage struct { + PilotID int32 + LanguageID int32 +} diff --git a/examples/jets/query-building.sql b/examples/jets/postgresql/query-building.sql similarity index 100% rename from examples/jets/query-building.sql rename to examples/jets/postgresql/query-building.sql diff --git a/examples/jets/query-building.sql.go b/examples/jets/postgresql/query-building.sql.go similarity index 81% rename from examples/jets/query-building.sql.go rename to examples/jets/postgresql/query-building.sql.go index 5fd138f816..0697bc12bc 100644 --- a/examples/jets/query-building.sql.go +++ b/examples/jets/postgresql/query-building.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query-building.sql package jets @@ -12,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 @@ -23,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 } @@ -32,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 } @@ -45,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/schema.sql b/examples/jets/postgresql/schema.sql similarity index 100% rename from examples/jets/schema.sql rename to examples/jets/postgresql/schema.sql diff --git a/examples/jets/sqlc.json b/examples/jets/sqlc.json index 0bca6f48df..8dfa0df777 100644 --- a/examples/jets/sqlc.json +++ b/examples/jets/sqlc.json @@ -1,12 +1,25 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { - "path": ".", + "path": "postgresql", "name": "jets", - "schema": "schema.sql", - "queries": "query-building.sql", - "engine": "postgresql" + "schema": "postgresql/schema.sql", + "queries": "postgresql/query-building.sql", + "engine": "postgresql", + "sql_package": "pgx/v5", + "database": { + "uri": "${VET_TEST_EXAMPLES_POSTGRES_JETS}" + }, + "analyzer": { + "database": false + }, + "rules": [ + "sqlc/db-prepare" + ] } ] } 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 f7f8f0b61d..0000000000 --- a/examples/kotlin/sqlc.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "version": "2", - "sql": [ - { - "schema": "src/main/resources/authors/postgresql/schema.sql", - "queries": "src/main/resources/authors/postgresql/query.sql", - "engine": "postgresql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/authors/postgresql", - "package": "com.example.authors.postgresql" - } - } - }, - { - "schema": "src/main/resources/ondeck/postgresql/schema", - "queries": "src/main/resources/ondeck/postgresql/query", - "engine": "postgresql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/ondeck/postgresql", - "package": "com.example.ondeck.postgresql" - } - } - }, - { - "schema": "src/main/resources/jets/schema.sql", - "queries": "src/main/resources/jets/query-building.sql", - "engine": "postgresql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/jets", - "package": "com.example.jets" - } - } - }, - { - "schema": "src/main/resources/booktest/postgresql/schema.sql", - "queries": "src/main/resources/booktest/postgresql/query.sql", - "engine": "postgresql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/booktest/postgresql", - "package": "com.example.booktest.postgresql" - } - } - }, - { - "schema": "src/main/resources/authors/mysql/schema.sql", - "queries": "src/main/resources/authors/mysql/query.sql", - "engine": "mysql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/authors/mysql", - "package": "com.example.authors.mysql" - } - } - }, - { - "schema": "src/main/resources/booktest/mysql/schema.sql", - "queries": "src/main/resources/booktest/mysql/query.sql", - "engine": "mysql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/booktest/mysql", - "package": "com.example.booktest.mysql" - } - } - }, - { - "schema": "src/main/resources/ondeck/mysql/schema", - "queries": "src/main/resources/ondeck/mysql/query", - "engine": "mysql", - "gen": { - "kotlin": { - "out": "src/main/kotlin/com/example/ondeck/mysql", - "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 147ffd7063..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 0eaada1617..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 e8efb7c0bb..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 c919f666e5..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 6598aabeda..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 a9a813d082..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 ba78981fbc..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 b6e712fea0..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 e1012d8c42..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt +++ /dev/null @@ -1,276 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 d2dff24e4a..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 4416dbd24c..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 f65e6def25..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,280 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 d2bced3778..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 7f53ec868d..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 717beb6082..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 5bbfd046ce..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package com.example.ondeck.mysql - -import java.sql.Timestamp -import java.time.Instant - -enum class VenuesStatus(val value: String) { - OPEN("open"), - CLOSED("closed"); - - companion object { - private val map = VenuesStatus.values().associateBy(VenuesStatus::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: VenuesStatus, - 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 005299ea8a..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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: VenuesStatus, - 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 a30b7564c5..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt +++ /dev/null @@ -1,276 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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: VenuesStatus, - 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), - VenuesStatus.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), - VenuesStatus.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 e86b4e8ce4..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 31bde13c9c..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 4c4e07589d..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -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 e946157bab..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 = VenuesStatus.OPEN, - statuses = listOf(VenuesStatus.OPEN, VenuesStatus.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 fa7872b273..b1476a1c44 100644 --- a/examples/ondeck/mysql/city.sql.go +++ b/examples/ondeck/mysql/city.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: city.sql package ondeck diff --git a/examples/ondeck/mysql/db.go b/examples/ondeck/mysql/db.go index 834ca6c41a..273ff8b8cf 100644 --- a/examples/ondeck/mysql/db.go +++ b/examples/ondeck/mysql/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/mysql/db_test.go b/examples/ondeck/mysql/db_test.go index cd4d215c65..6ac70aaf06 100644 --- a/examples/ondeck/mysql/db_test.go +++ b/examples/ondeck/mysql/db_test.go @@ -1,4 +1,4 @@ -// +build examples +//go:build examples package ondeck @@ -8,9 +8,10 @@ import ( "strings" "testing" - "github.com/kyleconroy/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 { @@ -44,8 +45,8 @@ func runOnDeckQueries(t *testing.T, q *Queries) { Name: "The Fillmore", City: city.Slug, SpotifyPlaylist: "spotify:uri", - Status: VenuesStatusOpen, - Statuses: join(string(VenuesStatusOpen), string(VenuesStatusClosed)), + Status: VenueStatusOpen, + Statuses: join(string(VenueStatusOpen), string(VenueStatusClosed)), Tags: join("rock", "punk"), }) if err != nil { @@ -64,7 +65,7 @@ func runOnDeckQueries(t *testing.T, q *Queries) { t.Fatal(err) } - if diff := cmp.Diff(venue.ID, venueID); diff != "" { + if diff := cmp.Diff(venue.ID, uint64(venueID)); diff != "" { t.Errorf("venue ID mismatch:\n%s", diff) } @@ -142,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) } @@ -156,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 de624f272b..aab664813c 100644 --- a/examples/ondeck/mysql/models.go +++ b/examples/ondeck/mysql/models.go @@ -1,32 +1,58 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package ondeck import ( "database/sql" + "database/sql/driver" "fmt" "time" ) -type VenuesStatus string +type VenueStatus string const ( - VenuesStatusOpen VenuesStatus = "open" - VenuesStatusClosed VenuesStatus = "closed" + VenueStatusOpen VenueStatus = "open" + VenueStatusClosed VenueStatus = "closed" ) -func (e *VenuesStatus) Scan(src interface{}) error { +func (e *VenueStatus) Scan(src interface{}) error { switch s := src.(type) { case []byte: - *e = VenuesStatus(s) + *e = VenueStatus(s) case string: - *e = VenuesStatus(s) + *e = VenueStatus(s) default: - return fmt.Errorf("unsupported scan type for VenuesStatus: %T", src) + return fmt.Errorf("unsupported scan type for VenueStatus: %T", src) } return nil } +type NullVenueStatus struct { + VenueStatus VenueStatus `json:"venue_status"` + Valid bool `json:"valid"` // Valid is true if VenueStatus is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullVenueStatus) Scan(value interface{}) error { + if value == nil { + ns.VenueStatus, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.VenueStatus.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullVenueStatus) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.VenueStatus), nil +} + type City struct { Slug string `json:"slug"` Name string `json:"name"` @@ -34,9 +60,9 @@ type City struct { // Venues are places where muisc happens type Venue struct { - ID int64 `json:"id"` + ID uint64 `json:"id"` // Venues can be either open or closed - Status VenuesStatus `json:"status"` + Status VenueStatus `json:"status"` Statuses sql.NullString `json:"statuses"` // This value appears in public URLs Slug string `json:"slug"` diff --git a/examples/ondeck/mysql/querier.go b/examples/ondeck/mysql/querier.go index a307753262..68b2ff51e8 100644 --- a/examples/ondeck/mysql/querier.go +++ b/examples/ondeck/mysql/querier.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 d9ff409919..9d598b8116 100644 --- a/examples/ondeck/mysql/venue.sql.go +++ b/examples/ondeck/mysql/venue.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: venue.sql package ondeck @@ -35,7 +37,7 @@ type CreateVenueParams struct { Name string `json:"name"` City string `json:"city"` SpotifyPlaylist string `json:"spotify_playlist"` - Status VenuesStatus `json:"status"` + Status VenueStatus `json:"status"` Statuses sql.NullString `json:"statuses"` Tags sql.NullString `json:"tags"` } diff --git a/examples/ondeck/postgresql/city.sql.go b/examples/ondeck/postgresql/city.sql.go index c98920d155..306e76f643 100644 --- a/examples/ondeck/postgresql/city.sql.go +++ b/examples/ondeck/postgresql/city.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: city.sql package ondeck diff --git a/examples/ondeck/postgresql/db.go b/examples/ondeck/postgresql/db.go index 834ca6c41a..273ff8b8cf 100644 --- a/examples/ondeck/postgresql/db.go +++ b/examples/ondeck/postgresql/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/postgresql/db_test.go b/examples/ondeck/postgresql/db_test.go index 733c4fe6a3..6d2fba6714 100644 --- a/examples/ondeck/postgresql/db_test.go +++ b/examples/ondeck/postgresql/db_test.go @@ -1,14 +1,16 @@ -// +build examples +//go:build examples package ondeck import ( "context" + "database/sql" "testing" - "github.com/kyleconroy/sqlc/internal/sqltest" - "github.com/google/go-cmp/cmp" + _ "github.com/lib/pq" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func runOnDeckQueries(t *testing.T, q *Queries) { @@ -123,10 +125,14 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema"}) - defer cleanup() + uri := local.PostgreSQL(t, []string{"schema"}) + db, err := sql.Open("postgres", 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) } @@ -137,8 +143,12 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema"}) - defer cleanup() + uri := local.PostgreSQL(t, []string{"schema"}) + db, err := sql.Open("postgres", 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/postgresql/models.go b/examples/ondeck/postgresql/models.go index 5bc596c551..0b1e4ef06c 100644 --- a/examples/ondeck/postgresql/models.go +++ b/examples/ondeck/postgresql/models.go @@ -1,9 +1,12 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package ondeck import ( "database/sql" + "database/sql/driver" "fmt" "time" ) @@ -28,6 +31,29 @@ func (e *Status) Scan(src interface{}) error { return nil } +type NullStatus struct { + Status Status `json:"status"` + Valid bool `json:"valid"` // Valid is true if Status is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullStatus) Scan(value interface{}) 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 City struct { Slug string `json:"slug"` Name string `json:"name"` diff --git a/examples/ondeck/postgresql/querier.go b/examples/ondeck/postgresql/querier.go index da7db09378..a6685141a2 100644 --- a/examples/ondeck/postgresql/querier.go +++ b/examples/ondeck/postgresql/querier.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package ondeck @@ -7,6 +9,9 @@ import ( ) type Querier interface { + // Create a new city. The slug must be unique. + // This is the second line of the comment + // This is the third line CreateCity(ctx context.Context, arg CreateCityParams) (City, error) CreateVenue(ctx context.Context, arg CreateVenueParams) (int32, error) DeleteVenue(ctx context.Context, slug string) error diff --git a/examples/ondeck/postgresql/venue.sql.go b/examples/ondeck/postgresql/venue.sql.go index e81d10a244..e3134010ca 100644 --- a/examples/ondeck/postgresql/venue.sql.go +++ b/examples/ondeck/postgresql/venue.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: venue.sql package ondeck diff --git a/examples/ondeck/sqlc.json b/examples/ondeck/sqlc.json index 31f8e821b0..7b97328b3f 100644 --- a/examples/ondeck/sqlc.json +++ b/examples/ondeck/sqlc.json @@ -1,5 +1,8 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "path": "postgresql", @@ -7,16 +10,48 @@ "schema": "postgresql/schema", "queries": "postgresql/query", "engine": "postgresql", + "sql_package": "database/sql", + "database": { + "uri": "${VET_TEST_EXAMPLES_POSTGRES_ONDECK}" + }, + "analyzer": { + "database": false + }, + "rules": [ + "sqlc/db-prepare" + ], "emit_json_tags": true, "emit_prepared_queries": true, "emit_interface": true }, { - "path": "mysql", + "path": "mysql", "name": "ondeck", "schema": "mysql/schema", "queries": "mysql/query", "engine": "mysql", + "database": { + "uri": "${VET_TEST_EXAMPLES_MYSQL_ONDECK}" + }, + "rules": [ + "sqlc/db-prepare" + ], + "emit_json_tags": true, + "emit_prepared_queries": true, + "emit_interface": true + }, + { + "path": "sqlite", + "name": "ondeck", + "schema": "sqlite/schema", + "queries": "sqlite/query", + "engine": "sqlite", + "database": { + "uri": "file:ondeck?mode=memory&cache=shared" + }, + "rules": [ + "sqlc/db-prepare" + ], "emit_json_tags": true, "emit_prepared_queries": true, "emit_interface": true diff --git a/examples/ondeck/sqlite/city.sql.go b/examples/ondeck/sqlite/city.sql.go new file mode 100644 index 0000000000..b1476a1c44 --- /dev/null +++ b/examples/ondeck/sqlite/city.sql.go @@ -0,0 +1,88 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: city.sql + +package ondeck + +import ( + "context" +) + +const createCity = `-- name: CreateCity :exec +INSERT INTO city ( + name, + slug +) VALUES ( + ?, + ? +) +` + +type CreateCityParams struct { + Name string `json:"name"` + Slug string `json:"slug"` +} + +func (q *Queries) CreateCity(ctx context.Context, arg CreateCityParams) error { + _, err := q.exec(ctx, q.createCityStmt, createCity, arg.Name, arg.Slug) + return err +} + +const getCity = `-- name: GetCity :one +SELECT slug, name +FROM city +WHERE slug = ? +` + +func (q *Queries) GetCity(ctx context.Context, slug string) (City, error) { + row := q.queryRow(ctx, q.getCityStmt, getCity, slug) + var i City + err := row.Scan(&i.Slug, &i.Name) + return i, err +} + +const listCities = `-- name: ListCities :many +SELECT slug, name +FROM city +ORDER BY name +` + +func (q *Queries) ListCities(ctx context.Context) ([]City, error) { + rows, err := q.query(ctx, q.listCitiesStmt, listCities) + if err != nil { + return nil, err + } + defer rows.Close() + var items []City + for rows.Next() { + var i City + if err := rows.Scan(&i.Slug, &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 updateCityName = `-- name: UpdateCityName :exec +UPDATE city +SET name = ? +WHERE slug = ? +` + +type UpdateCityNameParams struct { + Name string `json:"name"` + Slug string `json:"slug"` +} + +func (q *Queries) UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error { + _, err := q.exec(ctx, q.updateCityNameStmt, updateCityName, arg.Name, arg.Slug) + return err +} diff --git a/examples/ondeck/sqlite/db.go b/examples/ondeck/sqlite/db.go new file mode 100644 index 0000000000..273ff8b8cf --- /dev/null +++ b/examples/ondeck/sqlite/db.go @@ -0,0 +1,178 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package ondeck + +import ( + "context" + "database/sql" + "fmt" +) + +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 +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +func Prepare(ctx context.Context, db DBTX) (*Queries, error) { + q := Queries{db: db} + var err error + if q.createCityStmt, err = db.PrepareContext(ctx, createCity); err != nil { + return nil, fmt.Errorf("error preparing query CreateCity: %w", err) + } + if q.createVenueStmt, err = db.PrepareContext(ctx, createVenue); err != nil { + return nil, fmt.Errorf("error preparing query CreateVenue: %w", err) + } + if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenue); err != nil { + return nil, fmt.Errorf("error preparing query DeleteVenue: %w", err) + } + if q.getCityStmt, err = db.PrepareContext(ctx, getCity); err != nil { + return nil, fmt.Errorf("error preparing query GetCity: %w", err) + } + if q.getVenueStmt, err = db.PrepareContext(ctx, getVenue); err != nil { + return nil, fmt.Errorf("error preparing query GetVenue: %w", err) + } + if q.listCitiesStmt, err = db.PrepareContext(ctx, listCities); err != nil { + return nil, fmt.Errorf("error preparing query ListCities: %w", err) + } + if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenues); err != nil { + return nil, fmt.Errorf("error preparing query ListVenues: %w", err) + } + if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityName); err != nil { + return nil, fmt.Errorf("error preparing query UpdateCityName: %w", err) + } + if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueName); err != nil { + return nil, fmt.Errorf("error preparing query UpdateVenueName: %w", err) + } + if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCity); err != nil { + return nil, fmt.Errorf("error preparing query VenueCountByCity: %w", err) + } + return &q, nil +} + +func (q *Queries) Close() error { + var err error + if q.createCityStmt != nil { + if cerr := q.createCityStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing createCityStmt: %w", cerr) + } + } + if q.createVenueStmt != nil { + if cerr := q.createVenueStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing createVenueStmt: %w", cerr) + } + } + if q.deleteVenueStmt != nil { + if cerr := q.deleteVenueStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing deleteVenueStmt: %w", cerr) + } + } + if q.getCityStmt != nil { + if cerr := q.getCityStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing getCityStmt: %w", cerr) + } + } + if q.getVenueStmt != nil { + if cerr := q.getVenueStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing getVenueStmt: %w", cerr) + } + } + if q.listCitiesStmt != nil { + if cerr := q.listCitiesStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing listCitiesStmt: %w", cerr) + } + } + if q.listVenuesStmt != nil { + if cerr := q.listVenuesStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing listVenuesStmt: %w", cerr) + } + } + if q.updateCityNameStmt != nil { + if cerr := q.updateCityNameStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing updateCityNameStmt: %w", cerr) + } + } + if q.updateVenueNameStmt != nil { + if cerr := q.updateVenueNameStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing updateVenueNameStmt: %w", cerr) + } + } + if q.venueCountByCityStmt != nil { + if cerr := q.venueCountByCityStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing venueCountByCityStmt: %w", cerr) + } + } + return err +} + +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) + case stmt != nil: + return stmt.ExecContext(ctx, args...) + default: + return q.db.ExecContext(ctx, query, args...) + } +} + +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) + case stmt != nil: + return stmt.QueryContext(ctx, args...) + default: + return q.db.QueryContext(ctx, query, args...) + } +} + +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) + case stmt != nil: + return stmt.QueryRowContext(ctx, args...) + default: + return q.db.QueryRowContext(ctx, query, args...) + } +} + +type Queries struct { + db DBTX + tx *sql.Tx + createCityStmt *sql.Stmt + createVenueStmt *sql.Stmt + deleteVenueStmt *sql.Stmt + getCityStmt *sql.Stmt + getVenueStmt *sql.Stmt + listCitiesStmt *sql.Stmt + listVenuesStmt *sql.Stmt + updateCityNameStmt *sql.Stmt + updateVenueNameStmt *sql.Stmt + venueCountByCityStmt *sql.Stmt +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + tx: tx, + createCityStmt: q.createCityStmt, + createVenueStmt: q.createVenueStmt, + deleteVenueStmt: q.deleteVenueStmt, + getCityStmt: q.getCityStmt, + getVenueStmt: q.getVenueStmt, + listCitiesStmt: q.listCitiesStmt, + listVenuesStmt: q.listVenuesStmt, + updateCityNameStmt: q.updateCityNameStmt, + updateVenueNameStmt: q.updateVenueNameStmt, + venueCountByCityStmt: q.venueCountByCityStmt, + } +} diff --git a/examples/ondeck/sqlite/db_test.go b/examples/ondeck/sqlite/db_test.go new file mode 100644 index 0000000000..e4bb4e4195 --- /dev/null +++ b/examples/ondeck/sqlite/db_test.go @@ -0,0 +1,171 @@ +//go:build examples + +package ondeck + +import ( + "context" + "database/sql" + "strings" + "testing" + + "github.com/sqlc-dev/sqlc/internal/sqltest" + + "github.com/google/go-cmp/cmp" +) + +// TODO: Enum is not yet supported +const ( + VenuesStatusOpen string = "open" + VenuesStatusClosed string = "closed" +) + +func join(vals ...string) sql.NullString { + if len(vals) == 0 { + return sql.NullString{} + } + return sql.NullString{ + Valid: true, + String: strings.Join(vals, ","), + } +} + +func runOnDeckQueries(t *testing.T, q *Queries) { + ctx := context.Background() + + err := q.CreateCity(ctx, CreateCityParams{ + Slug: "san-francisco", + Name: "San Francisco", + }) + if err != nil { + t.Fatal(err) + } + + city, err := q.GetCity(ctx, "san-francisco") + if err != nil { + t.Fatal(err) + } + + venueResult, err := q.CreateVenue(ctx, CreateVenueParams{ + Slug: "the-fillmore", + Name: "The Fillmore", + City: city.Slug, + SpotifyPlaylist: "spotify:uri", + Status: VenuesStatusOpen, + Statuses: join(string(VenuesStatusOpen), string(VenuesStatusClosed)), + Tags: join("rock", "punk"), + }) + if err != nil { + t.Fatal(err) + } + venueID, err := venueResult.LastInsertId() + if err != nil { + t.Fatal(err) + } + + venue, err := q.GetVenue(ctx, GetVenueParams{ + Slug: "the-fillmore", + City: city.Slug, + }) + if err != nil { + t.Fatal(err) + } + + if diff := cmp.Diff(venue.ID, venueID); diff != "" { + t.Errorf("venue ID mismatch:\n%s", diff) + } + + { + actual, err := q.VenueCountByCity(ctx) + if err != nil { + t.Error(err) + } + if diff := cmp.Diff(actual, []VenueCountByCityRow{ + {city.Slug, int64(1)}, + }); diff != "" { + t.Errorf("venue count mismatch:\n%s", diff) + } + } + + { + actual, err := q.ListCities(ctx) + if err != nil { + t.Error(err) + } + if diff := cmp.Diff(actual, []City{city}); diff != "" { + t.Errorf("list city mismatch:\n%s", diff) + } + } + + { + actual, err := q.ListVenues(ctx, city.Slug) + if err != nil { + t.Error(err) + } + if diff := cmp.Diff(actual, []Venue{venue}); diff != "" { + t.Errorf("list venue mismatch:\n%s", diff) + } + } + + { + err := q.UpdateCityName(ctx, UpdateCityNameParams{ + Slug: city.Slug, + Name: "SF", + }) + if err != nil { + t.Error(err) + } + } + + { + expected := "Fillmore" + err := q.UpdateVenueName(ctx, UpdateVenueNameParams{ + Slug: venue.Slug, + Name: expected, + }) + if err != nil { + t.Error(err) + } + fresh, err := q.GetVenue(ctx, GetVenueParams{ + Slug: venue.Slug, + City: city.Slug, + }) + if diff := cmp.Diff(expected, fresh.Name); diff != "" { + t.Errorf("update venue mismatch:\n%s", diff) + } + } + + { + err := q.DeleteVenue(ctx, DeleteVenueParams{ + Slug: venue.Slug, + Slug_2: venue.Slug, + }) + if err != nil { + t.Error(err) + } + } +} + +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) + if err != nil { + t.Fatal(err) + } + + runOnDeckQueries(t, q) +} + +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 new file mode 100644 index 0000000000..215fde338f --- /dev/null +++ b/examples/ondeck/sqlite/models.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package ondeck + +import ( + "database/sql" + "time" +) + +type City struct { + Slug string `json:"slug"` + Name string `json:"name"` +} + +type Venue struct { + ID int64 `json:"id"` + Status string `json:"status"` + Statuses sql.NullString `json:"statuses"` + Slug string `json:"slug"` + Name string `json:"name"` + City string `json:"city"` + SpotifyPlaylist string `json:"spotify_playlist"` + SongkickID sql.NullString `json:"songkick_id"` + Tags sql.NullString `json:"tags"` + CreatedAt time.Time `json:"created_at"` +} diff --git a/examples/ondeck/sqlite/querier.go b/examples/ondeck/sqlite/querier.go new file mode 100644 index 0000000000..68b2ff51e8 --- /dev/null +++ b/examples/ondeck/sqlite/querier.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package ondeck + +import ( + "context" + "database/sql" +) + +type Querier interface { + CreateCity(ctx context.Context, arg CreateCityParams) error + CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.Result, error) + DeleteVenue(ctx context.Context, arg DeleteVenueParams) error + GetCity(ctx context.Context, slug string) (City, error) + GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error) + ListCities(ctx context.Context) ([]City, error) + ListVenues(ctx context.Context, city string) ([]Venue, error) + UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error + UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) error + VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error) +} + +var _ Querier = (*Queries)(nil) diff --git a/examples/ondeck/sqlite/query/city.sql b/examples/ondeck/sqlite/query/city.sql new file mode 100644 index 0000000000..c387e9d000 --- /dev/null +++ b/examples/ondeck/sqlite/query/city.sql @@ -0,0 +1,23 @@ +/* name: ListCities :many */ +SELECT * +FROM city +ORDER BY name; + +/* name: GetCity :one */ +SELECT * +FROM city +WHERE slug = ?; + +/* name: CreateCity :exec */ +INSERT INTO city ( + name, + slug +) VALUES ( + ?, + ? +); + +/* name: UpdateCityName :exec */ +UPDATE city +SET name = ? +WHERE slug = ?; diff --git a/examples/ondeck/sqlite/query/venue.sql b/examples/ondeck/sqlite/query/venue.sql new file mode 100644 index 0000000000..b4f5fd4071 --- /dev/null +++ b/examples/ondeck/sqlite/query/venue.sql @@ -0,0 +1,48 @@ +/* name: ListVenues :many */ +SELECT * +FROM venue +WHERE city = ? +ORDER BY name; + +/* name: DeleteVenue :exec */ +DELETE FROM venue +WHERE slug = ? AND slug = ?; + +/* name: GetVenue :one */ +SELECT * +FROM venue +WHERE slug = ? AND city = ?; + +/* name: CreateVenue :execresult */ +INSERT INTO venue ( + slug, + name, + city, + created_at, + spotify_playlist, + status, + statuses, + tags +) VALUES ( + ?, + ?, + ?, + CURRENT_TIMESTAMP, + ?, + ?, + ?, + ? +); + +/* name: UpdateVenueName :exec */ +UPDATE venue +SET name = ? +WHERE slug = ?; + +/* name: VenueCountByCity :many */ +SELECT + city, + count(*) +FROM venue +GROUP BY 1 +ORDER BY 1; diff --git a/examples/ondeck/sqlite/schema/0001_city.sql b/examples/ondeck/sqlite/schema/0001_city.sql new file mode 100644 index 0000000000..6be35d16bf --- /dev/null +++ b/examples/ondeck/sqlite/schema/0001_city.sql @@ -0,0 +1,4 @@ +CREATE TABLE city ( + slug varchar(255) PRIMARY KEY, + name text NOT NULL +) diff --git a/examples/ondeck/sqlite/schema/0002_venue.sql b/examples/ondeck/sqlite/schema/0002_venue.sql new file mode 100644 index 0000000000..e57166e4c0 --- /dev/null +++ b/examples/ondeck/sqlite/schema/0002_venue.sql @@ -0,0 +1,13 @@ +CREATE TABLE venues ( + id integer primary key AUTOINCREMENT, + dropped text, + status text not null, + statuses text, -- status[] + slug text not null, + name varchar(255) not null, + city text not null references city(slug), + spotify_playlist varchar(255) not null, + songkick_id text, + tags text, -- tags[] + CHECK (status = 'open' OR status = 'closed') +); diff --git a/examples/ondeck/sqlite/schema/0003_add_column.sql b/examples/ondeck/sqlite/schema/0003_add_column.sql new file mode 100644 index 0000000000..7d7a6443b4 --- /dev/null +++ b/examples/ondeck/sqlite/schema/0003_add_column.sql @@ -0,0 +1,3 @@ +ALTER TABLE venues RENAME TO venue; +ALTER TABLE venue ADD COLUMN created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE venue DROP COLUMN dropped; diff --git a/examples/ondeck/sqlite/venue.sql.go b/examples/ondeck/sqlite/venue.sql.go new file mode 100644 index 0000000000..44f4f37705 --- /dev/null +++ b/examples/ondeck/sqlite/venue.sql.go @@ -0,0 +1,193 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: venue.sql + +package ondeck + +import ( + "context" + "database/sql" +) + +const createVenue = `-- name: CreateVenue :execresult +INSERT INTO venue ( + slug, + name, + city, + created_at, + spotify_playlist, + status, + statuses, + tags +) VALUES ( + ?, + ?, + ?, + CURRENT_TIMESTAMP, + ?, + ?, + ?, + ? +) +` + +type CreateVenueParams struct { + Slug string `json:"slug"` + Name string `json:"name"` + City string `json:"city"` + SpotifyPlaylist string `json:"spotify_playlist"` + Status string `json:"status"` + Statuses sql.NullString `json:"statuses"` + Tags sql.NullString `json:"tags"` +} + +func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.Result, error) { + return q.exec(ctx, q.createVenueStmt, createVenue, + arg.Slug, + arg.Name, + arg.City, + arg.SpotifyPlaylist, + arg.Status, + arg.Statuses, + arg.Tags, + ) +} + +const deleteVenue = `-- name: DeleteVenue :exec +DELETE FROM venue +WHERE slug = ? AND slug = ? +` + +type DeleteVenueParams struct { + Slug string `json:"slug"` + Slug_2 string `json:"slug_2"` +} + +func (q *Queries) DeleteVenue(ctx context.Context, arg DeleteVenueParams) error { + _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenue, arg.Slug, arg.Slug_2) + return err +} + +const getVenue = `-- name: GetVenue :one +SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at +FROM venue +WHERE slug = ? AND city = ? +` + +type GetVenueParams struct { + Slug string `json:"slug"` + City string `json:"city"` +} + +func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error) { + row := q.queryRow(ctx, q.getVenueStmt, getVenue, arg.Slug, arg.City) + var i Venue + err := row.Scan( + &i.ID, + &i.Status, + &i.Statuses, + &i.Slug, + &i.Name, + &i.City, + &i.SpotifyPlaylist, + &i.SongkickID, + &i.Tags, + &i.CreatedAt, + ) + return i, err +} + +const 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 +` + +func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) { + rows, err := q.query(ctx, q.listVenuesStmt, listVenues, city) + 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.Status, + &i.Statuses, + &i.Slug, + &i.Name, + &i.City, + &i.SpotifyPlaylist, + &i.SongkickID, + &i.Tags, + &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 updateVenueName = `-- name: UpdateVenueName :exec +UPDATE venue +SET name = ? +WHERE slug = ? +` + +type UpdateVenueNameParams struct { + Name string `json:"name"` + Slug string `json:"slug"` +} + +func (q *Queries) UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) error { + _, err := q.exec(ctx, q.updateVenueNameStmt, updateVenueName, arg.Name, arg.Slug) + return err +} + +const venueCountByCity = `-- name: VenueCountByCity :many +SELECT + city, + count(*) +FROM venue +GROUP BY 1 +ORDER BY 1 +` + +type VenueCountByCityRow struct { + City string `json:"city"` + Count int64 `json:"count"` +} + +func (q *Queries) VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error) { + rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCity) + if err != nil { + return nil, err + } + defer rows.Close() + var items []VenueCountByCityRow + for rows.Next() { + var i VenueCountByCityRow + if err := rows.Scan(&i.City, &i.Count); 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/go.mod b/go.mod index 4752ec3b86..86bfac9b13 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,66 @@ -module github.com/kyleconroy/sqlc +module github.com/sqlc-dev/sqlc -go 1.15 +go 1.24.7 require ( - github.com/antlr/antlr4 v0.0.0-20200209180723-1177c0b58d07 + github.com/antlr4-go/antlr/v4 v4.13.1 + github.com/cubicdaiya/gonp v1.0.4 github.com/davecgh/go-spew v1.1.1 - github.com/go-sql-driver/mysql v1.5.0 - github.com/google/go-cmp v0.5.4 - github.com/jackc/pgx/v4 v4.10.1 + github.com/fatih/structtag v1.2.0 + github.com/go-sql-driver/mysql v1.9.3 + github.com/google/cel-go v0.27.0 + github.com/google/go-cmp v0.7.0 + github.com/jackc/pgx/v4 v4.18.3 + github.com/jackc/pgx/v5 v5.8.0 github.com/jinzhu/inflection v1.0.0 - github.com/lfittl/pg_query_go v1.0.2 - github.com/lib/pq v1.9.0 - github.com/pingcap/parser v0.0.0-20201024025010-3b2fb4b41d73 - github.com/spf13/cobra v1.1.3 - github.com/spf13/pflag v1.0.5 - golang.org/x/tools v0.0.0-20191219041853-979b82bfef62 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 + github.com/lib/pq v1.11.1 + github.com/ncruces/go-sqlite3 v0.30.5 + github.com/pganalyze/pg_query_go/v6 v6.2.2 + github.com/pingcap/tidb/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0 + github.com/riza-io/grpc-go v0.2.0 + github.com/spf13/cobra v1.10.2 + github.com/spf13/pflag v1.0.10 + github.com/sqlc-dev/doubleclick v1.0.0 + github.com/tetratelabs/wazero v1.11.0 + github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 + github.com/xeipuuv/gojsonschema v1.2.0 + golang.org/x/sync v0.19.0 + google.golang.org/grpc v1.78.0 + google.golang.org/protobuf v1.36.11 + gopkg.in/yaml.v3 v3.0.1 ) + +require ( + cel.dev/expr v0.25.1 // indirect + filippo.io/edwards25519 v1.1.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.14.3 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.3 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgtype v1.14.0 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/ncruces/julianday v1.0.0 // indirect + github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb // indirect + github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect + github.com/pingcap/log v1.1.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/crypto v0.47.0 // indirect + golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect + golang.org/x/net v0.48.0 // indirect + golang.org/x/sys v0.40.0 // indirect + golang.org/x/text v0.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect +) + +replace github.com/go-sql-driver/mysql => github.com/sqlc-dev/mysql v0.0.0-20251129233104-d81e1cac6db2 diff --git a/go.sum b/go.sum index f01f5dd6b0..bdc05a80fa 100644 --- a/go.sum +++ b/go.sum @@ -1,116 +1,45 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +filippo.io/edwards25519 v1.1.1 h1:YpjwWWlNmGIDyXOn8zLzqiD+9TyIlPhGFG96P39uBpw= +filippo.io/edwards25519 v1.1.1/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/antlr/antlr4 v0.0.0-20200209180723-1177c0b58d07 h1:ylxsz+1ifp/XBbiaFMqhB5YKshU47EzuZWpUIiH8urY= -github.com/antlr/antlr4 v0.0.0-20200209180723-1177c0b58d07/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +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/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 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/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= 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/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/parser v0.0.0-20160622100904-31edd927e5b1/go.mod h1:2B43mz36vGZNZEwkWi8ayRSSUXLfjL8OkbzwW4NcPMM= -github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= -github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= -github.com/cznic/y v0.0.0-20170802143616-045f81c6662a/go.mod h1:1rk5VM7oSnA4vjp+hrLQ3HWHa+Y4yPCa3/CsJrcNnvs= +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/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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +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-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= -github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -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.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +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.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/cel-go v0.27.0 h1:e7ih85+4qVrBuqQWTW4FKSqZYokVuc3HnhH5keboFTo= +github.com/google/cel-go v0.27.0/go.mod h1:tTJ11FWqnhw5KKpnWpvW9CJC3Y9GK4EIS0WXnBbebzw= +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/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= +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/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= @@ -118,346 +47,266 @@ 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/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= -github.com/jackc/pgconn v1.8.0 h1:FmjZ0rOyXTr1wfWs45i4a9vjnjWUAGpMuQLD9OSs+lw= 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 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= 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.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8= github.com/jackc/pgproto3/v2 v2.0.6/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.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-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 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.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/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v4 v4.10.1 h1:/6Q3ye4myIj6AaplUm+eRcz4OhK9HAvFf4ePsG40LJY= -github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA= +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.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo= +github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw= 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/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/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= 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/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +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 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lfittl/pg_query_go v1.0.2 h1:adHtAAb0LpoXI3cYqdJTbo5W682+V9vg3/8ONAhnhqE= -github.com/lfittl/pg_query_go v1.0.2/go.mod h1:Ch/Oiv5pRI5jf9M7Hvf0XwCvFwa4PWRcNoFcLtVU8pc= +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.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/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.11.1 h1:wuChtj2hfsGmmx3nf1m7xC2XpK6OtelS2shMY+bGMtI= +github.com/lib/pq v1.11.1/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.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 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/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg= -github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= +github.com/ncruces/go-sqlite3 v0.30.5 h1:6usmTQ6khriL8oWilkAZSJM/AIpAlVL2zFrlcpDldCE= +github.com/ncruces/go-sqlite3 v0.30.5/go.mod h1:0I0JFflTKzfs3Ogfv8erP7CCoV/Z8uxigVDNOR0AQ5E= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= +github.com/pganalyze/pg_query_go/v6 v6.2.2 h1:O0L6zMC226R82RF3X5n0Ki6HjytDsoAzuzp4ATVAHNo= +github.com/pganalyze/pg_query_go/v6 v6.2.2/go.mod h1:Cn6+j4870kJz3iYNsb0VsNG04vpSWgEvBwc590J4qD0= github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.5-0.20201021055732-210aacd3fd99 h1:PVuEvTi/LlviMG7X3av44NRwcdPf0tiqL/YdVOIKCpA= -github.com/pingcap/errors v0.11.5-0.20201021055732-210aacd3fd99/go.mod h1:G7x87le1poQzLB/TqvTJI2ILrSgobnq4Ut7luOwvfvI= -github.com/pingcap/log v0.0.0-20200511115504-543df19646ad h1:SveG82rmu/GFxYanffxsSF503SiQV+2JLnWEiGiF+Tc= -github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= -github.com/pingcap/parser v0.0.0-20201024025010-3b2fb4b41d73 h1:MN/e9n6GUBmmi6sKtriW0Dv1dfIohZRoKr/ZU1B4jrM= -github.com/pingcap/parser v0.0.0-20201024025010-3b2fb4b41d73/go.mod h1:74+OEdwM4B/jMpBRl92ch6CSmSYkQtv2TNxIjFdT/GE= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb h1:3pSi4EDG6hg0orE1ndHkXvX6Qdq2cZn8gAPir8ymKZk= +github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= +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/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0 h1:W3rpAI3bubR6VWOcwxDIG0Gz9G5rl5b3SL116T0vBt0= +github.com/pingcap/tidb/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0/go.mod h1:+8feuexTKcXHZF/dkDfvCwEyBAmgb4paFc3/WeYV2eE= 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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +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/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +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/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= 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/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +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/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -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/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +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/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/mysql v0.0.0-20251129233104-d81e1cac6db2 h1:kmCAKKtOgK6EXXQX9oPdEASIhgor7TCpWxD8NtcqVcU= +github.com/sqlc-dev/mysql v0.0.0-20251129233104-d81e1cac6db2/go.mod h1:TrDMWzjNTKvJeK2GC8uspG+PWyPLiY9QKvwdWpAdlZE= 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/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 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA= +github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 h1:mJdDDPblDfPe7z7go8Dvv1AJQDI3eQ/5xith3q2mFlo= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07/go.mod h1:Ak17IJ037caFp4jpCw/iQQ7/W74Sqpb1YuKJU6HTKfM= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= +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/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +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/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= 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 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= 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.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= +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 h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= +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.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= -go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= 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-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= +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.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= +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/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -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-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/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-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 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/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/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-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.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/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 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +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.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= +golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= 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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/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-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191219041853-979b82bfef62 h1:vDaiisQl0rGVXqk3wT2yc43gSnwlj4haEG5J78IGZP4= -golang.org/x/tools v0.0.0-20191219041853-979b82bfef62/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda h1:+2XxjfsAu6vqFxwGBRcHiMaDCuZiqXGDUDVWVtrFAnE= +google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= +google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/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 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -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/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 h1:Xe2gvTZUJpsvOWUnvmL/tmhVBZUmHSvLbMjRj6NUUKo= -gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71/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-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +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= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 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 new file mode 100644 index 0000000000..674f283db9 --- /dev/null +++ b/internal/analyzer/analyzer.go @@ -0,0 +1,130 @@ +package analyzer + +import ( + "context" + "encoding/json" + "fmt" + "hash/fnv" + "log/slog" + "os" + "path/filepath" + + "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/info" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" +) + +type CachedAnalyzer struct { + a Analyzer + config config.Config + configBytes []byte + db config.Database +} + +func Cached(a Analyzer, c config.Config, db config.Database) *CachedAnalyzer { + return &CachedAnalyzer{ + a: a, + config: c, + db: db, + } +} + +// 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 +} + +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 + } + + dir, err := cache.AnalysisDir() + if err != nil { + return nil, true, err + } + + if c.configBytes == nil { + c.configBytes, err = json.Marshal(c.config) + if err != nil { + return nil, true, err + } + } + + // Calculate cache key + h := fnv.New64() + h.Write([]byte(info.Version)) + h.Write(c.configBytes) + for _, m := range schema { + h.Write([]byte(m)) + } + h.Write([]byte(q)) + + key := fmt.Sprintf("%x", h.Sum(nil)) + path := filepath.Join(dir, key) + if _, err := os.Stat(path); err == nil { + contents, err := os.ReadFile(path) + if err != nil { + return nil, true, err + } + var a analysis.Analysis + if err := proto.Unmarshal(contents, &a); err != nil { + return nil, true, err + } + return &a, false, nil + } + + 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 + } + if err := os.WriteFile(path, contents, 0644); err != nil { + slog.Warn("saving analysis to disk failed", "err", err) + return result, false, nil + } + } + + return result, false, err +} + +func (c *CachedAnalyzer) Close(ctx context.Context) error { + return c.a.Close(ctx) +} + +func (c *CachedAnalyzer) EnsureConn(ctx context.Context, migrations []string) error { + return c.a.EnsureConn(ctx, migrations) +} + +func (c *CachedAnalyzer) GetColumnNames(ctx context.Context, query string) ([]string, error) { + return c.a.GetColumnNames(ctx, query) +} + +type Analyzer interface { + Analyze(context.Context, ast.Node, string, []string, *named.ParamSet) (*analysis.Analysis, error) + Close(context.Context) error + // EnsureConn initializes the database connection with the given migrations. + // This is required for database-only mode where we need to connect before analyzing queries. + EnsureConn(ctx context.Context, migrations []string) error + // GetColumnNames returns the column names for a query by preparing it against the database. + // This is used for star expansion in database-only mode. + GetColumnNames(ctx context.Context, query string) ([]string, error) +} diff --git a/internal/bundler/multipart.go b/internal/bundler/multipart.go new file mode 100644 index 0000000000..b1d1925fde --- /dev/null +++ b/internal/bundler/multipart.go @@ -0,0 +1,40 @@ +package bundler + +import ( + "os" + "path/filepath" + + pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +func readFiles(dir string, paths []string) ([]*pb.File, error) { + files, err := sqlpath.Glob(paths) + if err != nil { + return nil, err + } + var out []*pb.File + for _, file := range files { + f, err := readFile(dir, file) + if err != nil { + return nil, err + } + out = append(out, f) + } + return out, nil +} + +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 &pb.File{ + Name: rel, + Contents: blob, + }, nil +} diff --git a/internal/bundler/upload.go b/internal/bundler/upload.go new file mode 100644 index 0000000000..49e3b44a4c --- /dev/null +++ b/internal/bundler/upload.go @@ -0,0 +1,164 @@ +package bundler + +import ( + "context" + "errors" + "fmt" + "log/slog" + "os" + "strings" + + "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 { + 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{ + configPath: configPath, + config: conf, + dir: dir, + } +} + +func (up *Uploader) Validate() error { + if up.config.Cloud.Project == "" { + return ErrNoProject + } + if up.config.Cloud.AuthToken == "" { + return ErrNoAuthToken + } + if up.client == nil { + client, err := quickdb.NewClientFromConfig(up.config.Cloud) + if err != nil { + return fmt.Errorf("client init failed: %w", err) + } + up.client = client + } + return nil +} + +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) + } + 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 + } + res := &pb.UploadArchiveRequest{ + SqlcVersion: info.Version, + 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 []*QuerySetArchive) error { + req, err := up.buildRequest(ctx, result, []string{}) + if err != nil { + return err + } + 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 []*QuerySetArchive, tags []string) error { + if err := up.Validate(); err != nil { + return err + } + req, err := up.buildRequest(ctx, result, tags) + if err != nil { + return err + } + if _, err := up.client.UploadArchive(ctx, req); err != nil { + return fmt.Errorf("upload error: %w", err) + } + return nil +} diff --git a/internal/cache/cache.go b/internal/cache/cache.go new file mode 100644 index 0000000000..a6978034a7 --- /dev/null +++ b/internal/cache/cache.go @@ -0,0 +1,47 @@ +package cache + +import ( + "fmt" + "os" + "path/filepath" +) + +// The cache directory defaults to os.UserCacheDir(). This location can be +// overridden by the SQLCCACHE environment variable. +// +// Currently the cache stores two types of data: plugins and query analysis +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 +} + +func PluginsDir() (string, error) { + cacheRoot, err := Dir() + if err != nil { + return "", err + } + dir := filepath.Join(cacheRoot, "plugins") + if err := os.MkdirAll(dir, 0755); err != nil && !os.IsExist(err) { + return "", fmt.Errorf("failed to create %s directory: %w", dir, err) + } + return dir, nil +} + +func AnalysisDir() (string, error) { + cacheRoot, err := Dir() + if err != nil { + return "", err + } + dir := filepath.Join(cacheRoot, "query_analysis") + if err := os.MkdirAll(dir, 0755); err != nil && !os.IsExist(err) { + return "", fmt.Errorf("failed to create %s directory: %w", dir, err) + } + return dir, nil +} diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 59dc3e6a14..80a167353e 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -1,43 +1,79 @@ package cmd import ( + "bufio" + "bytes" + "context" + "errors" "fmt" "io" - "io/ioutil" "os" "os/exec" "path/filepath" + "runtime/trace" + "github.com/cubicdaiya/gonp" "github.com/spf13/cobra" "github.com/spf13/pflag" - yaml "gopkg.in/yaml.v3" + "gopkg.in/yaml.v3" - "github.com/kyleconroy/sqlc/internal/config" + "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/tracer" ) +func init() { + 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") + parseCmd.Flags().StringP("dialect", "d", "", "SQL dialect to use (postgresql, mysql, or sqlite)") +} + // Do runs the command logic. 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().Bool("no-remote", false, "disable remote execution (default: false)") + rootCmd.PersistentFlags().Bool("remote", false, "enable remote execution (default: false)") rootCmd.AddCommand(checkCmd) + rootCmd.AddCommand(createDBCmd) + rootCmd.AddCommand(diffCmd) rootCmd.AddCommand(genCmd) rootCmd.AddCommand(initCmd) + rootCmd.AddCommand(parseCmd) rootCmd.AddCommand(versionCmd) + rootCmd.AddCommand(verifyCmd) + rootCmd.AddCommand(pushCmd) + rootCmd.AddCommand(NewCmdVet()) rootCmd.SetArgs(args) rootCmd.SetIn(stdin) rootCmd.SetOut(stdout) rootCmd.SetErr(stderr) - err := rootCmd.Execute() - if err == nil { - return 0 + ctx := context.Background() + if debug.Debug.Trace != "" { + tracectx, cleanup, err := tracer.Start(ctx) + if err != nil { + fmt.Printf("failed to start trace: %v\n", err) + return 1 + } + ctx = tracectx + defer cleanup() } - if exitError, ok := err.(*exec.ExitError); ok { - return exitError.ExitCode() + if err := rootCmd.ExecuteContext(ctx); err != nil { + if exitError, ok := err.(*exec.ExitError); ok { + return exitError.ExitCode() + } else { + return 1 + } } - return 1 + return 0 } var version string @@ -45,14 +81,14 @@ var version string var versionCmd = &cobra.Command{ Use: "version", Short: "Print the sqlc version number", - Run: func(cmd *cobra.Command, args []string) { + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "version").End() if version == "" { - // When no version is set, return the next bug fix version - // after the most recent tag - fmt.Printf("%s\n", "v1.7.0") + fmt.Fprintf(cmd.OutOrStdout(), "%s\n", info.Version) } else { - fmt.Printf("%s\n", version) + fmt.Fprintf(cmd.OutOrStdout(), "%s\n", version) } + return nil }, } @@ -60,26 +96,77 @@ var initCmd = &cobra.Command{ Use: "init", Short: "Create an empty sqlc.yaml settings file", RunE: func(cmd *cobra.Command, args []string) error { + useV1, err := cmd.Flags().GetBool("v1") + if err != nil { + return err + } + var yamlConfig interface{} + if useV1 { + yamlConfig = config.V1GenerateSettings{Version: "1"} + } else { + yamlConfig = config.Config{Version: "2"} + } + + defer trace.StartRegion(cmd.Context(), "init").End() file := "sqlc.yaml" - if f := cmd.Flag("file"); f != nil { + if f := cmd.Flag("file"); f != nil && f.Changed { file = f.Value.String() + if file == "" { + return fmt.Errorf("file argument is empty") + } } if _, err := os.Stat(file); !os.IsNotExist(err) { + fmt.Printf("%s is already created\n", file) return nil } - blob, err := yaml.Marshal(config.V1GenerateSettings{Version: "1"}) + blob, err := yaml.Marshal(yamlConfig) + if err != nil { + return err + } + err = os.WriteFile(file, blob, 0644) if err != nil { return err } - return ioutil.WriteFile(file, blob, 0644) + configDoc := "https://docs.sqlc.dev/en/stable/reference/config.html" + fmt.Printf( + "%s is added. Please visit %s to learn more about configuration\n", + file, + configDoc, + ) + return nil }, } type Env struct { + DryRun bool + Debug opts.Debug + Experiment opts.Experiment + Remote bool + NoRemote bool } -func ParseEnv() Env { - return Env{} +func ParseEnv(c *cobra.Command) Env { + dr := c.Flag("dry-run") + r := c.Flag("remote") + nr := c.Flag("no-remote") + return Env{ + DryRun: dr != nil && dr.Changed, + Debug: opts.DebugFromEnv(), + Experiment: opts.ExperimentFromEnv(), + Remote: r != nil && r.Value.String() == "true", + NoRemote: nr != nil && nr.Value.String() == "true", + } +} + +var ErrPluginProcessDisabled = errors.New("plugin: process-based plugins disabled via SQLCDEBUG=processplugins=0") + +func (e *Env) Validate(cfg *config.Config) error { + for _, plugin := range cfg.Plugins { + if plugin.Process != nil && !e.Debug.ProcessPlugins { + return ErrPluginProcessDisabled + } + } + return nil } func getConfigPath(stderr io.Writer, f *pflag.Flag) (string, string) { @@ -107,21 +194,27 @@ func getConfigPath(stderr io.Writer, f *pflag.Flag) (string, string) { var genCmd = &cobra.Command{ Use: "generate", - Short: "Generate Go code from SQL", - Run: func(cmd *cobra.Command, args []string) { + Short: "Generate source code from SQL", + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "generate").End() stderr := cmd.ErrOrStderr() dir, name := getConfigPath(stderr, cmd.Flag("file")) - output, err := Generate(ParseEnv(), dir, name, stderr) + output, err := Generate(cmd.Context(), dir, name, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) if err != nil { os.Exit(1) } + defer trace.StartRegion(cmd.Context(), "writefiles").End() for filename, source := range output { os.MkdirAll(filepath.Dir(filename), 0755) - if err := ioutil.WriteFile(filename, []byte(source), 0644); err != nil { + if err := os.WriteFile(filename, []byte(source), 0644); err != nil { fmt.Fprintf(stderr, "%s: %s\n", filename, err) - os.Exit(1) + return err } } + return nil }, } @@ -129,9 +222,61 @@ var checkCmd = &cobra.Command{ Use: "compile", Short: "Statically check SQL for syntax and type errors", RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "compile").End() stderr := cmd.ErrOrStderr() dir, name := getConfigPath(stderr, cmd.Flag("file")) - if _, err := Generate(Env{}, dir, name, stderr); err != nil { + _, err := Generate(cmd.Context(), dir, name, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) + if err != nil { + os.Exit(1) + } + return nil + }, +} + +func getLines(f []byte) []string { + fp := bytes.NewReader(f) + scanner := bufio.NewScanner(fp) + lines := make([]string, 0) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + return lines +} + +func filterHunks[T gonp.Elem](uniHunks []gonp.UniHunk[T]) []gonp.UniHunk[T] { + var out []gonp.UniHunk[T] + for i, uniHunk := range uniHunks { + var changed bool + for _, e := range uniHunk.GetChanges() { + switch e.GetType() { + case gonp.SesDelete: + changed = true + case gonp.SesAdd: + changed = true + } + } + if changed { + out = append(out, uniHunks[i]) + } + } + return out +} + +var diffCmd = &cobra.Command{ + Use: "diff", + Short: "Compare the generated files to the existing files", + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "diff").End() + stderr := cmd.ErrOrStderr() + dir, name := getConfigPath(stderr, cmd.Flag("file")) + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + } + if err := Diff(cmd.Context(), dir, name, opts); err != nil { os.Exit(1) } return nil diff --git a/internal/cmd/createdb.go b/internal/cmd/createdb.go new file mode 100644 index 0000000000..02b3031352 --- /dev/null +++ b/internal/cmd/createdb.go @@ -0,0 +1,103 @@ +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 { + sql := 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/diff.go b/internal/cmd/diff.go new file mode 100644 index 0000000000..8998971a37 --- /dev/null +++ b/internal/cmd/diff.go @@ -0,0 +1,59 @@ +package cmd + +import ( + "context" + "errors" + "fmt" + "os" + "runtime/trace" + "sort" + "strings" + + "github.com/cubicdaiya/gonp" +) + +func Diff(ctx context.Context, dir, name string, opts *Options) error { + stderr := opts.Stderr + output, err := Generate(ctx, dir, name, opts) + if err != nil { + return err + } + defer trace.StartRegion(ctx, "checkfiles").End() + var errored bool + + keys := make([]string, 0, len(output)) + for k, _ := range output { + kk := k + keys = append(keys, kk) + } + sort.Strings(keys) + + for _, filename := range keys { + source := output[filename] + if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) { + errored = true + // stdout message + continue + } + existing, err := os.ReadFile(filename) + if err != nil { + errored = true + fmt.Fprintf(stderr, "%s: %s\n", filename, err) + continue + } + diff := gonp.New(getLines(existing), getLines([]byte(source))) + diff.Compose() + uniHunks := filterHunks(diff.UnifiedHunks()) + + if len(uniHunks) > 0 { + errored = true + fmt.Fprintf(stderr, "--- a%s\n", strings.TrimPrefix(filename, dir)) + fmt.Fprintf(stderr, "+++ b%s\n", strings.TrimPrefix(filename, dir)) + diff.FprintUniHunks(stderr, uniHunks) + } + } + if errored { + return errors.New("diff found") + } + return nil +} diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 55f9f4c18d..05b5445ebb 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -1,26 +1,39 @@ package cmd import ( - "bytes" + "context" + "encoding/json" "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" + "runtime/trace" "strings" + "sync" - "github.com/kyleconroy/sqlc/internal/codegen/golang" - "github.com/kyleconroy/sqlc/internal/codegen/kotlin" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/multierr" - "github.com/kyleconroy/sqlc/internal/opts" + "google.golang.org/grpc" + "google.golang.org/grpc/status" + + "github.com/sqlc-dev/sqlc/internal/codegen/golang" + genjson "github.com/sqlc-dev/sqlc/internal/codegen/json" + "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/debug" + "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" ) const errMessageNoVersion = `The configuration file must have a version number. -Set the version to 1 at the top of sqlc.json: +Set the version to 1 or 2 at the top of sqlc.json: { "version": "1" @@ -29,28 +42,36 @@ Set the version to 1 at the top of sqlc.json: ` const errMessageUnknownVersion = `The configuration file has an invalid version number. -The only supported version is "1". +The supported version can only be "1" or "2". ` const errMessageNoPackages = `No packages are configured` func printFileErr(stderr io.Writer, dir string, fileErr *multierr.FileError) { - filename := strings.TrimPrefix(fileErr.Filename, dir+"/") + filename, err := filepath.Rel(dir, fileErr.Filename) + if err != nil { + filename = fileErr.Filename + } fmt.Fprintf(stderr, "%s:%d:%d: %s\n", filename, fileErr.Line, fileErr.Column, fileErr.Err) } -type outPair struct { - Gen config.SQLGen - config.SQL +func findPlugin(conf config.Config, name string) (*config.Plugin, error) { + for _, plug := range conf.Plugins { + if plug.Name == name { + return &plug, nil + } + } + return nil, fmt.Errorf("plugin not found") } -func Generate(e Env, dir, filename string, stderr io.Writer) (map[string]string, error) { +func readConfig(stderr io.Writer, dir, filename string) (string, *config.Config, error) { configPath := "" if filename != "" { configPath = filepath.Join(dir, filename) } else { - var yamlMissing, jsonMissing bool + var yamlMissing, jsonMissing, ymlMissing bool yamlPath := filepath.Join(dir, "sqlc.yaml") + ymlPath := filepath.Join(dir, "sqlc.yml") jsonPath := filepath.Join(dir, "sqlc.json") if _, err := os.Stat(yamlPath); os.IsNotExist(err) { @@ -60,136 +81,230 @@ func Generate(e Env, dir, filename string, stderr io.Writer) (map[string]string, jsonMissing = true } - if yamlMissing && jsonMissing { - fmt.Fprintln(stderr, "error parsing sqlc.json: file does not exist") - return nil, errors.New("config file missing") + if _, err := os.Stat(ymlPath); os.IsNotExist(err) { + ymlMissing = true + } + + if yamlMissing && ymlMissing && jsonMissing { + fmt.Fprintln(stderr, "error parsing configuration files. sqlc.(yaml|yml) or sqlc.json: file does not exist") + return "", nil, errors.New("config file missing") } - if !yamlMissing && !jsonMissing { - fmt.Fprintln(stderr, "error: both sqlc.json and sqlc.yaml files present") - return nil, errors.New("sqlc.json and sqlc.yaml present") + if (!yamlMissing || !ymlMissing) && !jsonMissing { + fmt.Fprintln(stderr, "error: both sqlc.json and sqlc.(yaml|yml) files present") + return "", nil, errors.New("sqlc.json and sqlc.(yaml|yml) present") } - configPath = yamlPath - if yamlMissing { + if jsonMissing { + if yamlMissing { + configPath = ymlPath + } else { + configPath = yamlPath + } + } else { configPath = jsonPath } } base := filepath.Base(configPath) - blob, err := ioutil.ReadFile(configPath) + file, err := os.Open(configPath) if err != nil { fmt.Fprintf(stderr, "error parsing %s: file does not exist\n", base) - return nil, err + return "", nil, err } + defer file.Close() - conf, err := config.ParseConfig(bytes.NewReader(blob)) + conf, err := config.ParseConfig(file) if err != nil { switch err { case config.ErrMissingVersion: - fmt.Fprintf(stderr, errMessageNoVersion) + fmt.Fprint(stderr, errMessageNoVersion) case config.ErrUnknownVersion: - fmt.Fprintf(stderr, errMessageUnknownVersion) + fmt.Fprint(stderr, errMessageUnknownVersion) case config.ErrNoPackages: - fmt.Fprintf(stderr, errMessageNoPackages) + fmt.Fprint(stderr, errMessageNoPackages) } fmt.Fprintf(stderr, "error parsing %s: %s\n", base, err) - return nil, err + return "", nil, err } - debug, err := opts.DebugFromEnv() + return configPath, &conf, nil +} + +func Generate(ctx context.Context, dir, filename string, o *Options) (map[string]string, error) { + e := o.Env + stderr := o.Stderr + + configPath, conf, err := o.ReadConfig(dir, filename) if err != nil { - fmt.Fprintf(stderr, "error parsing SQLCDEBUG: %s\n", err) return nil, err } - output := map[string]string{} - errored := false + base := filepath.Base(configPath) + if err := config.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return nil, err + } + + if err := e.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return nil, err + } + + // Comment on why these two methods exist + if conf.Cloud.Project != "" && e.Remote && !e.NoRemote { + return remoteGenerate(ctx, configPath, conf, dir, stderr) + } + + g := &generator{ + dir: dir, + output: map[string]string{}, + } - var pairs []outPair + 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 +} + +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.Kotlin != nil { - pairs = append(pairs, outPair{ + if sql.Gen.JSON != nil { + pairs = append(pairs, OutputPair{ SQL: sql, - Gen: config.SQLGen{Kotlin: sql.Gen.Kotlin}, + Gen: config.SQLGen{JSON: sql.Gen.JSON}, + }) + } + for i := range sql.Codegen { + pairs = append(pairs, OutputPair{ + SQL: sql, + Plugin: &sql.Codegen[i], }) } } + return pairs +} - for _, sql := range pairs { - combo := config.Combine(conf, sql.SQL) - - // 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 +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 { + return err + } + files := map[string]string{} + for _, file := range resp.Files { + files[file.Name] = string(file.Contents) + } + g.m.Lock() - joined = make([]string, 0, len(sql.Queries)) - for _, q := range sql.Queries { - joined = append(joined, filepath.Join(dir, q)) - } - sql.Queries = joined + // out is specified by the user, not a plugin + absout := filepath.Join(g.dir, out) - var name string - parseOpts := opts.Parser{ - Debug: debug, + for n, source := range files { + 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) } - if sql.Gen.Go != nil { - name = combo.Go.Package - } else if sql.Gen.Kotlin != nil { - if sql.Engine == config.EnginePostgreSQL { - parseOpts.UsePositionalParameters = true - } - name = combo.Kotlin.Package + // 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 + } + g.m.Unlock() + return nil +} - result, failed := parse(e, name, dir, sql.SQL, combo, parseOpts, stderr) - if failed { - errored = true - break - } +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) + if err != nil { + fmt.Fprintf(stderr, "error creating rpc client: %s\n", err) + return nil, err + } - var files map[string]string - var out string - switch { - case sql.Gen.Go != nil: - out = combo.Go.Out - files, err = golang.Generate(result, combo) - case sql.Gen.Kotlin != nil: - out = combo.Kotlin.Out - files, err = kotlin.Generate(result, combo) - default: - panic("missing language backend") - } + configBytes, err := os.ReadFile(configPath) + if err != nil { + fmt.Fprintf(stderr, "error reading config file %s: %s\n", configPath, err) + return nil, err + } - if err != nil { - fmt.Fprintf(stderr, "# package %s\n", name) - fmt.Fprintf(stderr, "error generating code: %s\n", err) - errored = true - continue + rpcReq := remote.GenerateRequest{ + Version: info.Version, + Inputs: []*remote.File{{Path: filepath.Base(configPath), Bytes: configBytes}}, + } + + 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 _, 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}) + } } - for n, source := range files { - filename := filepath.Join(dir, out, n) - output[filename] = source + } + + rpcResp, err := rpcClient.Generate(ctx, &rpcReq) + if err != nil { + rpcStatus, ok := status.FromError(err) + if !ok { + return nil, err } + 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") } - if errored { - return nil, fmt.Errorf("errored") + output := map[string]string{} + for _, file := range rpcResp.Outputs { + output[filepath.Join(dir, file.Path)] = string(file.Bytes) } + return output, nil } -func parse(e Env, name, dir string, sql config.SQL, combo config.CombinedSettings, parserOpts opts.Parser, stderr io.Writer) (*compiler.Result, bool) { - c := compiler.NewCompiler(sql, combo) +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, parserOpts) + defer func() { + if c != nil { + c.Close(ctx) + } + }() + if err != nil { + fmt.Fprintf(stderr, "error creating compiler: %s\n", err) + return nil, true + } if err := c.ParseCatalog(sql.Schema); err != nil { fmt.Fprintf(stderr, "# package %s\n", name) if parserErr, ok := err.(*multierr.Error); ok { @@ -217,3 +332,82 @@ func parse(e Env, name, dir string, sql config.SQL, combo config.CombinedSetting } return c.Result(), false } + +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 grpc.ClientConnInterface + var out string + switch { + case sql.Plugin != nil: + out = sql.Plugin.Out + plug, err := findPlugin(combo.Global, sql.Plugin.Plugin) + if err != nil { + return "", nil, fmt.Errorf("plugin not found: %s", err) + } + + switch { + case plug.Process != nil: + handler = &process.Runner{ + Cmd: plug.Process.Cmd, + Env: plug.Env, + Format: plug.Process.Format, + } + case plug.WASM != nil: + handler = &wasm.Runner{ + URL: plug.WASM.URL, + SHA256: plug.WASM.SHA256, + Env: plug.Env, + } + default: + return "", nil, fmt.Errorf("unsupported plugin type") + } + + opts, err := convert.YAMLtoJSON(sql.Plugin.Options) + if err != nil { + 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) + opts, err := json.Marshal(sql.Gen.Go) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + 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) + opts, err := json.Marshal(sql.Gen.JSON) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + req.PluginOptions = opts + + default: + return "", nil, fmt.Errorf("missing language backend") + } + 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 new file mode 100644 index 0000000000..02d3614f4e --- /dev/null +++ b/internal/cmd/options.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "io" + + "github.com/sqlc-dev/sqlc/internal/config" +) + +type Options struct { + Env Env + Stderr io.Writer + // TODO: Move these to a command-specific struct + Tags []string + Against string + + // Testing only + MutateConfig func(*config.Config) +} + +func (o *Options) ReadConfig(dir, filename string) (string, *config.Config, error) { + path, conf, err := readConfig(o.Stderr, dir, filename) + if err != nil { + return path, conf, err + } + if o.MutateConfig != nil { + o.MutateConfig(conf) + } + return path, conf, nil +} diff --git a/internal/cmd/parse.go b/internal/cmd/parse.go new file mode 100644 index 0000000000..aca01511f1 --- /dev/null +++ b/internal/cmd/parse.go @@ -0,0 +1,101 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "io" + "os" + + "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/postgresql" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +var parseCmd = &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. + +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`, + 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, or clickhouse)") + } + + // 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() + } + + // Parse SQL based on dialect + var stmts []ast.Statement + switch dialect { + case "postgresql", "postgres", "pg": + parser := postgresql.NewParser() + stmts, err = parser.Parse(input) + case "mysql": + parser := dolphin.NewParser() + stmts, err = parser.Parse(input) + case "sqlite": + parser := sqlite.NewParser() + stmts, err = parser.Parse(input) + case "clickhouse": + parser := clickhouse.NewParser() + stmts, err = parser.Parse(input) + default: + return fmt.Errorf("unsupported dialect: %s (use postgresql, mysql, sqlite, or clickhouse)", dialect) + } + if err != nil { + return fmt.Errorf("parse error: %w", err) + } + + // Output AST as JSON + stdout := cmd.OutOrStdout() + encoder := json.NewEncoder(stdout) + encoder.SetIndent("", " ") + + for _, stmt := range stmts { + if err := encoder.Encode(stmt.Raw); err != nil { + return fmt.Errorf("failed to encode AST: %w", err) + } + } + + return nil + }, +} diff --git a/internal/cmd/process.go b/internal/cmd/process.go new file mode 100644 index 0000000000..5003d113b8 --- /dev/null +++ b/internal/cmd/process.go @@ -0,0 +1,134 @@ +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/debug" + "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{ + 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 + } + 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 new file mode 100644 index 0000000000..654500429a --- /dev/null +++ b/internal/cmd/shim.go @@ -0,0 +1,233 @@ +package cmd + +import ( + "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/info" + "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +func pluginSettings(r *compiler.Result, cs config.CombinedSettings) *plugin.Settings { + return &plugin.Settings{ + Version: cs.Global.Version, + Engine: string(cs.Package.Engine), + Schema: []string(cs.Package.Schema), + Queries: []string(cs.Package.Queries), + Codegen: pluginCodegen(cs, cs.Codegen), + } +} + +func pluginCodegen(cs config.CombinedSettings, s config.Codegen) *plugin.Codegen { + opts, err := convert.YAMLtoJSON(s.Options) + if err != nil { + panic(err) + } + cg := &plugin.Codegen{ + Out: s.Out, + Plugin: s.Plugin, + Options: opts, + } + for _, p := range cs.Global.Plugins { + if p.Name == s.Plugin { + cg.Env = p.Env + cg.Process = pluginProcess(p) + cg.Wasm = pluginWASM(p) + return cg + } + } + return cg +} + +func pluginProcess(p config.Plugin) *plugin.Codegen_Process { + if p.Process != nil { + return &plugin.Codegen_Process{ + Cmd: p.Process.Cmd, + } + } + return nil +} + +func pluginWASM(p config.Plugin) *plugin.Codegen_WASM { + if p.WASM != nil { + return &plugin.Codegen_WASM{ + Url: p.WASM.URL, + Sha256: p.WASM.SHA256, + } + } + return nil +} + +func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { + var schemas []*plugin.Schema + for _, s := range c.Schemas { + var enums []*plugin.Enum + var cts []*plugin.CompositeType + for _, typ := range s.Types { + switch typ := typ.(type) { + case *catalog.Enum: + enums = append(enums, &plugin.Enum{ + Name: typ.Name, + Comment: typ.Comment, + Vals: typ.Vals, + }) + case *catalog.CompositeType: + cts = append(cts, &plugin.CompositeType{ + Name: typ.Name, + Comment: typ.Comment, + }) + } + } + var tables []*plugin.Table + for _, t := range s.Tables { + var columns []*plugin.Column + for _, c := range t.Columns { + l := -1 + if c.Length != nil { + l = *c.Length + } + columns = append(columns, &plugin.Column{ + Name: c.Name, + Type: &plugin.Identifier{ + Catalog: c.Type.Catalog, + Schema: c.Type.Schema, + Name: c.Type.Name, + }, + Comment: c.Comment, + NotNull: c.IsNotNull, + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: int32(c.ArrayDims), + Length: int32(l), + Table: &plugin.Identifier{ + Catalog: t.Rel.Catalog, + Schema: t.Rel.Schema, + Name: t.Rel.Name, + }, + }) + } + tables = append(tables, &plugin.Table{ + Rel: &plugin.Identifier{ + Catalog: t.Rel.Catalog, + Schema: t.Rel.Schema, + Name: t.Rel.Name, + }, + Columns: columns, + Comment: t.Comment, + }) + } + schemas = append(schemas, &plugin.Schema{ + Comment: s.Comment, + Name: s.Name, + Tables: tables, + Enums: enums, + CompositeTypes: cts, + }) + } + return &plugin.Catalog{ + Name: c.Name, + DefaultSchema: c.DefaultSchema, + Comment: c.Comment, + Schemas: schemas, + } +} + +func pluginQueries(r *compiler.Result) []*plugin.Query { + var out []*plugin.Query + for _, q := range r.Queries { + var params []*plugin.Parameter + var columns []*plugin.Column + for _, c := range q.Columns { + columns = append(columns, pluginQueryColumn(c)) + } + for _, p := range q.Params { + params = append(params, pluginQueryParam(p)) + } + var iit *plugin.Identifier + if q.InsertIntoTable != nil { + iit = &plugin.Identifier{ + Catalog: q.InsertIntoTable.Catalog, + Schema: q.InsertIntoTable.Schema, + Name: q.InsertIntoTable.Name, + } + } + out = append(out, &plugin.Query{ + Name: q.Metadata.Name, + Cmd: q.Metadata.Cmd, + Text: q.SQL, + Comments: q.Metadata.Comments, + Columns: columns, + Params: params, + Filename: q.Metadata.Filename, + InsertIntoTable: iit, + }) + } + return out +} + +func pluginQueryColumn(c *compiler.Column) *plugin.Column { + l := -1 + if c.Length != nil { + l = *c.Length + } + out := &plugin.Column{ + Name: c.Name, + OriginalName: c.OriginalName, + Comment: c.Comment, + NotNull: c.NotNull, + Unsigned: c.Unsigned, + IsArray: c.IsArray, + ArrayDims: int32(c.ArrayDims), + Length: int32(l), + IsNamedParam: c.IsNamedParam, + IsFuncCall: c.IsFuncCall, + IsSqlcSlice: c.IsSqlcSlice, + } + + if c.Type != nil { + out.Type = &plugin.Identifier{ + Catalog: c.Type.Catalog, + Schema: c.Type.Schema, + Name: c.Type.Name, + } + } else { + out.Type = &plugin.Identifier{ + Name: c.DataType, + } + } + + if c.Table != nil { + out.Table = &plugin.Identifier{ + Catalog: c.Table.Catalog, + Schema: c.Table.Schema, + Name: c.Table.Name, + } + } + + if c.EmbedTable != nil { + out.EmbedTable = &plugin.Identifier{ + Catalog: c.EmbedTable.Catalog, + Schema: c.EmbedTable.Schema, + Name: c.EmbedTable.Name, + } + } + + return out +} + +func pluginQueryParam(p compiler.Parameter) *plugin.Parameter { + return &plugin.Parameter{ + Number: int32(p.Number), + Column: pluginQueryColumn(p.Column), + } +} + +func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.GenerateRequest { + return &plugin.GenerateRequest{ + Settings: pluginSettings(r, settings), + Catalog: pluginCatalog(r.Catalog), + Queries: pluginQueries(r), + SqlcVersion: info.Version, + } +} 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 new file mode 100644 index 0000000000..4dbd3c3b7b --- /dev/null +++ b/internal/cmd/vet.go @@ -0,0 +1,704 @@ +package cmd + +import ( + "context" + "database/sql" + "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" + "github.com/jackc/pgx/v5" + "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" + "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/vet" +) + +var ErrFailedChecks = errors.New("failed checks") + +var pjson = protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + +func NewCmdVet() *cobra.Command { + return &cobra.Command{ + Use: "vet", + Short: "Vet examines queries", + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "vet").End() + stderr := cmd.ErrOrStderr() + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + } + dir, name := getConfigPath(stderr, cmd.Flag("file")) + if err := Vet(cmd.Context(), dir, name, opts); err != nil { + if !errors.Is(err, ErrFailedChecks) { + fmt.Fprintf(stderr, "%s\n", err) + } + os.Exit(1) + } + return nil + }, + } +} + +func Vet(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 + } + + 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 + } + + env, err := cel.NewEnv( + cel.StdLib(), + ext.Strings(ext.StringsVersion(1)), + cel.Types( + &vet.Config{}, + &vet.Query{}, + &vet.PostgreSQL{}, + &vet.MySQL{}, + ), + cel.Variable("query", + cel.ObjectType("vet.Query"), + ), + cel.Variable("config", + cel.ObjectType("vet.Config"), + ), + cel.Variable("postgresql", + cel.ObjectType("vet.PostgreSQL"), + ), + cel.Variable("mysql", + cel.ObjectType("vet.MySQL"), + ), + ) + if err != nil { + return fmt.Errorf("new CEL env error: %s", err) + } + + rules := map[string]rule{ + constants.QueryRuleDbPrepare: {NeedsPrepare: true}, + } + + for _, c := range conf.Rules { + if c.Name == "" { + return fmt.Errorf("rules require a name") + } + if _, found := rules[c.Name]; found { + return fmt.Errorf("type-check error: a rule with the name '%s' already exists", c.Name) + } + if c.Rule == "" { + return fmt.Errorf("type-check error: %s is empty", c.Name) + } + ast, issues := env.Compile(c.Rule) + if issues != nil && issues.Err() != nil { + return fmt.Errorf("type-check error: %s %s", c.Name, issues.Err()) + } + prg, err := env.Program(ast) + if err != nil { + return fmt.Errorf("program construction error: %s %s", c.Name, err) + } + 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 + if strings.Contains(c.Rule, "postgresql.explain") || + strings.Contains(c.Rule, "mysql.explain") { + rule.NeedsExplain = true + } + + rules[c.Name] = rule + } + + c := checker{ + Rules: rules, + Conf: conf, + Dir: dir, + Env: env, + Stderr: stderr, + OnlyManagedDB: e.Debug.OnlyManagedDatabases, + Replacer: shfmt.NewReplacer(nil), + } + errored := false + for _, sql := range conf.SQL { + if err := c.checkSQL(ctx, sql); err != nil { + if !errors.Is(err, ErrFailedChecks) { + fmt.Fprintf(stderr, "%s\n", err) + } + errored = true + } + } + if errored { + return ErrFailedChecks + } + return nil +} + +type preparer interface { + Prepare(context.Context, string, string) error +} + +type pgxConn struct { + c *pgx.Conn +} + +func (p *pgxConn) Prepare(ctx context.Context, name, query string) error { + _, err := p.c.Prepare(ctx, name, query) + return err +} + +// Return a default value for a PostgreSQL column based on its type. Returns nil +// if the type is unknown. +func pgDefaultValue(col *plugin.Column) any { + if col == nil { + return nil + } + if col.Type == nil { + return nil + } + typname := strings.TrimPrefix(col.Type.Name, "pg_catalog.") + switch typname { + case "any", "void": + if col.IsArray { + return []any{} + } else { + return nil + } + case "anyarray": + return []any{} + case "bool", "boolean": + if col.IsArray { + return []bool{} + } else { + return false + } + case "double", "double precision", "real": + if col.IsArray { + return []float32{} + } else { + return 0.1 + } + case "json", "jsonb": + if col.IsArray { + return []string{} + } else { + return "{}" + } + case "citext", "string", "text", "varchar": + if col.IsArray { + return []string{} + } else { + return "" + } + case "bigint", "bigserial", "integer", "int", "int2", "int4", "int8", "serial": + if col.IsArray { + return []int{} + } else { + return 1 + } + case "date", "time", "timestamp", "timestamptz": + if col.IsArray { + return []time.Time{} + } else { + return time.Time{} + } + case "uuid": + if col.IsArray { + return []string{} + } else { + return "00000000-0000-0000-0000-000000000000" + } + case "numeric", "decimal": + if col.IsArray { + return []string{} + } else { + return "0.1" + } + case "inet": + if col.IsArray { + return []string{} + } else { + return "192.168.0.1/24" + } + case "cidr": + if col.IsArray { + return []string{} + } else { + return "192.168.1/24" + } + default: + return nil + } +} + +// Return a default value for a MySQL column based on its type. Returns nil +// if the type is unknown. +func mysqlDefaultValue(col *plugin.Column) any { + if col == nil { + return nil + } + if col.Type == nil { + return nil + } + switch col.Type.Name { + case "any": + return nil + case "bool": + return false + case "int", "bigint", "mediumint", "smallint", "tinyint", "bit": + return 1 + case "decimal": // "numeric", "dec", "fixed" + // No perfect choice here to avoid "Impossible WHERE" but I think + // 0.1 is decent. It works for all cases where `scale` > 0 which + // should be the majority. For more information refer to + // https://dev.mysql.com/doc/refman/8.1/en/fixed-point-types.html. + return 0.1 + case "float", "double": + return 0.1 + case "date": + return "0000-00-00" + case "datetime", "timestamp": + return "0000-00-00 00:00:00" + case "time": + return "00:00:00" + case "year": + return "0000" + case "char", "varchar", "binary", "varbinary", "tinyblob", "blob", + "mediumblob", "longblob", "tinytext", "text", "mediumtext", "longtext": + return "" + case "json": + return "{}" + default: + return nil + } +} + +func (p *pgxConn) Explain(ctx context.Context, query string, args ...*plugin.Parameter) (*vetEngineOutput, error) { + eQuery := "EXPLAIN (ANALYZE false, VERBOSE, COSTS, SETTINGS, BUFFERS, FORMAT JSON) " + query + eArgs := make([]any, len(args)) + for i, a := range args { + eArgs[i] = pgDefaultValue(a.Column) + } + row := p.c.QueryRow(ctx, eQuery, eArgs...) + var result []json.RawMessage + if err := row.Scan(&result); err != nil { + return nil, err + } + if debug.Debug.DumpExplain { + fmt.Println(eQuery, "with args", eArgs) + fmt.Println(string(result[0])) + } + var explain vet.PostgreSQLExplain + if err := pjson.Unmarshal(result[0], &explain); err != nil { + return nil, err + } + return &vetEngineOutput{PostgreSQL: &vet.PostgreSQL{Explain: &explain}}, nil +} + +type dbPreparer struct { + db *sql.DB +} + +func (p *dbPreparer) Prepare(ctx context.Context, name, query string) error { + s, err := p.db.PrepareContext(ctx, query) + if s != nil { + s.Close() + } + return err +} + +type explainer interface { + Explain(context.Context, string, ...*plugin.Parameter) (*vetEngineOutput, error) +} + +type mysqlExplainer struct { + *sql.DB +} + +func (me *mysqlExplainer) Explain(ctx context.Context, query string, args ...*plugin.Parameter) (*vetEngineOutput, error) { + eQuery := "EXPLAIN FORMAT=JSON " + query + eArgs := make([]any, len(args)) + for i, a := range args { + eArgs[i] = mysqlDefaultValue(a.Column) + } + row := me.QueryRowContext(ctx, eQuery, eArgs...) + var result json.RawMessage + if err := row.Scan(&result); err != nil { + return nil, err + } + if debug.Debug.DumpExplain { + fmt.Println(eQuery, "with args", eArgs) + fmt.Println(string(result)) + } + var explain vet.MySQLExplain + if err := pjson.Unmarshal(result, &explain); err != nil { + return nil, err + } + if explain.QueryBlock.Message != "" { + return nil, fmt.Errorf("mysql explain: %s", explain.QueryBlock.Message) + } + return &vetEngineOutput{MySQL: &vet.MySQL{Explain: &explain}}, nil +} + +type rule struct { + Program *cel.Program + Message string + NeedsPrepare bool + NeedsExplain bool +} + +type checker struct { + 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) { + cleanup := func() error { + return nil + } + + if s.Database == nil { + panic("fetch database URI called with nil database") + } + if !s.Database.Managed { + uri, err := c.DSN(s.Database.URI) + return uri, cleanup, err + } + + // Initialize the client exactly once, even if called concurrently + c.clientOnce.Do(func() { + c.Client = dbmanager.NewClient(c.Conf.Servers) + }) + + var ddl []string + files, err := sqlpath.Glob(s.Schema) + if err != nil { + return "", cleanup, err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return "", cleanup, fmt.Errorf("read file: %w", err) + } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) + } + + 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) + } + + 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 uri, cleanup, nil +} + +func (c *checker) DSN(dsn string) (string, error) { + return c.Replacer.Replace(dsn), nil +} + +func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { + // TODO: Create a separate function for this logic so we can + combo := config.Combine(*c.Conf, s) + + // TODO: This feels like a hack that will bite us later + joined := make([]string, 0, len(s.Schema)) + for _, s := range s.Schema { + joined = append(joined, filepath.Join(c.Dir, s)) + } + s.Schema = joined + + joined = make([]string, 0, len(s.Queries)) + for _, q := range s.Queries { + joined = append(joined, filepath.Join(c.Dir, q)) + } + s.Queries = joined + + var name string + parseOpts := opts.Parser{ + Debug: debug.Debug, + } + + result, failed := parse(ctx, name, c.Dir, s, combo, parseOpts, c.Stderr) + if failed { + return ErrFailedChecks + } + + var prep preparer + var expl explainer + if s.Database != nil { // TODO only set up a database connection if a rule evaluation requires it + 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 { + return err + } + defer func() { + if err := cleanup(); err != nil { + fmt.Fprintf(c.Stderr, "error cleaning up: %s\n", err) + } + }() + + switch s.Engine { + case config.EnginePostgreSQL: + conn, err := pgx.Connect(ctx, dburl) + if err != nil { + return fmt.Errorf("database: connection error: %s", err) + } + if err := conn.Ping(ctx); err != nil { + return fmt.Errorf("database: connection error: %s", err) + } + defer conn.Close(ctx) + pConn := &pgxConn{conn} + prep = pConn + expl = pConn + case config.EngineMySQL: + db, err := sql.Open("mysql", dburl) + if err != nil { + return fmt.Errorf("database: connection error: %s", err) + } + if err := db.PingContext(ctx); err != nil { + return fmt.Errorf("database: connection error: %s", err) + } + defer db.Close() + prep = &dbPreparer{db} + expl = &mysqlExplainer{db} + case config.EngineSQLite: + db, err := sql.Open("sqlite3", dburl) + if err != nil { + return fmt.Errorf("database: connection error: %s", err) + } + if err := db.PingContext(ctx); err != nil { + 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 + expl = nil + default: + return fmt.Errorf("unsupported database uri: %s", s.Engine) + } + } + + errored := false + req := codeGenRequest(result, combo) + cfg := vetConfig(req) + for i, query := range req.Queries { + 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 + } + } + } + + evalMap := map[string]any{ + "query": vetQuery(query), + "config": cfg, + } + + for _, name := range s.Rules { + if _, skip := md.RuleSkiplist[name]; skip { + if debug.Active { + log.Printf("Skipping vet rule %q for query: %s\n", name, query.Name) + } + } else { + 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 + } + 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 + } + } + + // 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 + } + 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) + } + + 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 + } + } + } + } + + if errored { + return ErrFailedChecks + } + return nil +} + +func vetConfig(req *plugin.GenerateRequest) *vet.Config { + return &vet.Config{ + Version: req.Settings.Version, + Engine: req.Settings.Engine, + Schema: req.Settings.Schema, + Queries: req.Settings.Queries, + } +} + +func vetQuery(q *plugin.Query) *vet.Query { + var params []*vet.Parameter + for _, p := range q.Params { + params = append(params, &vet.Parameter{ + Number: p.Number, + }) + } + return &vet.Query{ + Sql: q.Text, + Name: q.Name, + Cmd: strings.TrimPrefix(q.Cmd, ":"), + Params: params, + } +} + +type vetEngineOutput struct { + PostgreSQL *vet.PostgreSQL + MySQL *vet.MySQL +} diff --git a/internal/cmd/vet_sqlite.go b/internal/cmd/vet_sqlite.go new file mode 100644 index 0000000000..e1f8c7f9a8 --- /dev/null +++ b/internal/cmd/vet_sqlite.go @@ -0,0 +1,6 @@ +package cmd + +import ( + _ "github.com/ncruces/go-sqlite3/driver" + _ "github.com/ncruces/go-sqlite3/embed" +) diff --git a/internal/codegen/golang/compat.go b/internal/codegen/golang/compat.go deleted file mode 100644 index cdbb5aac2a..0000000000 --- a/internal/codegen/golang/compat.go +++ /dev/null @@ -1,17 +0,0 @@ -package golang - -import ( - "github.com/kyleconroy/sqlc/internal/core" - "github.com/kyleconroy/sqlc/internal/sql/ast" -) - -func sameTableName(n *ast.TableName, f core.FQN, defaultSchema string) bool { - if n == nil { - return false - } - schema := n.Schema - if n.Schema == "" { - schema = defaultSchema - } - return n.Catalog == f.Catalog && schema == f.Schema && n.Name == f.Rel -} diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go new file mode 100644 index 0000000000..5e3a533dcc --- /dev/null +++ b/internal/codegen/golang/driver.go @@ -0,0 +1,14 @@ +package golang + +import "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + +func parseDriver(sqlPackage string) opts.SQLDriver { + switch sqlPackage { + case opts.SQLPackagePGXV4: + return opts.SQLDriverPGXV4 + case opts.SQLPackagePGXV5: + return opts.SQLDriverPGXV5 + default: + return opts.SQLDriverLibPQ + } +} diff --git a/internal/codegen/golang/enum.go b/internal/codegen/golang/enum.go index c6a0d1ccbf..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 @@ -17,23 +15,50 @@ type Enum struct { Name string Comment string Constants []Constant + NameTags map[string]string + ValidTags map[string]string +} + +func (e Enum) NameTag() string { + return TagsToString(e.NameTags) +} + +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 617ab42f76..2a63b6d342 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -2,25 +2,142 @@ package golang import ( "fmt" + "regexp" "sort" "strings" + + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type Field struct { - Name string + 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 + // EmbedFields contains the embedded fields that require scanning. + EmbedFields []Field } func (gf Field) Tag() string { - tags := make([]string, 0, len(gf.Tags)) - for key, val := range gf.Tags { - tags = append(tags, fmt.Sprintf("%s\"%s\"", key, val)) - } + return TagsToString(gf.Tags) +} + +func (gf Field) HasSqlcSlice() bool { + return gf.Column.IsSqlcSlice +} + +func TagsToString(tags map[string]string) string { if len(tags) == 0 { return "" } - sort.Strings(tags) - return strings.Join(tags, " ") + tagParts := make([]string, 0, len(tags)) + for key, val := range tags { + tagParts = append(tagParts, fmt.Sprintf("%s:%q", key, val)) + } + sort.Strings(tagParts) + return strings.Join(tagParts, " ") +} + +func JSONTagName(name string, options *opts.Options) string { + style := options.JsonTagsCaseStyle + idUppercase := options.JsonTagsIdUppercase + if style == "" || style == "none" { + return name + } else { + return SetJSONCaseStyle(name, style, idUppercase) + } +} + +func SetCaseStyle(name string, style string) string { + switch style { + case "camel": + return toCamelCase(name) + case "pascal": + return toPascalCase(name) + case "snake": + return toSnakeCase(name) + default: + panic(fmt.Sprintf("unsupported JSON tags case style: '%s'", style)) + } +} + +func SetJSONCaseStyle(name string, style string, idUppercase bool) string { + switch style { + case "camel": + return toJsonCamelCase(name, idUppercase) + case "pascal": + return toPascalCase(name) + case "snake": + return toSnakeCase(name) + default: + panic(fmt.Sprintf("unsupported JSON tags case style: '%s'", style)) + } +} + +var camelPattern = regexp.MustCompile("[^A-Z][A-Z]+") + +func toSnakeCase(s string) string { + if !strings.ContainsRune(s, '_') { + s = camelPattern.ReplaceAllStringFunc(s, func(x string) string { + return x[:1] + "_" + x[1:] + }) + } + return strings.ToLower(s) +} + +func toCamelCase(s string) string { + return toCamelInitCase(s, false) +} + +func toPascalCase(s string) string { + return toCamelInitCase(s, true) +} + +func toCamelInitCase(name string, initUpper bool) string { + out := "" + for i, p := range strings.Split(name, "_") { + if !initUpper && i == 0 { + out += p + continue + } + if p == "id" { + out += "ID" + } else { + out += strings.Title(p) + } + } + return out +} + +func toJsonCamelCase(name string, idUppercase bool) string { + out := "" + idStr := "Id" + + if idUppercase { + idStr = "ID" + } + + for i, p := range strings.Split(name, "_") { + if i == 0 { + out += p + continue + } + if p == "id" { + out += idStr + } else { + out += strings.Title(p) + } + } + return out +} + +func toLowerCase(str string) string { + if str == "" { + return "" + } + + return strings.ToLower(str[:1]) + str[1:] } diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 138a9f41cd..7df56a0a41 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -3,420 +3,248 @@ package golang import ( "bufio" "bytes" + "context" + "errors" "fmt" "go/format" "strings" "text/template" - "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "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 Generateable interface { - Structs(settings config.CombinedSettings) []Struct - GoQueries(settings config.CombinedSettings) []Query - Enums(settings config.CombinedSettings) []Enum -} - -var templateSet = ` -{{define "dbFile"}}// Code generated by sqlc. DO NOT EDIT. - -package {{.Package}} - -import ( - {{range imports .SourceName}} - {{range .}}{{.}} - {{end}} - {{end}} -) - -{{template "dbCode" . }} -{{end}} - -{{define "dbCode"}} -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 -} +type tmplCtx struct { + Q string + Package string + SQLDriver opts.SQLDriver + Enums []Enum + Structs []Struct + GoQueries []Query + SqlcVersion string -func New(db DBTX) *Queries { - return &Queries{db: db} -} + // TODO: Race conditions + SourceName string -{{if .EmitPreparedQueries}} -func Prepare(ctx context.Context, db DBTX) (*Queries, error) { - q := Queries{db: db} - var err error - {{- if eq (len .GoQueries) 0 }} - _ = err - {{- end }} - {{- range .GoQueries }} - if q.{{.FieldName}}, err = db.PrepareContext(ctx, {{.ConstantName}}); err != nil { - return nil, fmt.Errorf("error preparing query {{.MethodName}}: %w", err) - } - {{- end}} - return &q, nil + EmitJSONTags bool + JsonTagsIDUppercase bool + EmitDBTags bool + EmitPreparedQueries bool + EmitInterface bool + EmitEmptySlices bool + EmitMethodsWithDBArgument bool + EmitEnumValidMethod bool + EmitAllEnumValues bool + UsesCopyFrom bool + UsesBatch bool + OmitSqlcVersion bool + BuildTags string + WrapErrors bool } -func (q *Queries) Close() error { - var err error - {{- range .GoQueries }} - if q.{{.FieldName}} != nil { - if cerr := q.{{.FieldName}}.Close(); cerr != nil { - err = fmt.Errorf("error closing {{.FieldName}}: %w", cerr) - } - } - {{- end}} - return err +func (t *tmplCtx) OutputQuery(sourceName string) bool { + return t.SourceName == sourceName } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { - switch { - case stmt != nil && q.tx != nil: - return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) - case stmt != nil: - return stmt.ExecContext(ctx, args...) - default: - return q.db.ExecContext(ctx, query, args...) +func (t *tmplCtx) codegenDbarg() string { + if t.EmitMethodsWithDBArgument { + return "db DBTX, " } + return "" } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { - switch { - case stmt != nil && q.tx != nil: - return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) - case stmt != nil: - return stmt.QueryContext(ctx, args...) - default: - return q.db.QueryContext(ctx, query, args...) - } +// Called as a global method since subtemplate queryCodeStdExec does not have +// access to the toplevel tmplCtx +func (t *tmplCtx) codegenEmitPreparedQueries() bool { + return t.EmitPreparedQueries } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Row) { - switch { - case stmt != nil && q.tx != nil: - return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) - case stmt != nil: - return stmt.QueryRowContext(ctx, args...) - default: - return q.db.QueryRowContext(ctx, query, args...) +func (t *tmplCtx) codegenQueryMethod(q Query) string { + db := "q.db" + if t.EmitMethodsWithDBArgument { + db = "db" } -} -{{end}} -type Queries struct { - db DBTX + switch q.Cmd { + case ":one": + if t.EmitPreparedQueries { + return "q.queryRow" + } + return db + ".QueryRowContext" - {{- if .EmitPreparedQueries}} - tx *sql.Tx - {{- range .GoQueries}} - {{.FieldName}} *sql.Stmt - {{- end}} - {{- end}} -} + case ":many": + if t.EmitPreparedQueries { + return "q.query" + } + return db + ".QueryContext" -func (q *Queries) WithTx(tx *sql.Tx) *Queries { - return &Queries{ - db: tx, - {{- if .EmitPreparedQueries}} - tx: tx, - {{- range .GoQueries}} - {{.FieldName}}: q.{{.FieldName}}, - {{- end}} - {{- end}} + default: + if t.EmitPreparedQueries { + return "q.exec" + } + return db + ".ExecContext" } } -{{end}} - -{{define "interfaceFile"}}// Code generated by sqlc. DO NOT EDIT. - -package {{.Package}} - -import ( - {{range imports .SourceName}} - {{range .}}{{.}} - {{end}} - {{end}} -) - -{{template "interfaceCode" . }} -{{end}} - -{{define "interfaceCode"}} -type Querier interface { - {{- range .GoQueries}} - {{- if eq .Cmd ":one"}} - {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.Type}}, error) - {{- end}} - {{- if eq .Cmd ":many"}} - {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.Type}}, error) - {{- end}} - {{- if eq .Cmd ":exec"}} - {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error - {{- end}} - {{- if eq .Cmd ":execrows"}} - {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) - {{- end}} - {{- if eq .Cmd ":execresult"}} - {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (sql.Result, error) - {{- end}} - {{- end}} -} - -var _ Querier = (*Queries)(nil) -{{end}} - -{{define "modelsFile"}}// Code generated by sqlc. DO NOT EDIT. -package {{.Package}} - -import ( - {{range imports .SourceName}} - {{range .}}{{.}} - {{end}} - {{end}} -) - -{{template "modelsCode" . }} -{{end}} - -{{define "modelsCode"}} -{{range .Enums}} -{{if .Comment}}{{comment .Comment}}{{end}} -type {{.Name}} string - -const ( - {{- range .Constants}} - {{.Name}} {{.Type}} = "{{.Value}}" - {{- end}} -) - -func (e *{{.Name}}) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = {{.Name}}(s) - case string: - *e = {{.Name}}(s) +func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { + switch q.Cmd { + case ":one": + return "row :=", nil + case ":many": + return "rows, err :=", nil + case ":exec": + return "_, err :=", nil + case ":execrows", ":execlastid": + return "result, err :=", nil + case ":execresult": + if t.WrapErrors { + return "result, err :=", nil + } + return "return", nil default: - return fmt.Errorf("unsupported scan type for {{.Name}}: %T", src) + return "", fmt.Errorf("unhandled q.Cmd case %q", q.Cmd) } - return nil -} -{{end}} - -{{range .Structs}} -{{if .Comment}}{{comment .Comment}}{{end}} -type {{.Name}} struct { {{- range .Fields}} - {{- if .Comment}} - {{comment .Comment}}{{else}} - {{- end}} - {{.Name}} {{.Type}} {{if or ($.EmitJSONTags) ($.EmitDBTags)}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} - {{- end}} } -{{end}} -{{end}} -{{define "queryFile"}}// Code generated by sqlc. DO NOT EDIT. -// source: {{.SourceName}} +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { + options, err := opts.Parse(req) + if err != nil { + return nil, err + } -package {{.Package}} + if err := opts.ValidateOpts(options); err != nil { + return nil, err + } -import ( - {{range imports .SourceName}} - {{range .}}{{.}} - {{end}} - {{end}} -) + enums := buildEnums(req, options) + structs := buildStructs(req, options) + queries, err := buildQueries(req, options, structs) + if err != nil { + return nil, err + } -{{template "queryCode" . }} -{{end}} + if options.OmitUnusedStructs { + enums, structs = filterUnusedStructs(enums, structs, queries) + } -{{define "queryCode"}} -{{range .GoQueries}} -{{if $.OutputQuery .SourceName}} -const {{.ConstantName}} = {{$.Q}}-- name: {{.MethodName}} {{.Cmd}} -{{escape .SQL}} -{{$.Q}} + if err := validate(options, enums, structs, queries); err != nil { + return nil, err + } -{{if .Arg.EmitStruct}} -type {{.Arg.Type}} struct { {{- range .Arg.Struct.Fields}} - {{.Name}} {{.Type}} {{if or ($.EmitJSONTags) ($.EmitDBTags)}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} - {{- end}} + return generate(req, options, enums, structs, queries) } -{{end}} -{{if .Ret.EmitStruct}} -type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} - {{.Name}} {{.Type}} {{if or ($.EmitJSONTags) ($.EmitDBTags)}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} - {{- end}} -} -{{end}} - -{{if eq .Cmd ":one"}} -{{range .Comments}}//{{.}} -{{end -}} -func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.Type}}, error) { - {{- if $.EmitPreparedQueries}} - row := q.queryRow(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) - {{- else}} - row := q.db.QueryRowContext(ctx, {{.ConstantName}}, {{.Arg.Params}}) - {{- end}} - var {{.Ret.Name}} {{.Ret.Type}} - err := row.Scan({{.Ret.Scan}}) - return {{.Ret.Name}}, err -} -{{end}} - -{{if eq .Cmd ":many"}} -{{range .Comments}}//{{.}} -{{end -}} -func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.Type}}, error) { - {{- if $.EmitPreparedQueries}} - rows, err := q.query(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) - {{- else}} - rows, err := q.db.QueryContext(ctx, {{.ConstantName}}, {{.Arg.Params}}) - {{- end}} - if err != nil { - return nil, err +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{}{} } - defer rows.Close() - {{- if $.EmitEmptySlices}} - items := []{{.Ret.Type}}{} - {{else}} - var items []{{.Ret.Type}} - {{end -}} - for rows.Next() { - var {{.Ret.Name}} {{.Ret.Type}} - if err := rows.Scan({{.Ret.Scan}}); err != nil { - return nil, err + 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) } - items = append(items, {{.Ret.Name}}) + structNames[struckt.Name] = struct{}{} } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err + if !options.EmitExportedQueries { + return nil } - return items, nil -} -{{end}} - -{{if eq .Cmd ":exec"}} -{{range .Comments}}//{{.}} -{{end -}} -func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error { - {{- if $.EmitPreparedQueries}} - _, err := q.exec(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) - {{- else}} - _, err := q.db.ExecContext(ctx, {{.ConstantName}}, {{.Arg.Params}}) - {{- end}} - return err -} -{{end}} - -{{if eq .Cmd ":execrows"}} -{{range .Comments}}//{{.}} -{{end -}} -func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) { - {{- if $.EmitPreparedQueries}} - result, err := q.exec(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) - {{- else}} - result, err := q.db.ExecContext(ctx, {{.ConstantName}}, {{.Arg.Params}}) - {{- end}} - if err != nil { - return 0, err + 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 result.RowsAffected() -} -{{end}} - -{{if eq .Cmd ":execresult"}} -{{range .Comments}}//{{.}} -{{end -}} -func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (sql.Result, error) { - {{- if $.EmitPreparedQueries}} - return q.exec(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) - {{- else}} - return q.db.ExecContext(ctx, {{.ConstantName}}, {{.Arg.Params}}) - {{- end}} + return nil } -{{end}} -{{end}} -{{end}} -{{end}} -` -type tmplCtx struct { - Q string - Package string - Enums []Enum - Structs []Struct - GoQueries []Query - Settings config.Config - - // TODO: Race conditions - SourceName string +func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.GenerateResponse, error) { + i := &importer{ + Options: options, + Queries: queries, + Enums: enums, + Structs: structs, + } - EmitJSONTags bool - EmitDBTags bool - EmitPreparedQueries bool - EmitInterface bool - EmitEmptySlices bool -} + tctx := tmplCtx{ + EmitInterface: options.EmitInterface, + EmitJSONTags: options.EmitJsonTags, + JsonTagsIDUppercase: options.JsonTagsIdUppercase, + EmitDBTags: options.EmitDbTags, + EmitPreparedQueries: options.EmitPreparedQueries, + EmitEmptySlices: options.EmitEmptySlices, + EmitMethodsWithDBArgument: options.EmitMethodsWithDbArgument, + EmitEnumValidMethod: options.EmitEnumValidMethod, + EmitAllEnumValues: options.EmitAllEnumValues, + UsesCopyFrom: usesCopyFrom(queries), + UsesBatch: usesBatch(queries), + SQLDriver: parseDriver(options.SqlPackage), + Q: "`", + Package: options.Package, + Enums: enums, + Structs: structs, + SqlcVersion: req.SqlcVersion, + BuildTags: options.BuildTags, + OmitSqlcVersion: options.OmitSqlcVersion, + WrapErrors: options.WrapErrors, + } -func (t *tmplCtx) OutputQuery(sourceName string) bool { - return t.SourceName == sourceName -} + 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") + } -func Generate(r *compiler.Result, settings config.CombinedSettings) (map[string]string, error) { - enums := buildEnums(r, settings) - structs := buildStructs(r, settings) - queries := buildQueries(r, settings, structs) - return generate(settings, enums, structs, queries) -} + if tctx.UsesCopyFrom && options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { + if err := checkNoTimesForMySQLCopyFrom(queries); err != nil { + return nil, err + } + tctx.SQLDriver = opts.SQLDriverGoSQLDriverMySQL + } -func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, queries []Query) (map[string]string, error) { - i := &importer{ - Settings: settings, - Queries: queries, - Enums: enums, - Structs: structs, + if tctx.UsesBatch && !tctx.SQLDriver.IsPGX() { + return nil, errors.New(":batch* commands are only supported by pgx") } funcMap := template.FuncMap{ - "lowerTitle": codegen.LowerTitle, - "comment": codegen.DoubleSlashComment, - "escape": codegen.EscapeBacktick, + "lowerTitle": sdk.LowerTitle, + "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 + // (as that is language independent) + "dbarg": tctx.codegenDbarg, + "emitPreparedQueries": tctx.codegenEmitPreparedQueries, + "queryMethod": tctx.codegenQueryMethod, + "queryRetval": tctx.codegenQueryRetval, } - tmpl := template.Must(template.New("table").Funcs(funcMap).Parse(templateSet)) - - golang := settings.Go - tctx := tmplCtx{ - Settings: settings.Global, - EmitInterface: golang.EmitInterface, - EmitJSONTags: golang.EmitJSONTags, - EmitDBTags: golang.EmitDBTags, - EmitPreparedQueries: golang.EmitPreparedQueries, - EmitEmptySlices: golang.EmitEmptySlices, - Q: "`", - Package: golang.Package, - GoQueries: queries, - Enums: enums, - Structs: structs, - } + tmpl := template.Must( + template.New("table"). + Funcs(funcMap). + ParseFS( + templates, + "templates/*.tmpl", + "templates/*/*.tmpl", + ), + ) output := map[string]string{} execute := func(name, templateName string) error { + imports := i.Imports(name) + replacedQueries := replaceConflictedArg(imports, queries) + var b bytes.Buffer w := bufio.NewWriter(&b) tctx.SourceName = name + tctx.GoQueries = replacedQueries err := tmpl.ExecuteTemplate(w, templateName, &tctx) w.Flush() if err != nil { @@ -427,6 +255,11 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, fmt.Println(b.String()) return fmt.Errorf("source error: %w", err) } + + if templateName == "queryFile" && options.OutputFilesSuffix != "" { + name += options.OutputFilesSuffix + } + if !strings.HasSuffix(name, ".go") { name += ".go" } @@ -434,14 +267,46 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, return nil } - if err := execute("db.go", "dbFile"); err != nil { + dbFileName := "db.go" + if options.OutputDbFileName != "" { + dbFileName = options.OutputDbFileName + } + modelsFileName := "models.go" + if options.OutputModelsFileName != "" { + modelsFileName = options.OutputModelsFileName + } + querierFileName := "querier.go" + if options.OutputQuerierFileName != "" { + querierFileName = options.OutputQuerierFileName + } + copyfromFileName := "copyfrom.go" + if options.OutputCopyfromFileName != "" { + copyfromFileName = options.OutputCopyfromFileName + } + + batchFileName := "batch.go" + if options.OutputBatchFileName != "" { + batchFileName = options.OutputBatchFileName + } + + if err := execute(dbFileName, "dbFile"); err != nil { return nil, err } - if err := execute("models.go", "modelsFile"); err != nil { + if err := execute(modelsFileName, "modelsFile"); err != nil { return nil, err } - if golang.EmitInterface { - if err := execute("querier.go", "interfaceFile"); err != nil { + if options.EmitInterface { + if err := execute(querierFileName, "interfaceFile"); err != nil { + return nil, err + } + } + if tctx.UsesCopyFrom { + if err := execute(copyfromFileName, "copyfromFile"); err != nil { + return nil, err + } + } + if tctx.UsesBatch { + if err := execute(batchFileName, "batchFile"); err != nil { return nil, err } } @@ -456,5 +321,92 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, return nil, err } } - return output, nil + resp := plugin.GenerateResponse{} + + for filename, code := range output { + resp.Files = append(resp.Files, &plugin.File{ + Name: filename, + Contents: []byte(code), + }) + } + + return &resp, nil +} + +func usesCopyFrom(queries []Query) bool { + for _, q := range queries { + if q.Cmd == metadata.CmdCopyFrom { + return true + } + } + return false +} + +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 + } + } + } + return false +} + +func checkNoTimesForMySQLCopyFrom(queries []Query) error { + for _, q := range queries { + if q.Cmd != metadata.CmdCopyFrom { + continue + } + for _, f := range q.Arg.CopyFromMySQLFields() { + if f.Type == "time.Time" { + return fmt.Errorf("values with a timezone are not yet supported") + } + } + } + return nil +} + +func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query) ([]Enum, []Struct) { + keepTypes := make(map[string]struct{}) + + for _, query := range queries { + if !query.Arg.isEmpty() { + keepTypes[query.Arg.Type()] = struct{}{} + if query.Arg.IsStruct() { + for _, field := range query.Arg.Struct.Fields { + keepTypes[field.Type] = struct{}{} + } + } + } + if query.hasRetType() { + keepTypes[query.Ret.Type()] = struct{}{} + if query.Ret.IsStruct() { + for _, field := range query.Ret.Struct.Fields { + keepTypes[strings.TrimPrefix(field.Type, "[]")] = struct{}{} + for _, embedField := range field.EmbedFields { + keepTypes[embedField.Type] = struct{}{} + } + } + } + } + } + + keepEnums := make([]Enum, 0, len(enums)) + for _, enum := range enums { + _, keep := keepTypes[enum.Name] + _, keepNull := keepTypes["Null"+enum.Name] + if keep || keepNull { + keepEnums = append(keepEnums, enum) + } + } + + keepStructs := make([]Struct, 0, len(structs)) + for _, st := range structs { + if _, ok := keepTypes[st.Name]; ok { + keepStructs = append(keepStructs, st) + } + } + + return keepEnums, keepStructs } diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index 2736f5e4d0..c4aac84dd6 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -1,44 +1,94 @@ package golang import ( - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "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 goType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - // package overrides have a higher precedence - for _, oride := range settings.Overrides { - sameTable := sameTableName(col.Table, oride.Table, r.Catalog.DefaultSchema) - if oride.Column != "" && oride.ColumnName == col.Name && sameTable { - return oride.GoTypeName +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 override.MatchesColumn(col) { + for k, v := range oride.GoType.StructTags { + tags[k] = v + } + continue + } + if !override.Matches(col.Table, req.Catalog.DefaultSchema) { + // Different table. + continue + } + cname := col.Name + if col.OriginalName != "" { + cname = col.OriginalName + } + if !sdk.MatchString(oride.ColumnName, cname) { + // Different column. + continue + } + // Add the extra tags. + for k, v := range oride.GoType.StructTags { + tags[k] = v } } - typ := goInnerType(r, col, settings) - if col.IsArray { +} + +func goType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { + // Check if the column's type has been overridden + for _, override := range options.Overrides { + oride := override.ShimOverride + + if oride.GoType.TypeName == "" { + continue + } + cname := col.Name + if col.OriginalName != "" { + cname = col.OriginalName + } + sameTable := override.Matches(col.Table, req.Catalog.DefaultSchema) + if oride.Column != "" && sdk.MatchString(oride.ColumnName, cname) && sameTable { + if col.IsSqlcSlice { + return "[]" + oride.GoType.TypeName + } + return oride.GoType.TypeName + } + } + typ := goInnerType(req, options, col) + if col.IsSqlcSlice { return "[]" + typ } + if col.IsArray { + return strings.Repeat("[]", int(col.ArrayDims)) + typ + } return typ } -func goInnerType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - columnType := col.DataType - notNull := col.NotNull || col.IsArray - +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { // package overrides have a higher precedence - for _, oride := range settings.Overrides { - if oride.DBType != "" && oride.DBType == columnType && oride.Nullable != notNull { - return oride.GoTypeName + for _, override := range options.Overrides { + oride := override.ShimOverride + if oride.GoType.TypeName == "" { + continue + } + if override.MatchesColumn(col) { + return oride.GoType.TypeName } } // TODO: Extend the engine interface to handle types - switch settings.Package.Engine { - case config.EngineMySQL: - return mysqlType(r, col, settings) - case config.EnginePostgreSQL: - return postgresType(r, col, settings) - case config.EngineXLemon: - return sqliteType(r, col, settings) + switch req.Settings.Engine { + case "mysql": + return mysqlType(req, options, col) + case "postgresql": + return postgresType(req, options, col) + case "sqlite": + return sqliteType(req, options, col) default: return "interface{}" } diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index e60380abda..ccca4f603c 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -5,8 +5,8 @@ import ( "sort" "strings" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/metadata" ) type fileImports struct { @@ -21,9 +21,9 @@ type ImportSpec struct { func (s ImportSpec) String() string { if s.ID != "" { - return fmt.Sprintf("%s \"%s\"", s.ID, s.Path) + return fmt.Sprintf("%s %q", s.ID, s.Path) } else { - return fmt.Sprintf("\"%s\"", s.Path) + return fmt.Sprintf("%q", s.Path) } } @@ -58,17 +58,16 @@ func mergeImports(imps ...fileImports) [][]ImportSpec { } type importer struct { - Settings config.CombinedSettings - Queries []Query - Enums []Enum - Structs []Struct + Options *opts.Options + Queries []Query + Enums []Enum + Structs []Struct } func (i *importer) usesType(typ string) bool { for _, strct := range i.Structs { for _, f := range strct.Fields { - fType := strings.TrimPrefix(f.Type, "[]") - if strings.HasPrefix(fType, typ) { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, typ) { return true } } @@ -76,39 +75,73 @@ func (i *importer) usesType(typ string) bool { return false } -func (i *importer) usesArrays() bool { - for _, strct := range i.Structs { - for _, f := range strct.Fields { - if strings.HasPrefix(f.Type, "[]") { - return true - } - } - } - 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 != "" { + dbFileName = i.Options.OutputDbFileName + } + modelsFileName := "models.go" + if i.Options.OutputModelsFileName != "" { + modelsFileName = i.Options.OutputModelsFileName + } + querierFileName := "querier.go" + if i.Options.OutputQuerierFileName != "" { + querierFileName = i.Options.OutputQuerierFileName + } + copyfromFileName := "copyfrom.go" + if i.Options.OutputCopyfromFileName != "" { + copyfromFileName = i.Options.OutputCopyfromFileName + } + batchFileName := "batch.go" + if i.Options.OutputBatchFileName != "" { + batchFileName = i.Options.OutputBatchFileName + } + switch filename { - case "db.go": + case dbFileName: return mergeImports(i.dbImports()) - case "models.go": + case modelsFileName: return mergeImports(i.modelImports()) - case "querier.go": + case querierFileName: return mergeImports(i.interfaceImports()) + case copyfromFileName: + return mergeImports(i.copyfromImports()) + case batchFileName: + return mergeImports(i.batchImports()) default: return mergeImports(i.queryImports(filename)) } } func (i *importer) dbImports() fileImports { + var pkg []ImportSpec std := []ImportSpec{ {Path: "context"}, - {Path: "database/sql"}, } - if i.Settings.Go.EmitPreparedQueries { - std = append(std, ImportSpec{Path: "fmt"}) + + sqlpkg := parseDriver(i.Options.SqlPackage) + switch sqlpkg { + case opts.SQLDriverPGXV4: + pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgconn"}) + pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v4"}) + 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: + std = append(std, ImportSpec{Path: "database/sql"}) + if i.Options.EmitPreparedQueries { + std = append(std, ImportSpec{Path: "fmt"}) + } } - return fileImports{Std: std} + + sort.Slice(std, func(i, j int) bool { return std[i].Path < std[j].Path }) + sort.Slice(pkg, func(i, j int) bool { return pkg[i].Path < pkg[j].Path }) + return fileImports{Std: std, Dep: pkg} } var stdlibTypes = map[string]string{ @@ -116,49 +149,67 @@ var stdlibTypes = map[string]string{ "time.Time": "time", "net.IP": "net", "net.HardwareAddr": "net", + "netip.Addr": "net/netip", + "netip.Prefix": "net/netip", } -func (i *importer) interfaceImports() fileImports { - uses := func(name string) bool { - for _, q := range i.Queries { - if q.hasRetType() { - if strings.HasPrefix(q.Ret.Type(), name) { - return true - } - } - if !q.Arg.isEmpty() { - if strings.HasPrefix(q.Arg.Type(), name) { - return true - } - } - } - return false - } +var pqtypeTypes = map[string]struct{}{ + "pqtype.CIDR": {}, + "pqtype.Inet": {}, + "pqtype.Macaddr": {}, + "pqtype.NullRawMessage": {}, +} + +func buildImports(options *opts.Options, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { + pkg := make(map[ImportSpec]struct{}) + std := make(map[string]struct{}) - std := map[string]struct{}{ - "context": {}, - } if uses("sql.Null") { std["database/sql"] = struct{}{} } - for _, q := range i.Queries { + + sqlpkg := parseDriver(options.SqlPackage) + for _, q := range queries { if q.Cmd == metadata.CmdExecResult { - std["database/sql"] = struct{}{} + switch sqlpkg { + case opts.SQLDriverPGXV4: + pkg[ImportSpec{Path: "github.com/jackc/pgconn"}] = struct{}{} + case opts.SQLDriverPGXV5: + pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgconn"}] = struct{}{} + default: + std["database/sql"] = struct{}{} + } } } + for typeName, pkg := range stdlibTypes { if uses(typeName) { std[pkg] = struct{}{} } } - pkg := make(map[ImportSpec]struct{}) + if uses("pgtype.") { + if sqlpkg == opts.SQLDriverPGXV5 { + pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgtype"}] = struct{}{} + } else { + pkg[ImportSpec{Path: "github.com/jackc/pgtype"}] = struct{}{} + } + } + + for typeName := range pqtypeTypes { + if uses(typeName) { + pkg[ImportSpec{Path: "github.com/sqlc-dev/pqtype"}] = struct{}{} + break + } + } + overrideTypes := map[string]string{} - for _, o := range i.Settings.Overrides { - if o.GoBasicType { + for _, override := range options.Overrides { + o := override.ShimOverride + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } - overrideTypes[o.GoTypeName] = o.GoImportPath + overrideTypes[o.GoType.TypeName] = o.GoType.ImportPath } _, overrideNullTime := overrideTypes["pq.NullTime"] @@ -169,89 +220,77 @@ func (i *importer) interfaceImports() fileImports { if uses("uuid.UUID") && !overrideUUID { pkg[ImportSpec{Path: "github.com/google/uuid"}] = struct{}{} } + _, overrideNullUUID := overrideTypes["uuid.NullUUID"] + 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 i.Settings.Overrides { - if o.GoBasicType { + for _, override := range options.Overrides { + o := override.ShimOverride + + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } - _, alreadyImported := std[o.GoImportPath] - hasPackageAlias := o.GoPackage != "" - if (!alreadyImported || hasPackageAlias) && uses(o.GoTypeName) { - pkg[ImportSpec{Path: o.GoImportPath, ID: o.GoPackage}] = struct{}{} + _, alreadyImported := std[o.GoType.ImportPath] + hasPackageAlias := o.GoType.Package != "" + if (!alreadyImported || hasPackageAlias) && uses(o.GoType.TypeName) { + pkg[ImportSpec{Path: o.GoType.ImportPath, ID: o.GoType.Package}] = struct{}{} } } - pkgs := make([]ImportSpec, 0, len(pkg)) - for spec := range pkg { - pkgs = append(pkgs, spec) - } + return std, pkg +} - stds := make([]ImportSpec, 0, len(std)) - for path := range std { - stds = append(stds, ImportSpec{Path: path}) - } +func (i *importer) interfaceImports() fileImports { + std, pkg := buildImports(i.Options, i.Queries, func(name string) bool { + for _, q := range i.Queries { + if q.hasRetType() { + if usesBatch([]Query{q}) { + continue + } + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { + return true + } + } + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + return false + }) - sort.Slice(stds, func(i, j int) bool { return stds[i].Path < stds[j].Path }) - sort.Slice(pkgs, func(i, j int) bool { return pkgs[i].Path < pkgs[j].Path }) - return fileImports{stds, pkgs} + std["context"] = struct{}{} + + return sortedImports(std, pkg) } func (i *importer) modelImports() fileImports { - std := make(map[string]struct{}) - if i.usesType("sql.Null") { - std["database/sql"] = struct{}{} - } - for typeName, pkg := range stdlibTypes { - if i.usesType(typeName) { - std[pkg] = struct{}{} - } - } + std, pkg := buildImports(i.Options, nil, i.usesType) + if len(i.Enums) > 0 { std["fmt"] = struct{}{} + std["database/sql/driver"] = struct{}{} } - // Custom imports - pkg := make(map[ImportSpec]struct{}) - overrideTypes := map[string]string{} - for _, o := range i.Settings.Overrides { - if o.GoBasicType { - continue - } - overrideTypes[o.GoTypeName] = o.GoImportPath - } - - _, overrideNullTime := overrideTypes["pq.NullTime"] - if i.usesType("pq.NullTime") && !overrideNullTime { - pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} - } - - _, overrideUUID := overrideTypes["uuid.UUID"] - if i.usesType("uuid.UUID") && !overrideUUID { - pkg[ImportSpec{Path: "github.com/google/uuid"}] = struct{}{} - } - - for _, o := range i.Settings.Overrides { - if o.GoBasicType { - continue - } - _, alreadyImported := std[o.GoImportPath] - hasPackageAlias := o.GoPackage != "" - if (!alreadyImported || hasPackageAlias) && i.usesType(o.GoTypeName) { - pkg[ImportSpec{Path: o.GoImportPath, ID: o.GoPackage}] = struct{}{} - } - } + return sortedImports(std, pkg) +} +func sortedImports(std map[string]struct{}, pkg map[ImportSpec]struct{}) fileImports { pkgs := make([]ImportSpec, 0, len(pkg)) for spec := range pkg { pkgs = append(pkgs, spec) } - stds := make([]ImportSpec, 0, len(std)) for path := range std { stds = append(stds, ImportSpec{Path: path}) } - sort.Slice(stds, func(i, j int) bool { return stds[i].Path < stds[j].Path }) sort.Slice(pkgs, func(i, j int) bool { return pkgs[i].Path < pkgs[j].Path }) return fileImports{stds, pkgs} @@ -259,43 +298,50 @@ func (i *importer) modelImports() fileImports { func (i *importer) queryImports(filename string) fileImports { var gq []Query + anyNonCopyFrom := false for _, query := range i.Queries { + if usesBatch([]Query{query}) { + continue + } if query.SourceName == filename { gq = append(gq, query) + if query.Cmd != metadata.CmdCopyFrom { + anyNonCopyFrom = true + } } } - uses := func(name string) bool { + std, pkg := buildImports(i.Options, gq, func(name string) bool { for _, q := range gq { if q.hasRetType() { if q.Ret.EmitStruct() { for _, f := range q.Ret.Struct.Fields { - fType := strings.TrimPrefix(f.Type, "[]") - if strings.HasPrefix(fType, name) { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } - if strings.HasPrefix(q.Ret.Type(), name) { + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { return true } } - if !q.Arg.isEmpty() { - if q.Arg.EmitStruct() { - for _, f := range q.Arg.Struct.Fields { - fType := strings.TrimPrefix(f.Type, "[]") - if strings.HasPrefix(fType, name) { - return true - } + // Check the fields of the argument struct if it's emitted + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true } } - if strings.HasPrefix(q.Arg.Type(), name) { + } + // Check the argument pairs inside the method definition + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } return false - } + }) sliceScan := func() bool { for _, q := range gq { @@ -305,6 +351,11 @@ func (i *importer) queryImports(filename string) fileImports { if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" { return true } + for _, embed := range f.EmbedFields { + if strings.HasPrefix(embed.Type, "[]") && embed.Type != "[]byte" { + return true + } + } } } else { if strings.HasPrefix(q.Ret.Type(), "[]") && q.Ret.Type() != "[]byte" { @@ -315,12 +366,12 @@ func (i *importer) queryImports(filename string) fileImports { if !q.Arg.isEmpty() { if q.Arg.IsStruct() { for _, f := range q.Arg.Struct.Fields { - if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" { + if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !f.HasSqlcSlice() { return true } } } else { - if strings.HasPrefix(q.Arg.Type(), "[]") && q.Arg.Type() != "[]byte" { + if strings.HasPrefix(q.Arg.Type(), "[]") && q.Arg.Type() != "[]byte" && !q.Arg.HasSqlcSlices() { return true } } @@ -329,67 +380,147 @@ func (i *importer) queryImports(filename string) fileImports { return false } - std := map[string]struct{}{ - "context": {}, - } - if uses("sql.Null") { - std["database/sql"] = struct{}{} - } - for _, q := range gq { - if q.Cmd == metadata.CmdExecResult { - std["database/sql"] = struct{}{} - } - } - for typeName, pkg := range stdlibTypes { - if uses(typeName) { - std[pkg] = struct{}{} + // Search for sqlc.slice() calls + sqlcSliceScan := func() bool { + for _, q := range gq { + if q.Arg.HasSqlcSlices() { + return true + } } + return false } - pkg := make(map[ImportSpec]struct{}) - overrideTypes := map[string]string{} - for _, o := range i.Settings.Overrides { - if o.GoBasicType { - continue - } - overrideTypes[o.GoTypeName] = o.GoImportPath + if anyNonCopyFrom { + std["context"] = struct{}{} } - if sliceScan() { - pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} + sqlpkg := parseDriver(i.Options.SqlPackage) + if sqlcSliceScan() && !sqlpkg.IsPGX() { + std["strings"] = struct{}{} } - _, overrideNullTime := overrideTypes["pq.NullTime"] - if uses("pq.NullTime") && !overrideNullTime { + if sliceScan() && !sqlpkg.IsPGX() { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} } - _, overrideUUID := overrideTypes["uuid.UUID"] - if uses("uuid.UUID") && !overrideUUID { - pkg[ImportSpec{Path: "github.com/google/uuid"}] = struct{}{} + + if i.Options.WrapErrors { + std["fmt"] = struct{}{} } - // Custom imports - for _, o := range i.Settings.Overrides { - if o.GoBasicType { - continue + return sortedImports(std, pkg) +} + +func (i *importer) copyfromImports() fileImports { + copyFromQueries := make([]Query, 0, len(i.Queries)) + for _, q := range i.Queries { + if q.Cmd == metadata.CmdCopyFrom { + copyFromQueries = append(copyFromQueries, q) } - _, alreadyImported := std[o.GoImportPath] - hasPackageAlias := o.GoPackage != "" - if (!alreadyImported || hasPackageAlias) && uses(o.GoTypeName) { - pkg[ImportSpec{Path: o.GoImportPath, ID: o.GoPackage}] = struct{}{} + } + std, pkg := buildImports(i.Options, copyFromQueries, func(name string) bool { + for _, q := range copyFromQueries { + if q.hasRetType() { + if strings.HasPrefix(q.Ret.Type(), name) { + return true + } + } + if !q.Arg.isEmpty() { + if strings.HasPrefix(q.Arg.Type(), name) { + return true + } + } } + return false + }) + + std["context"] = struct{}{} + if i.Options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { + std["io"] = struct{}{} + std["fmt"] = struct{}{} + std["sync/atomic"] = struct{}{} + pkg[ImportSpec{Path: "github.com/go-sql-driver/mysql"}] = struct{}{} + pkg[ImportSpec{Path: "github.com/hexon/mysqltsv"}] = struct{}{} } - pkgs := make([]ImportSpec, 0, len(pkg)) - for spec := range pkg { - pkgs = append(pkgs, spec) + return sortedImports(std, pkg) +} + +func (i *importer) batchImports() fileImports { + batchQueries := make([]Query, 0, len(i.Queries)) + for _, q := range i.Queries { + if usesBatch([]Query{q}) { + batchQueries = append(batchQueries, q) + } + } + std, pkg := buildImports(i.Options, batchQueries, func(name string) bool { + for _, q := range batchQueries { + if q.hasRetType() { + if q.Ret.EmitStruct() { + for _, f := range q.Ret.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { + return true + } + } + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + return false + }) + + std["context"] = struct{}{} + std["errors"] = struct{}{} + sqlpkg := parseDriver(i.Options.SqlPackage) + switch sqlpkg { + case opts.SQLDriverPGXV4: + pkg[ImportSpec{Path: "github.com/jackc/pgx/v4"}] = struct{}{} + case opts.SQLDriverPGXV5: + pkg[ImportSpec{Path: "github.com/jackc/pgx/v5"}] = struct{}{} } - stds := make([]ImportSpec, 0, len(std)) - for path := range std { - stds = append(stds, ImportSpec{Path: path}) + return sortedImports(std, pkg) +} + +func trimSliceAndPointerPrefix(v string) string { + v = strings.TrimPrefix(v, "[]") + v = strings.TrimPrefix(v, "*") + return v +} + +func hasPrefixIgnoringSliceAndPointerPrefix(s, prefix string) bool { + trimmedS := trimSliceAndPointerPrefix(s) + trimmedPrefix := trimSliceAndPointerPrefix(prefix) + return strings.HasPrefix(trimmedS, trimmedPrefix) +} + +func replaceConflictedArg(imports [][]ImportSpec, queries []Query) []Query { + m := make(map[string]struct{}) + for _, is := range imports { + for _, i := range is { + paths := strings.Split(i.Path, "/") + m[paths[len(paths)-1]] = struct{}{} + } } - sort.Slice(stds, func(i, j int) bool { return stds[i].Path < stds[j].Path }) - sort.Slice(pkgs, func(i, j int) bool { return pkgs[i].Path < pkgs[j].Path }) - return fileImports{stds, pkgs} + replacedQueries := make([]Query, 0, len(queries)) + for _, query := range queries { + if _, exist := m[query.Arg.Name]; exist { + query.Arg.Name = toCamelCase(fmt.Sprintf("arg_%s", query.Arg.Name)) + } + replacedQueries = append(replacedQueries, query) + } + return replacedQueries } diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index 4a56d64f23..252e291f58 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,15 +3,16 @@ package golang import ( "log" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - columnType := col.DataType +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 switch columnType { @@ -22,34 +23,67 @@ func mysqlType(r *compiler.Result, col *compiler.Column, settings config.Combine return "sql.NullString" case "tinyint": - if col.Length != nil && *col.Length == 1 { + if col.Length == 1 { if notNull { return "bool" } return "sql.NullBool" } else { if notNull { - return "int32" + if unsigned { + return "uint8" + } + return "int8" + } + // 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 "year": + if notNull { + return "int16" + } + return "sql.NullInt16" + + case "smallint": + if notNull { + if unsigned { + return "uint16" } - return "sql.NullInt32" + return "int16" } + return "sql.NullInt16" - case "int", "integer", "smallint", "mediumint", "year": + case "int", "integer", "mediumint": if notNull { + if unsigned { + return "uint32" + } return "int32" } 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" + } return "int64" } return "sql.NullInt64" case "blob", "binary", "varbinary", "tinyblob", "mediumblob", "longblob": - return "[]byte" + if notNull { + return "[]byte" + } + return "sql.NullString" - case "double", "double precision", "real": + case "double", "double precision", "real", "float": if notNull { return "float64" } @@ -84,15 +118,19 @@ func mysqlType(r *compiler.Result, col *compiler.Column, settings config.Combine return "interface{}" default: - for _, schema := range r.Catalog.Schemas { - for _, typ := range schema.Types { - switch t := typ.(type) { - case *catalog.Enum: - if t.Name == columnType { - if schema.Name == r.Catalog.DefaultSchema { - return StructName(t.Name, settings) + for _, schema := range req.Catalog.Schemas { + for _, enum := range schema.Enums { + if enum.Name == columnType { + if notNull { + if schema.Name == req.Catalog.DefaultSchema { + return StructName(enum.Name, options) + } + return StructName(schema.Name+"_"+enum.Name, options) + } else { + if schema.Name == req.Catalog.DefaultSchema { + return "Null" + StructName(enum.Name, options) } - return StructName(schema.Name+"_"+t.Name, settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } 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/codegen/golang/opts/go_type.go b/internal/codegen/golang/opts/go_type.go new file mode 100644 index 0000000000..5dcb3e8af0 --- /dev/null +++ b/internal/codegen/golang/opts/go_type.go @@ -0,0 +1,192 @@ +package opts + +import ( + "encoding/json" + "fmt" + "go/types" + "regexp" + "strings" + + "github.com/fatih/structtag" +) + +type GoType struct { + Path string `json:"import" yaml:"import"` + Package string `json:"package" yaml:"package"` + Name string `json:"type" yaml:"type"` + Pointer bool `json:"pointer" yaml:"pointer"` + Slice bool `json:"slice" yaml:"slice"` + Spec string `json:"-"` + BuiltIn bool `json:"-"` +} + +type ParsedGoType struct { + ImportPath string + Package string + TypeName string + BasicType bool + 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 { + *o = GoType{Spec: spec} + return nil + } + type alias GoType + var a alias + if err := json.Unmarshal(data, &a); err != nil { + return err + } + *o = GoType(a) + return nil +} + +func (o *GoType) UnmarshalYAML(unmarshal func(interface{}) error) error { + var spec string + if err := unmarshal(&spec); err == nil { + *o = GoType{Spec: spec} + return nil + } + type alias GoType + var a alias + if err := unmarshal(&a); err != nil { + return err + } + *o = GoType(a) + return nil +} + +var validIdentifier = regexp.MustCompile(`^[a-zA-Z0-9_]+$`) +var versionNumber = regexp.MustCompile(`^v[0-9]+$`) +var invalidIdentifier = regexp.MustCompile(`[^a-zA-Z0-9_]`) + +func generatePackageID(importPath string) (string, bool) { + parts := strings.Split(importPath, "/") + name := parts[len(parts)-1] + // If the last part of the import path is a valid identifier, assume that's the package name + if versionNumber.MatchString(name) && len(parts) >= 2 { + name = parts[len(parts)-2] + return invalidIdentifier.ReplaceAllString(strings.ToLower(name), "_"), true + } + if validIdentifier.MatchString(name) { + return name, false + } + return invalidIdentifier.ReplaceAllString(strings.ToLower(name), "_"), true +} + +// validate GoType +func (gt GoType) parse() (*ParsedGoType, error) { + var o ParsedGoType + + if gt.Spec == "" { + // TODO: Validation + if gt.Path == "" && gt.Package != "" { + return nil, fmt.Errorf("Package override `go_type`: package name requires an import path") + } + var pkg string + var pkgNeedsAlias bool + + if gt.Package == "" && gt.Path != "" { + pkg, pkgNeedsAlias = generatePackageID(gt.Path) + if pkgNeedsAlias { + o.Package = pkg + } + } else { + pkg = gt.Package + o.Package = gt.Package + } + + o.ImportPath = gt.Path + o.TypeName = gt.Name + o.BasicType = gt.Path == "" && gt.Package == "" + if pkg != "" { + o.TypeName = pkg + "." + o.TypeName + } + if gt.Pointer { + o.TypeName = "*" + o.TypeName + } + if gt.Slice { + o.TypeName = "[]" + o.TypeName + } + return &o, nil + } + + input := gt.Spec + lastDot := strings.LastIndex(input, ".") + lastSlash := strings.LastIndex(input, "/") + typename := input + if lastDot == -1 && lastSlash == -1 { + // if the type name has no slash and no dot, validate that the type is a basic Go type + var found bool + for _, typ := range types.Typ { + info := typ.Info() + if info == 0 { + continue + } + if info&types.IsUntyped != 0 { + continue + } + if typename == typ.Name() { + found = true + } + } + if !found { + return nil, fmt.Errorf("Package override `go_type` specifier %q is not a Go basic type e.g. 'string'", input) + } + o.BasicType = true + } else { + // assume the type lives in a Go package + if lastDot == -1 { + return nil, fmt.Errorf("Package override `go_type` specifier %q is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'", input) + } + typename = input[lastSlash+1:] + // a package name beginning with "go-" will give syntax errors in + // generated code. We should do the right thing and get the actual + // import name, but in lieu of that, stripping the leading "go-" may get + // us what we want. + typename = strings.TrimPrefix(typename, "go-") + typename = strings.TrimSuffix(typename, "-go") + o.ImportPath = input[:lastDot] + } + o.TypeName = typename + isPointer := input[0] == '*' + if isPointer { + o.ImportPath = o.ImportPath[1:] + o.TypeName = "*" + o.TypeName + } + return &o, nil +} + +// GoStructTag is a raw Go struct tag. +type GoStructTag string + +// Parse parses and validates a GoStructTag. +// The output is in a form convenient for codegen. +// +// Sample valid inputs/outputs: +// +// In Out +// empty string {} +// `a:"b"` {"a": "b"} +// `a:"b" x:"y,z"` {"a": "b", "x": "y,z"} +func (s GoStructTag) parse() (map[string]string, error) { + m := make(map[string]string) + tags, err := structtag.Parse(string(s)) + if err != nil { + return nil, err + } + for _, tag := range tags.Tags() { + m[tag.Key] = tag.Value() + } + return m, nil +} diff --git a/internal/codegen/golang/opts/options.go b/internal/codegen/golang/opts/options.go new file mode 100644 index 0000000000..0d5d51c2dd --- /dev/null +++ b/internal/codegen/golang/opts/options.go @@ -0,0 +1,156 @@ +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"` + 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"` + 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") + } + } + + 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) + } + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } + 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") + } + + return nil +} diff --git a/internal/codegen/golang/opts/override.go b/internal/codegen/golang/opts/override.go new file mode 100644 index 0000000000..6916c0c7f3 --- /dev/null +++ b/internal/codegen/golang/opts/override.go @@ -0,0 +1,176 @@ +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/plugin" +) + +type Override struct { + // name of the golang type to use, e.g. `github.com/segmentio/ksuid.KSUID` + GoType GoType `json:"go_type" yaml:"go_type"` + + // additional Go struct tags to add to this field, in raw Go struct tag form, e.g. `validate:"required" x:"y,z"` + // see https://github.com/sqlc-dev/sqlc/issues/534 + GoStructTag GoStructTag `json:"go_struct_tag" yaml:"go_struct_tag"` + + // fully qualified name of the Go type, e.g. `github.com/segmentio/ksuid.KSUID` + DBType string `json:"db_type" yaml:"db_type"` + Deprecated_PostgresType string `json:"postgres_type" yaml:"postgres_type"` + + // for global overrides only when two different engines are in use + 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"` + + // True if the GoType should override if the matching type is unsiged. + Unsigned bool `json:"unsigned" yaml:"unsigned"` + + // Deprecated. Use the `nullable` property instead + Deprecated_Null bool `json:"null" yaml:"null"` + + // fully qualified name of the column, e.g. `accounts.id` + Column string `json:"column" yaml:"column"` + + 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 `json:"-"` + ShimOverride *ShimOverride `json:"-"` +} + +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) 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") + if o.DBType != "" { + return fmt.Errorf(`Type override configurations cannot have "db_type" and "postres_type" together. Use "db_type" alone`) + } + o.DBType = o.Deprecated_PostgresType + } + + // validate deprecated null field + if o.Deprecated_Null { + fmt.Fprintf(os.Stderr, "WARNING: \"null\" is deprecated. Instead, use the \"nullable\" field.\n") + o.Nullable = true + } + + schema := "public" + if req != nil && req.Catalog != nil { + schema = req.Catalog.DefaultSchema + } + + // validate option combinations + switch { + case o.Column != "" && o.DBType != "": + return fmt.Errorf("Override specifying both `column` (%q) and `db_type` (%q) is not valid.", o.Column, o.DBType) + case o.Column == "" && o.DBType == "": + return fmt.Errorf("Override must specify one of either `column` or `db_type`") + } + + // validate Column + if o.Column != "" { + colParts := strings.Split(o.Column, ".") + switch len(colParts) { + case 2: + if o.ColumnName, err = pattern.MatchCompile(colParts[1]); err != nil { + return err + } + if o.TableRel, err = pattern.MatchCompile(colParts[0]); err != nil { + return err + } + if o.TableSchema, err = pattern.MatchCompile(schema); err != nil { + return err + } + case 3: + if o.ColumnName, err = pattern.MatchCompile(colParts[2]); err != nil { + return err + } + if o.TableRel, err = pattern.MatchCompile(colParts[1]); err != nil { + return err + } + if o.TableSchema, err = pattern.MatchCompile(colParts[0]); err != nil { + return err + } + case 4: + if o.ColumnName, err = pattern.MatchCompile(colParts[3]); err != nil { + return err + } + if o.TableRel, err = pattern.MatchCompile(colParts[2]); err != nil { + return err + } + if o.TableSchema, err = pattern.MatchCompile(colParts[1]); err != nil { + return err + } + if o.TableCatalog, err = pattern.MatchCompile(colParts[0]); err != nil { + return err + } + default: + return fmt.Errorf("Override `column` specifier %q is not the proper format, expected '[catalog.][schema.]tablename.colname'", o.Column) + } + } + + // validate GoType + parsed, err := o.GoType.parse() + if err != nil { + return err + } + o.GoImportPath = parsed.ImportPath + o.GoPackage = parsed.Package + o.GoTypeName = parsed.TypeName + o.GoBasicType = parsed.BasicType + + // validate GoStructTag + 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 1e893626df..398d01e2e8 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -1,62 +1,146 @@ package golang import ( + "fmt" "log" + "strings" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 postgresType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - columnType := col.DataType +func parseIdentifierString(name string) (*plugin.Identifier, error) { + parts := strings.Split(name, ".") + switch len(parts) { + case 1: + return &plugin.Identifier{ + Name: parts[0], + }, nil + case 2: + return &plugin.Identifier{ + Schema: parts[0], + Name: parts[1], + }, nil + case 3: + return &plugin.Identifier{ + Catalog: parts[0], + Schema: parts[1], + Name: parts[2], + }, nil + default: + return nil, fmt.Errorf("invalid name: %s", name) + } +} + +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 switch columnType { case "serial", "serial4", "pg_catalog.serial4": if notNull { return "int32" } + if emitPointersForNull { + return "*int32" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int4" + } return "sql.NullInt32" case "bigserial", "serial8", "pg_catalog.serial8": if notNull { return "int64" } + if emitPointersForNull { + return "*int64" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int8" + } return "sql.NullInt64" case "smallserial", "serial2", "pg_catalog.serial2": - return "int16" + if notNull { + return "int16" + } + if emitPointersForNull { + return "*int16" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int2" + } + return "sql.NullInt16" case "integer", "int", "int4", "pg_catalog.int4": if notNull { return "int32" } + if emitPointersForNull { + return "*int32" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int4" + } return "sql.NullInt32" case "bigint", "int8", "pg_catalog.int8": if notNull { return "int64" } + if emitPointersForNull { + return "*int64" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int8" + } return "sql.NullInt64" case "smallint", "int2", "pg_catalog.int2": - return "int16" + if notNull { + return "int16" + } + if emitPointersForNull { + return "*int16" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Int2" + } + return "sql.NullInt16" case "float", "double precision", "float8", "pg_catalog.float8": if notNull { return "float64" } + if emitPointersForNull { + return "*float64" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Float8" + } return "sql.NullFloat64" case "real", "float4", "pg_catalog.float4": if notNull { return "float32" } + if emitPointersForNull { + return "*float32" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Float4" + } return "sql.NullFloat64" // TODO: Change to sql.NullFloat32 after updating the go.mod file case "numeric", "pg_catalog.numeric", "money": + if driver.IsPGX() { + return "pgtype.Numeric" + } // Since the Go standard library does not have a decimal type, lib/pq // returns numerics as strings. // @@ -64,52 +148,180 @@ func postgresType(r *compiler.Result, col *compiler.Column, settings config.Comb if notNull { return "string" } + if emitPointersForNull { + return "*string" + } return "sql.NullString" case "boolean", "bool", "pg_catalog.bool": if notNull { return "bool" } + if emitPointersForNull { + return "*bool" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Bool" + } return "sql.NullBool" - case "json", "jsonb": - return "json.RawMessage" + case "json", "pg_catalog.json": + switch driver { + case opts.SQLDriverPGXV5: + return "[]byte" + case opts.SQLDriverPGXV4: + return "pgtype.JSON" + case opts.SQLDriverLibPQ: + if notNull { + return "json.RawMessage" + } else { + return "pqtype.NullRawMessage" + } + default: + return "interface{}" + } + + case "jsonb", "pg_catalog.jsonb": + switch driver { + case opts.SQLDriverPGXV5: + return "[]byte" + case opts.SQLDriverPGXV4: + return "pgtype.JSONB" + case opts.SQLDriverLibPQ: + if notNull { + return "json.RawMessage" + } else { + return "pqtype.NullRawMessage" + } + default: + return "interface{}" + } case "bytea", "blob", "pg_catalog.bytea": return "[]byte" case "date": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Date" + } if notNull { return "time.Time" } + if emitPointersForNull { + return "*time.Time" + } return "sql.NullTime" - case "pg_catalog.time", "pg_catalog.timetz": + case "pg_catalog.time": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Time" + } if notNull { return "time.Time" } + if emitPointersForNull { + return "*time.Time" + } return "sql.NullTime" - case "pg_catalog.timestamp", "pg_catalog.timestamptz", "timestamptz": + case "pg_catalog.timetz": if notNull { return "time.Time" } + if emitPointersForNull { + return "*time.Time" + } + return "sql.NullTime" + + case "pg_catalog.timestamp", "timestamp": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Timestamp" + } + if notNull { + return "time.Time" + } + if emitPointersForNull { + return "*time.Time" + } return "sql.NullTime" - case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string": + case "pg_catalog.timestamptz", "timestamptz": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Timestamptz" + } + if notNull { + return "time.Time" + } + if emitPointersForNull { + return "*time.Time" + } + return "sql.NullTime" + + case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string", "citext", "name": if notNull { return "string" } + if emitPointersForNull { + return "*string" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Text" + } return "sql.NullString" case "uuid": - return "uuid.UUID" + if driver == opts.SQLDriverPGXV5 { + return "pgtype.UUID" + } + if notNull { + return "uuid.UUID" + } + if emitPointersForNull { + return "*uuid.UUID" + } + return "uuid.NullUUID" + + case "inet": + switch driver { + case opts.SQLDriverPGXV5: + if notNull { + return "netip.Addr" + } + return "*netip.Addr" + case opts.SQLDriverPGXV4: + return "pgtype.Inet" + case opts.SQLDriverLibPQ: + return "pqtype.Inet" + default: + return "interface{}" + } - case "inet", "cidr": - return "net.IP" + case "cidr": + switch driver { + case opts.SQLDriverPGXV5: + if notNull { + return "netip.Prefix" + } + return "*netip.Prefix" + case opts.SQLDriverPGXV4: + return "pgtype.CIDR" + case opts.SQLDriverLibPQ: + return "pqtype.CIDR" + default: + return "interface{}" + } case "macaddr", "macaddr8": - return "net.HardwareAddr" + switch driver { + case opts.SQLDriverPGXV5: + return "net.HardwareAddr" + case opts.SQLDriverPGXV4: + return "pgtype.Macaddr" + case opts.SQLDriverLibPQ: + return "pqtype.Macaddr" + default: + return "interface{}" + } case "ltree", "lquery", "ltxtquery": // This module implements a data type ltree for representing labels @@ -120,14 +332,221 @@ func postgresType(r *compiler.Result, col *compiler.Column, settings config.Comb if notNull { return "string" } + if emitPointersForNull { + return "*string" + } + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Text" + } return "sql.NullString" case "interval", "pg_catalog.interval": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Interval" + } if notNull { return "int64" } + if emitPointersForNull { + return "*int64" + } return "sql.NullInt64" + case "daterange": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Daterange" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Date]" + default: + return "interface{}" + } + + case "datemultirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Date]]" + default: + return "interface{}" + } + + case "tsrange": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Tsrange" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Timestamp]" + default: + return "interface{}" + } + + case "tsmultirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Timestamp]]" + default: + return "interface{}" + } + + case "tstzrange": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Tstzrange" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Timestamptz]" + default: + return "interface{}" + } + + case "tstzmultirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Timestamptz]]" + default: + return "interface{}" + } + + case "numrange": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Numrange" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Numeric]" + default: + return "interface{}" + } + + case "nummultirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Numeric]]" + default: + return "interface{}" + } + + case "int4range": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Int4range" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Int4]" + default: + return "interface{}" + } + + case "int4multirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Int4]]" + default: + return "interface{}" + } + + case "int8range": + switch driver { + case opts.SQLDriverPGXV4: + return "pgtype.Int8range" + case opts.SQLDriverPGXV5: + return "pgtype.Range[pgtype.Int8]" + default: + return "interface{}" + } + + case "int8multirange": + switch driver { + case opts.SQLDriverPGXV5: + return "pgtype.Multirange[pgtype.Range[pgtype.Int8]]" + default: + return "interface{}" + } + + case "hstore": + if driver.IsPGX() { + return "pgtype.Hstore" + } + return "interface{}" + + case "bit", "varbit", "pg_catalog.bit", "pg_catalog.varbit": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Bits" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.Varbit" + } + + case "cid": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint32" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.CID" + } + + case "oid": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint32" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.OID" + } + + case "tid": + if driver.IsPGX() { + return "pgtype.TID" + } + + case "xid": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint32" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.XID" + } + + case "box": + if driver.IsPGX() { + return "pgtype.Box" + } + + case "circle": + if driver.IsPGX() { + return "pgtype.Circle" + } + + case "line": + if driver.IsPGX() { + return "pgtype.Line" + } + + case "lseg": + if driver.IsPGX() { + return "pgtype.Lseg" + } + + case "path": + if driver.IsPGX() { + return "pgtype.Path" + } + + case "point": + if driver.IsPGX() { + return "pgtype.Point" + } + + case "polygon": + if driver.IsPGX() { + 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{}" @@ -136,39 +555,52 @@ func postgresType(r *compiler.Result, col *compiler.Column, settings config.Comb return "interface{}" default: - rel, err := compiler.ParseRelationString(columnType) + rel, err := parseIdentifierString(columnType) if err != nil { // TODO: Should this actually return an error here? return "interface{}" } if rel.Schema == "" { - rel.Schema = r.Catalog.DefaultSchema + rel.Schema = req.Catalog.DefaultSchema } - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { + for _, schema := range req.Catalog.Schemas { + if schema.Name == "pg_catalog" || schema.Name == "information_schema" { continue } - for _, typ := range schema.Types { - switch t := typ.(type) { - case *catalog.Enum: - if rel.Name == t.Name && rel.Schema == schema.Name { - if schema.Name == r.Catalog.DefaultSchema { - return StructName(t.Name, settings) + + for _, enum := range schema.Enums { + if rel.Name == enum.Name && rel.Schema == schema.Name { + if notNull { + if schema.Name == req.Catalog.DefaultSchema { + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+t.Name, settings) + return StructName(schema.Name+"_"+enum.Name, options) + } else { + if schema.Name == req.Catalog.DefaultSchema { + return "Null" + StructName(enum.Name, options) + } + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } - case *catalog.CompositeType: + } + } + + for _, ct := range schema.CompositeTypes { + if rel.Name == ct.Name && rel.Schema == schema.Name { if notNull { return "string" } + if emitPointersForNull { + return "*string" + } return "sql.NullString" } } } - if debug.Active { - log.Printf("unknown PostgreSQL type: %s\n", columnType) - } - return "interface{}" } + + if debug.Active { + log.Printf("unknown PostgreSQL type: %s\n", columnType) + } + return "interface{}" } diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index afade092d4..3b4fb2fa1a 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -1,16 +1,26 @@ package golang import ( + "fmt" "strings" - "github.com/kyleconroy/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type QueryValue struct { - Emit bool - Name string - Struct *Struct - Typ string + Emit bool + EmitPointer bool + Name string + DBName string // The name of the field in the database. Only set if Struct==nil. + Struct *Struct + Typ string + SQLDriver opts.SQLDriver + + // Column is kept so late in the generation process around to differentiate + // between mysql slices and pg arrays + Column *plugin.Column } func (v QueryValue) EmitStruct() bool { @@ -21,15 +31,56 @@ func (v QueryValue) IsStruct() bool { return v.Struct != nil } +func (v QueryValue) IsPointer() bool { + return v.EmitPointer && v.Struct != nil +} + func (v QueryValue) isEmpty() bool { return v.Typ == "" && v.Name == "" && v.Struct == nil } +type Argument struct { + Name string + Type string +} + func (v QueryValue) Pair() string { + var out []string + for _, arg := range v.Pairs() { + out = append(out, arg.Name+" "+arg.Type) + } + return strings.Join(out, ",") +} + +// Return the argument name and type for query methods. Should only be used in +// the context of method arguments. +func (v QueryValue) Pairs() []Argument { + if v.isEmpty() { + return nil + } + if !v.EmitStruct() && v.IsStruct() { + var out []Argument + for _, f := range v.Struct.Fields { + out = append(out, Argument{ + Name: escape(toLowerCase(f.Name)), + Type: f.Type, + }) + } + return out + } + return []Argument{ + { + Name: escape(v.Name), + Type: v.DefineType(), + }, + } +} + +func (v QueryValue) SlicePair() string { if v.isEmpty() { return "" } - return v.Name + " " + v.Type() + return v.Name + " []" + v.DefineType() } func (v QueryValue) Type() string { @@ -42,23 +93,53 @@ func (v QueryValue) Type() string { panic("no type for QueryValue: " + v.Name) } +func (v *QueryValue) DefineType() string { + t := v.Type() + if v.IsPointer() { + return "*" + t + } + return t +} + +func (v *QueryValue) ReturnName() string { + if v.IsPointer() { + return "&" + escape(v.Name) + } + return escape(v.Name) +} + +func (v QueryValue) UniqueFields() []Field { + seen := map[string]struct{}{} + fields := make([]Field, 0, len(v.Struct.Fields)) + + for _, field := range v.Struct.Fields { + if _, found := seen[field.Name]; found { + continue + } + seen[field.Name] = struct{}{} + fields = append(fields, field) + } + + return fields +} + func (v QueryValue) Params() string { if v.isEmpty() { return "" } var out []string if v.Struct == nil { - if strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" { - out = append(out, "pq.Array("+v.Name+")") + if !v.Column.IsSqlcSlice && strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && !v.SQLDriver.IsPGX() { + out = append(out, "pq.Array("+escape(v.Name)+")") } else { - out = append(out, v.Name) + out = append(out, escape(v.Name)) } } else { for _, f := range v.Struct.Fields { - if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" { - out = append(out, "pq.Array("+v.Name+"."+f.Name+")") + if !f.HasSqlcSlice() && strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !v.SQLDriver.IsPGX() { + out = append(out, "pq.Array("+escape(v.VariableForField(f))+")") } else { - out = append(out, v.Name+"."+f.Name) + out = append(out, escape(v.VariableForField(f))) } } } @@ -69,17 +150,70 @@ func (v QueryValue) Params() string { return "\n" + strings.Join(out, ",\n") } +func (v QueryValue) ColumnNames() []string { + if v.Struct == nil { + return []string{v.DBName} + } + names := make([]string, len(v.Struct.Fields)) + for i, f := range v.Struct.Fields { + names[i] = f.DBName + } + return names +} + +func (v QueryValue) ColumnNamesAsGoSlice() string { + if v.Struct == nil { + return fmt.Sprintf("[]string{%q}", v.DBName) + } + escapedNames := make([]string, len(v.Struct.Fields)) + for i, f := range v.Struct.Fields { + if f.Column != nil && f.Column.OriginalName != "" { + escapedNames[i] = fmt.Sprintf("%q", f.Column.OriginalName) + } else { + escapedNames[i] = fmt.Sprintf("%q", f.DBName) + } + } + return "[]string{" + strings.Join(escapedNames, ", ") + "}" +} + +// When true, we have to build the arguments to q.db.QueryContext in addition to +// munging the SQL +func (v QueryValue) HasSqlcSlices() bool { + if v.Struct == nil { + return v.Column != nil && v.Column.IsSqlcSlice + } + for _, v := range v.Struct.Fields { + if v.Column.IsSqlcSlice { + return true + } + } + return false +} + func (v QueryValue) Scan() string { var out []string if v.Struct == nil { - if strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" { + if strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && !v.SQLDriver.IsPGX() { out = append(out, "pq.Array(&"+v.Name+")") } else { out = append(out, "&"+v.Name) } } else { for _, f := range v.Struct.Fields { - if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" { + + // 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() { + out = append(out, "pq.Array(&"+v.Name+"."+f.Name+"."+embed.Name+")") + } else { + out = append(out, "&"+v.Name+"."+f.Name+"."+embed.Name) + } + } + continue + } + + if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !v.SQLDriver.IsPGX() { out = append(out, "pq.Array(&"+v.Name+"."+f.Name+")") } else { out = append(out, "&"+v.Name+"."+f.Name) @@ -93,6 +227,33 @@ func (v QueryValue) Scan() string { return "\n" + strings.Join(out, ",\n") } +// Deprecated: This method does not respect the Emit field set on the +// QueryValue. It's used by the go-sql-driver-mysql/copyfromCopy.tmpl and should +// not be used other places. +func (v QueryValue) CopyFromMySQLFields() []Field { + // fmt.Printf("%#v\n", v) + if v.Struct != nil { + return v.Struct.Fields + } + return []Field{ + { + Name: v.Name, + DBName: v.DBName, + Type: v.Typ, + }, + } +} + +func (v QueryValue) VariableForField(f Field) string { + if !v.IsStruct() { + return v.Name + } + if !v.EmitStruct() { + return toLowerCase(f.Name) + } + return v.Name + "." + f.Name +} + // A struct used to generate methods and fields on the Queries struct type Query struct { Cmd string @@ -104,9 +265,32 @@ type Query struct { SourceName string Ret QueryValue Arg QueryValue + // Used for :copyfrom + Table *plugin.Identifier } func (q Query) hasRetType() bool { - scanned := q.Cmd == metadata.CmdOne || q.Cmd == metadata.CmdMany + scanned := q.Cmd == metadata.CmdOne || q.Cmd == metadata.CmdMany || + q.Cmd == metadata.CmdBatchMany || q.Cmd == metadata.CmdBatchOne return scanned && !q.Ret.isEmpty() } + +func (q Query) TableIdentifierAsGoSlice() string { + escapedNames := make([]string, 0, 3) + for _, p := range []string{q.Table.Catalog, q.Table.Schema, q.Table.Name} { + if p != "" { + escapedNames = append(escapedNames, fmt.Sprintf("%q", p)) + } + } + return "[]string{" + strings.Join(escapedNames, ", ") + "}" +} + +func (q Query) TableIdentifierForMySQL() string { + escapedNames := make([]string, 0, 3) + for _, p := range []string{q.Table.Catalog, q.Table.Schema, q.Table.Name} { + if p != "" { + escapedNames = append(escapedNames, fmt.Sprintf("`%s`", p)) + } + } + return strings.Join(escapedNames, ".") +} diff --git a/internal/codegen/golang/reserved.go b/internal/codegen/golang/reserved.go new file mode 100644 index 0000000000..0461c4a2de --- /dev/null +++ b/internal/codegen/golang/reserved.go @@ -0,0 +1,67 @@ +package golang + +func escape(s string) string { + if IsReserved(s) { + return s + "_" + } + return s +} + +func IsReserved(s string) bool { + switch s { + case "break": + return true + case "default": + return true + case "func": + return true + case "interface": + return true + case "select": + return true + case "case": + return true + case "defer": + return true + case "go": + return true + case "map": + return true + case "struct": + return true + case "chan": + return true + case "else": + return true + case "goto": + return true + case "package": + return true + case "switch": + return true + case "const": + return true + case "fallthrough": + return true + case "if": + return true + case "range": + return true + case "type": + return true + case "continue": + return true + case "for": + return true + case "import": + return true + case "return": + 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 3c534b19f7..0820488f9d 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -1,45 +1,55 @@ package golang import ( + "bufio" "fmt" "sort" "strings" - "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/core" - "github.com/kyleconroy/sqlc/internal/inflection" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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(r *compiler.Result, settings config.CombinedSettings) []Enum { +func buildEnums(req *plugin.GenerateRequest, options *opts.Options) []Enum { var enums []Enum - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { + for _, schema := range req.Catalog.Schemas { + if schema.Name == "pg_catalog" || schema.Name == "information_schema" { continue } - for _, typ := range schema.Types { - enum, ok := typ.(*catalog.Enum) - if !ok { - continue - } + for _, enum := range schema.Enums { var enumName string - if schema.Name == r.Catalog.DefaultSchema { + if schema.Name == req.Catalog.DefaultSchema { enumName = enum.Name } else { enumName = schema.Name + "_" + enum.Name } + e := Enum{ - Name: StructName(enumName, settings), - Comment: enum.Comment, + Name: StructName(enumName, options), + Comment: enum.Comment, + NameTags: map[string]string{}, + ValidTags: map[string]string{}, } - for _, v := range enum.Vals { + if options.EmitJsonTags { + e.NameTags["json"] = JSONTagName(enumName, options) + e.ValidTags["json"] = JSONTagName("valid", options) + } + + seen := make(map[string]struct{}, len(enum.Vals)) + for i, v := range enum.Vals { + value := EnumReplace(v) + if _, found := seen[value]; found || value == "" { + value = fmt.Sprintf("value_%d", i) + } e.Constants = append(e.Constants, Constant{ - Name: StructName(enumName+"_"+EnumReplace(v), settings), + Name: StructName(enumName+"_"+value, options), Value: v, Type: e.Name, }) + seen[value] = struct{}{} } enums = append(enums, e) } @@ -50,39 +60,43 @@ func buildEnums(r *compiler.Result, settings config.CombinedSettings) []Enum { return enums } -func buildStructs(r *compiler.Result, settings config.CombinedSettings) []Struct { +func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { var structs []Struct - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { + for _, schema := range req.Catalog.Schemas { + if schema.Name == "pg_catalog" || schema.Name == "information_schema" { continue } for _, table := range schema.Tables { var tableName string - if schema.Name == r.Catalog.DefaultSchema { + if schema.Name == req.Catalog.DefaultSchema { tableName = table.Rel.Name } else { tableName = schema.Name + "_" + table.Rel.Name } structName := tableName - if !settings.Go.EmitExactTableNames { - structName = inflection.Singular(structName) + if !options.EmitExactTableNames { + structName = inflection.Singular(inflection.SingularParams{ + Name: structName, + Exclusions: options.InflectionExcludeTableNames, + }) } s := Struct{ - Table: core.FQN{Schema: schema.Name, Rel: table.Rel.Name}, - Name: StructName(structName, settings), + Table: &plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, + Name: StructName(structName, options), Comment: table.Comment, } for _, column := range table.Columns { tags := map[string]string{} - if settings.Go.EmitDBTags { - tags["db:"] = column.Name + if options.EmitDbTags { + tags["db"] = column.Name } - if settings.Go.EmitJSONTags { - tags["json:"] = column.Name + if options.EmitJsonTags { + tags["json"] = JSONTagName(column.Name, options) } + addExtraGoStructTags(tags, req, options, column) s.Fields = append(s.Fields, Field{ - Name: StructName(column.Name, settings), - Type: goType(r, compiler.ConvertColumn(table.Rel, column), settings), + Name: StructName(column.Name, options), + Type: goType(req, options, column), Tags: tags, Comment: column.Comment, }) @@ -98,17 +112,55 @@ func buildStructs(r *compiler.Result, settings config.CombinedSettings) []Struct type goColumn struct { id int - *compiler.Column + *plugin.Column + embed *goEmbed +} + +type goEmbed struct { + modelType string + modelName string + fields []Field } -func columnName(c *compiler.Column, pos int) string { +// look through all the structs and attempt to find a matching one to embed +// We need the name of the struct and its field names. +func newGoEmbed(embed *plugin.Identifier, structs []Struct, defaultSchema string) *goEmbed { + if embed == nil { + return nil + } + + for _, s := range structs { + embedSchema := defaultSchema + if embed.Schema != "" { + embedSchema = embed.Schema + } + + // compare the other attributes + if embed.Catalog != s.Table.Catalog || embed.Name != s.Table.Name || embedSchema != s.Table.Schema { + continue + } + + fields := make([]Field, len(s.Fields)) + copy(fields, s.Fields) + + return &goEmbed{ + modelType: s.Name, + modelName: s.Name, + fields: fields, + } + } + + return nil +} + +func columnName(c *plugin.Column, pos int) string { if c.Name != "" { return c.Name } return fmt.Sprintf("column_%d", pos+1) } -func paramName(p compiler.Parameter) string { +func paramName(p *plugin.Parameter) string { if p.Column.Name != "" { return argName(p.Column.Name) } @@ -129,9 +181,9 @@ func argName(name string) string { return out } -func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs []Struct) []Query { - qs := make([]Query, 0, len(r.Queries)) - for _, query := range r.Queries { +func buildQueries(req *plugin.GenerateRequest, options *opts.Options, structs []Struct) ([]Query, error) { + qs := make([]Query, 0, len(req.Queries)) + for _, query := range req.Queries { if query.Name == "" { continue } @@ -139,44 +191,90 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs continue } + var constantName string + if options.EmitExportedQueries { + constantName = sdk.Title(query.Name) + } else { + constantName = 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{ Cmd: query.Cmd, - ConstantName: codegen.LowerTitle(query.Name), - FieldName: codegen.LowerTitle(query.Name) + "Stmt", + ConstantName: constantName, + FieldName: sdk.LowerTitle(query.Name) + "Stmt", MethodName: query.Name, SourceName: query.Filename, - SQL: query.SQL, - Comments: query.Comments, + SQL: query.Text, + Comments: comments, + Table: query.InsertIntoTable, } + sqlpkg := parseDriver(options.SqlPackage) + + qpl := int(*options.QueryParameterLimit) - if len(query.Params) == 1 { + if len(query.Params) == 1 && qpl != 0 { p := query.Params[0] gq.Arg = QueryValue{ - Name: paramName(p), - Typ: goType(r, p.Column, settings), + Name: escape(paramName(p)), + DBName: p.Column.GetName(), + Typ: goType(req, options, p.Column), + SQLDriver: sqlpkg, + Column: p.Column, } - } else if len(query.Params) > 1 { + } else if len(query.Params) >= 1 { var cols []goColumn for _, p := range query.Params { cols = append(cols, goColumn{ - id: p.Number, + id: int(p.Number), Column: p.Column, }) } + s, err := columnsToStruct(req, options, gq.MethodName+"Params", cols, false) + if err != nil { + return nil, err + } gq.Arg = QueryValue{ - Emit: true, - Name: "arg", - Struct: columnsToStruct(r, gq.MethodName+"Params", cols, settings), + Emit: true, + Name: "arg", + Struct: s, + SQLDriver: sqlpkg, + EmitPointer: options.EmitParamsStructPointers, + } + + // 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 } } - if len(query.Columns) == 1 { + if len(query.Columns) == 1 && query.Columns[0].EmbedTable == nil { c := query.Columns[0] + name := columnName(c, 0) + name = strings.Replace(name, "$", "_", -1) gq.Ret = QueryValue{ - Name: columnName(c, 0), - Typ: goType(r, c, settings), + Name: escape(name), + DBName: name, + Typ: goType(req, options, c), + SQLDriver: sqlpkg, } - } else if len(query.Columns) > 1 { + } else if putOutColumns(query) { var gs *Struct var emit bool @@ -187,9 +285,9 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs same := true for i, f := range s.Fields { c := query.Columns[i] - sameName := f.Name == StructName(columnName(c, i), settings) - sameType := f.Type == goType(r, c, settings) - sameTable := sameTableName(c.Table, s.Table, r.Catalog.DefaultSchema) + 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 { same = false } @@ -206,47 +304,75 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs columns = append(columns, goColumn{ id: i, Column: c, + embed: newGoEmbed(c.EmbedTable, structs, req.Catalog.DefaultSchema), }) } - gs = columnsToStruct(r, gq.MethodName+"Row", columns, settings) + var err error + gs, err = columnsToStruct(req, options, gq.MethodName+"Row", columns, true) + if err != nil { + return nil, err + } emit = true } gq.Ret = QueryValue{ - Emit: emit, - Name: "i", - Struct: gs, + Emit: emit, + Name: "i", + Struct: gs, + SQLDriver: sqlpkg, + EmitPointer: options.EmitResultStructPointers, } } qs = append(qs, gq) } sort.Slice(qs, func(i, j int) bool { return qs[i].MethodName < qs[j].MethodName }) - return qs + return qs, nil +} + +var cmdReturnsData = map[string]struct{}{ + metadata.CmdBatchMany: {}, + metadata.CmdBatchOne: {}, + metadata.CmdMany: {}, + metadata.CmdOne: {}, +} + +func putOutColumns(query *plugin.Query) bool { + _, found := cmdReturnsData[query.Cmd] + return found } // It's possible that this method will generate duplicate JSON tag values // -// Columns: count, count, count_2 -// Fields: Count, Count_2, Count2 +// Columns: count, count, count_2 +// Fields: Count, Count_2, Count2 +// // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settings config.CombinedSettings) *Struct { +func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { gs := Struct{ Name: name, } - seen := map[string]int{} + seen := map[string][]int{} suffixes := map[int]int{} for i, c := range columns { colName := columnName(c.Column, i) tagName := colName - fieldName := StructName(colName, settings) + + // override col/tag with expected model name + if c.embed != nil { + colName = c.embed.modelName + tagName = SetCaseStyle(colName, "snake") + } + + 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. suffix := 0 - if o, ok := suffixes[c.id]; ok { + if o, ok := suffixes[c.id]; ok && useID { suffix = o - } else if v := seen[colName]; v > 0 { + } else if v := len(seen[fieldName]); v > 0 && !c.IsNamedParam { suffix = v + 1 } suffixes[c.id] = suffix @@ -255,18 +381,68 @@ func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settin fieldName = fmt.Sprintf("%s_%d", fieldName, suffix) } tags := map[string]string{} - if settings.Go.EmitDBTags { - tags["db:"] = tagName + if options.EmitDbTags { + tags["db"] = tagName + } + if options.EmitJsonTags { + tags["json"] = JSONTagName(tagName, options) } - if settings.Go.EmitJSONTags { - tags["json:"] = tagName + addExtraGoStructTags(tags, req, options, c.Column) + f := Field{ + Name: fieldName, + DBName: colName, + Tags: tags, + Column: c.Column, + } + if c.embed == nil { + f.Type = goType(req, options, c.Column) + } else { + f.Type = c.embed.modelType + f.EmbedFields = c.embed.fields + } + + gs.Fields = append(gs.Fields, f) + if _, found := seen[baseFieldName]; !found { + seen[baseFieldName] = []int{i} + } else { + seen[baseFieldName] = append(seen[baseFieldName], i) + } + } + + // If a field does not have a known type, but another + // 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{}" { + for _, j := range seen[field.Name] { + if i == j { + continue + } + otherField := gs.Fields[j] + if otherField.Type != field.Type { + field.Type = otherField.Type + } + gs.Fields[i] = field + } + } + } + + err := checkIncompatibleFieldTypes(gs.Fields) + if err != nil { + return nil, err + } + + return &gs, nil +} + +func checkIncompatibleFieldTypes(fields []Field) error { + fieldTypes := map[string]string{} + for _, field := range fields { + if fieldType, found := fieldTypes[field.Name]; !found { + fieldTypes[field.Name] = field.Type + } else if field.Type != fieldType { + return fmt.Errorf("named param %s has incompatible types: %s, %s", field.Name, field.Type, fieldType) } - gs.Fields = append(gs.Fields, Field{ - Name: fieldName, - Type: goType(r, c.Column, settings), - Tags: tags, - }) - seen[colName]++ } - return &gs + return nil } diff --git a/internal/codegen/golang/result_test.go b/internal/codegen/golang/result_test.go new file mode 100644 index 0000000000..0c58525ec3 --- /dev/null +++ b/internal/codegen/golang/result_test.go @@ -0,0 +1,78 @@ +package golang + +import ( + "testing" + + "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +func TestPutOutColumns_ForZeroColumns(t *testing.T) { + tests := []struct { + cmd string + want bool + }{ + { + cmd: metadata.CmdExec, + want: false, + }, + { + cmd: metadata.CmdExecResult, + want: false, + }, + { + cmd: metadata.CmdExecRows, + want: false, + }, + { + cmd: metadata.CmdExecLastId, + want: false, + }, + { + cmd: metadata.CmdMany, + want: true, + }, + { + cmd: metadata.CmdOne, + want: true, + }, + { + cmd: metadata.CmdCopyFrom, + want: false, + }, + { + cmd: metadata.CmdBatchExec, + want: false, + }, + { + cmd: metadata.CmdBatchMany, + want: true, + }, + { + cmd: metadata.CmdBatchOne, + want: true, + }, + } + for _, tc := range tests { + t.Run(tc.cmd, func(t *testing.T) { + query := &plugin.Query{ + Cmd: tc.cmd, + Columns: []*plugin.Column{}, + } + got := putOutColumns(query) + if got != tc.want { + t.Errorf("putOutColumns failed. want %v, got %v", tc.want, got) + } + }) + } +} + +func TestPutOutColumns_AlwaysTrueWhenQueryHasColumns(t *testing.T) { + query := &plugin.Query{ + Cmd: metadata.CmdMany, + Columns: []*plugin.Column{{}}, + } + if putOutColumns(query) != true { + t.Error("should be true when we have columns") + } +} diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index 505a74740c..8a22aaa262 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -4,21 +4,60 @@ import ( "log" "strings" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "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(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - dt := col.DataType +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 { - case "integer": + case "int", "integer", "tinyint", "smallint", "mediumint", "bigint", "unsignedbigint", "int2", "int8": if notNull { - return "int32" + return "int64" } - return "sql.NullInt32" + if emitPointersForNull { + return "*int64" + } + return "sql.NullInt64" + + case "blob": + return "[]byte" + + case "real", "double", "doubleprecision", "float": + 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{}" @@ -27,14 +66,36 @@ func sqliteType(r *compiler.Result, col *compiler.Column, settings config.Combin switch { - case strings.HasPrefix(dt, "varchar"): + case strings.HasPrefix(dt, "character"), + strings.HasPrefix(dt, "varchar"), + strings.HasPrefix(dt, "varyingcharacter"), + strings.HasPrefix(dt, "nchar"), + strings.HasPrefix(dt, "nativecharacter"), + strings.HasPrefix(dt, "nvarchar"), + dt == "text", + dt == "clob": 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: - log.Printf("unknown SQLite type: %s\n", dt) + if debug.Active { + log.Printf("unknown SQLite type: %s\n", dt) + } + return "interface{}" } diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 74be48e3f3..ed9311800e 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -2,29 +2,48 @@ package golang import ( "strings" + "unicode" + "unicode/utf8" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type Struct struct { - Table core.FQN + Table *plugin.Identifier Name string Fields []Field Comment string } -func StructName(name string, settings config.CombinedSettings) string { - if rename := settings.Rename[name]; rename != "" { +func StructName(name string, options *opts.Options) string { + if rename := options.Rename[name]; rename != "" { return rename } out := "" + name = strings.Map(func(r rune) rune { + if unicode.IsLetter(r) { + return r + } + if unicode.IsDigit(r) { + return r + } + return rune('_') + }, name) + for _, p := range strings.Split(name, "_") { - if p == "id" { - out += "ID" + if _, found := options.InitialismsMap[p]; found { + out += strings.ToUpper(p) } else { out += strings.Title(p) } } - return out + + // If a name has a digit as its first char, prepand an underscore to make it a valid Go name. + r, _ := utf8.DecodeRuneInString(out) + if unicode.IsDigit(r) { + return "_" + out + } else { + return out + } } diff --git a/internal/codegen/golang/template.go b/internal/codegen/golang/template.go new file mode 100644 index 0000000000..0aa7c9fa6a --- /dev/null +++ b/internal/codegen/golang/template.go @@ -0,0 +1,7 @@ +package golang + +import "embed" + +//go:embed templates/* +//go:embed templates/*/* +var templates embed.FS diff --git a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl new file mode 100644 index 0000000000..e21475b148 --- /dev/null +++ b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl @@ -0,0 +1,52 @@ +{{define "copyfromCodeGoSqlDriver"}} +{{range .GoQueries}} +{{if eq .Cmd ":copyfrom" }} +var readerHandlerSequenceFor{{.MethodName}} uint32 = 1 + +func convertRowsFor{{.MethodName}}(w *io.PipeWriter, {{.Arg.SlicePair}}) { + e := mysqltsv.NewEncoder(w, {{ len .Arg.CopyFromMySQLFields }}, nil) + for _, row := range {{.Arg.Name}} { +{{- with $arg := .Arg }} +{{- range $arg.CopyFromMySQLFields}} +{{- if eq .Type "string"}} + 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 $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) +{{- end}} +{{- end}} +{{- end}} + } + w.CloseWithError(e.Close()) +} + +{{range .Comments}}//{{.}} +{{end -}} +// {{.MethodName}} 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) {{.MethodName}}(ctx context.Context{{if $.EmitMethodsWithDBArgument}}, db DBTX{{end}}, {{.Arg.SlicePair}}) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("{{.MethodName}}_%d", atomic.AddUint32(&readerHandlerSequenceFor{{.MethodName}}, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsFor{{.MethodName}}(pw, {{.Arg.Name}}) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := {{if (not $.EmitMethodsWithDBArgument)}}q.{{end}}db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE {{.TableIdentifierForMySQL}} %s ({{range $index, $name := .Arg.ColumnNames}}{{if gt $index 0}}, {{end}}{{$name}}{{end}})", "Reader::" + rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} + +{{end}} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/pgx/batchCode.tmpl b/internal/codegen/golang/templates/pgx/batchCode.tmpl new file mode 100644 index 0000000000..35bd701bd3 --- /dev/null +++ b/internal/codegen/golang/templates/pgx/batchCode.tmpl @@ -0,0 +1,134 @@ +{{define "batchCodePgx"}} + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +{{range .GoQueries}} +{{if eq (hasPrefix .Cmd ":batch") true }} +const {{.ConstantName}} = {{$.Q}}-- name: {{.MethodName}} {{.Cmd}} +{{escape .SQL}} +{{$.Q}} + +type {{.MethodName}}BatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +{{if .Arg.Struct}} +type {{.Arg.Type}} struct { {{- range .Arg.Struct.Fields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} + +{{if .Ret.EmitStruct}} +type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} + +{{range .Comments}}//{{.}} +{{end -}} +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{}{ + {{- if .Arg.Struct }} + {{- range .Arg.Struct.Fields }} + a.{{.Name}}, + {{- end }} + {{- else }} + a, + {{- end }} + } + batch.Queue({{.ConstantName}}, vals...) + } + br := {{if not $.EmitMethodsWithDBArgument}}q.{{end}}db.SendBatch(ctx, batch) + return &{{.MethodName}}BatchResults{br,len({{.Arg.Name}}),false} +} + +{{if eq .Cmd ":batchexec"}} +func (b *{{.MethodName}}BatchResults) 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) + } + } +} +{{end}} + +{{if eq .Cmd ":batchmany"}} +func (b *{{.MethodName}}BatchResults) Query(f func(int, []{{.Ret.DefineType}}, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + {{- if $.EmitEmptySlices}} + items := []{{.Ret.DefineType}}{} + {{else}} + var items []{{.Ret.DefineType}} + {{end -}} + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var {{.Ret.Name}} {{.Ret.Type}} + if err := rows.Scan({{.Ret.Scan}}); err != nil { + return err + } + items = append(items, {{.Ret.ReturnName}}) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} +{{end}} + +{{if eq .Cmd ":batchone"}} +func (b *{{.MethodName}}BatchResults) QueryRow(f func(int, {{.Ret.DefineType}}, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var {{.Ret.Name}} {{.Ret.Type}} + if b.closed { + if f != nil { + f(t, {{if .Ret.IsPointer}}nil{{else}}{{.Ret.Name}}{{end}}, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan({{.Ret.Scan}}) + if f != nil { + f(t, {{.Ret.ReturnName}}, err) + } + } +} +{{end}} + +func (b *{{.MethodName}}BatchResults) Close() error { + b.closed = true + return b.br.Close() +} +{{end}} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl b/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl new file mode 100644 index 0000000000..c1cfa68d1d --- /dev/null +++ b/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl @@ -0,0 +1,51 @@ +{{define "copyfromCodePgx"}} +{{range .GoQueries}} +{{if eq .Cmd ":copyfrom" }} +// iteratorFor{{.MethodName}} implements pgx.CopyFromSource. +type iteratorFor{{.MethodName}} struct { + rows []{{.Arg.DefineType}} + skippedFirstNextCall bool +} + +func (r *iteratorFor{{.MethodName}}) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorFor{{.MethodName}}) Values() ([]interface{}, error) { + return []interface{}{ +{{- if .Arg.Struct }} +{{- range .Arg.Struct.Fields }} + r.rows[0].{{.Name}}, +{{- end }} +{{- else }} + r.rows[0], +{{- end }} + }, nil +} + +func (r iteratorFor{{.MethodName}}) Err() error { + return nil +} + +{{range .Comments}}//{{.}} +{{end -}} +{{- if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.SlicePair}}) (int64, error) { + return db.CopyFrom(ctx, {{.TableIdentifierAsGoSlice}}, {{.Arg.ColumnNamesAsGoSlice}}, &iteratorFor{{.MethodName}}{rows: {{.Arg.Name}}}) +{{- else -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.SlicePair}}) (int64, error) { + return q.db.CopyFrom(ctx, {{.TableIdentifierAsGoSlice}}, {{.Arg.ColumnNamesAsGoSlice}}, &iteratorFor{{.MethodName}}{rows: {{.Arg.Name}}}) +{{- end}} +} + +{{end}} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/pgx/dbCode.tmpl b/internal/codegen/golang/templates/pgx/dbCode.tmpl new file mode 100644 index 0000000000..236554d9f2 --- /dev/null +++ b/internal/codegen/golang/templates/pgx/dbCode.tmpl @@ -0,0 +1,37 @@ +{{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 +{{- if .UsesCopyFrom }} + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +{{- end }} +{{- if .UsesBatch }} + SendBatch(context.Context, *pgx.Batch) pgx.BatchResults +{{- end }} +} + +{{ if .EmitMethodsWithDBArgument}} +func New() *Queries { + return &Queries{} +{{- else -}} +func New(db DBTX) *Queries { + return &Queries{db: db} +{{- end}} +} + +type Queries struct { + {{if not .EmitMethodsWithDBArgument}} + db DBTX + {{end}} +} + +{{if not .EmitMethodsWithDBArgument}} +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/pgx/interfaceCode.tmpl b/internal/codegen/golang/templates/pgx/interfaceCode.tmpl new file mode 100644 index 0000000000..cf7cd36cb9 --- /dev/null +++ b/internal/codegen/golang/templates/pgx/interfaceCode.tmpl @@ -0,0 +1,73 @@ +{{define "interfaceCodePgx"}} + type Querier interface { + {{- $dbtxParam := .EmitMethodsWithDBArgument -}} + {{- range .GoQueries}} + {{- if and (eq .Cmd ":one") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) + {{- else if eq .Cmd ":one" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) + {{- end}} + {{- if and (eq .Cmd ":many") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) + {{- else if eq .Cmd ":many" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) + {{- end}} + {{- if and (eq .Cmd ":exec") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) error + {{- else if eq .Cmd ":exec" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error + {{- end}} + {{- if and (eq .Cmd ":execrows") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error) + {{- else if eq .Cmd ":execrows" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) + {{- end}} + {{- if and (eq .Cmd ":execresult") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) + {{- else if eq .Cmd ":execresult" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) + {{- end}} + {{- if and (eq .Cmd ":copyfrom") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.SlicePair}}) (int64, error) + {{- else if eq .Cmd ":copyfrom" }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.SlicePair}}) (int64, error) + {{- end}} + {{- if and (or (eq .Cmd ":batchexec") (eq .Cmd ":batchmany") (eq .Cmd ":batchone")) ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.SlicePair}}) *{{.MethodName}}BatchResults + {{- else if or (eq .Cmd ":batchexec") (eq .Cmd ":batchmany") (eq .Cmd ":batchone") }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.SlicePair}}) *{{.MethodName}}BatchResults + {{- end}} + + {{- end}} + } + + var _ Querier = (*Queries)(nil) +{{end}} diff --git a/internal/codegen/golang/templates/pgx/queryCode.tmpl b/internal/codegen/golang/templates/pgx/queryCode.tmpl new file mode 100644 index 0000000000..59a88c880a --- /dev/null +++ b/internal/codegen/golang/templates/pgx/queryCode.tmpl @@ -0,0 +1,142 @@ +{{define "queryCodePgx"}} +{{range .GoQueries}} +{{if $.OutputQuery .SourceName}} +{{if and (ne .Cmd ":copyfrom") (ne (hasPrefix .Cmd ":batch") true)}} +const {{.ConstantName}} = {{$.Q}}-- name: {{.MethodName}} {{.Cmd}} +{{escape .SQL}} +{{$.Q}} +{{end}} + +{{if ne (hasPrefix .Cmd ":batch") true}} +{{if .Arg.EmitStruct}} +type {{.Arg.Type}} struct { {{- range .Arg.Struct.Fields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} + +{{if .Ret.EmitStruct}} +type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} +{{end}} + +{{if eq .Cmd ":one"}} +{{range .Comments}}//{{.}} +{{end -}} +{{- if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) { + row := db.QueryRow(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- else -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) { + row := q.db.QueryRow(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- end}} + {{- if or (ne .Arg.Pair .Ret.Pair) (ne .Arg.DefineType .Ret.DefineType) }} + 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}} + +{{if eq .Cmd ":many"}} +{{range .Comments}}//{{.}} +{{end -}} +{{- if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) { + rows, err := db.Query(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- else -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) { + rows, err := q.db.Query(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- end}} + if err != nil { + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + defer rows.Close() + {{- if $.EmitEmptySlices}} + items := []{{.Ret.DefineType}}{} + {{else}} + var items []{{.Ret.DefineType}} + {{end -}} + for rows.Next() { + var {{.Ret.Name}} {{.Ret.Type}} + if err := rows.Scan({{.Ret.Scan}}); err != nil { + 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, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + return items, nil +} +{{end}} + +{{if eq .Cmd ":exec"}} +{{range .Comments}}//{{.}} +{{end -}} +{{- if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) error { + _, err := db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- else -}} +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}} + +{{if eq .Cmd ":execrows"}} +{{range .Comments}}//{{.}} +{{end -}} +{{if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error) { + result, err := db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- else -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) { + result, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- end}} + if err != nil { + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + return result.RowsAffected(), nil +} +{{end}} + +{{if eq .Cmd ":execresult"}} +{{range .Comments}}//{{.}} +{{end -}} +{{- if $.EmitMethodsWithDBArgument -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) { + {{queryRetval .}} db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) +{{- else -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) { + {{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}} + + +{{end}} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/stdlib/dbCode.tmpl b/internal/codegen/golang/templates/stdlib/dbCode.tmpl new file mode 100644 index 0000000000..7433d522f6 --- /dev/null +++ b/internal/codegen/golang/templates/stdlib/dbCode.tmpl @@ -0,0 +1,105 @@ +{{define "dbCodeTemplateStd"}} +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 +} + +{{ if .EmitMethodsWithDBArgument}} +func New() *Queries { + return &Queries{} +{{- else -}} +func New(db DBTX) *Queries { + return &Queries{db: db} +{{- end}} +} + +{{if .EmitPreparedQueries}} +func Prepare(ctx context.Context, db DBTX) (*Queries, error) { + q := Queries{db: db} + var err error + {{- if eq (len .GoQueries) 0 }} + _ = err + {{- end }} + {{- range .GoQueries }} + if q.{{.FieldName}}, err = db.PrepareContext(ctx, {{.ConstantName}}); err != nil { + return nil, fmt.Errorf("error preparing query {{.MethodName}}: %w", err) + } + {{- end}} + return &q, nil +} + +func (q *Queries) Close() error { + var err error + {{- range .GoQueries }} + if q.{{.FieldName}} != nil { + if cerr := q.{{.FieldName}}.Close(); cerr != nil { + err = fmt.Errorf("error closing {{.FieldName}}: %w", cerr) + } + } + {{- end}} + return err +} + +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) + case stmt != nil: + return stmt.ExecContext(ctx, args...) + default: + return q.db.ExecContext(ctx, query, args...) + } +} + +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) + case stmt != nil: + return stmt.QueryContext(ctx, args...) + default: + return q.db.QueryContext(ctx, query, args...) + } +} + +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Row) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) + case stmt != nil: + return stmt.QueryRowContext(ctx, args...) + default: + return q.db.QueryRowContext(ctx, query, args...) + } +} +{{end}} + +type Queries struct { + {{- if not .EmitMethodsWithDBArgument}} + db DBTX + {{- end}} + + {{- if .EmitPreparedQueries}} + tx *sql.Tx + {{- range .GoQueries}} + {{.FieldName}} *sql.Stmt + {{- end}} + {{- end}} +} + +{{if not .EmitMethodsWithDBArgument}} +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + {{- if .EmitPreparedQueries}} + tx: tx, + {{- range .GoQueries}} + {{.FieldName}}: q.{{.FieldName}}, + {{- end}} + {{- end}} + } +} +{{end}} +{{end}} diff --git a/internal/codegen/golang/templates/stdlib/interfaceCode.tmpl b/internal/codegen/golang/templates/stdlib/interfaceCode.tmpl new file mode 100644 index 0000000000..3cbefe6df4 --- /dev/null +++ b/internal/codegen/golang/templates/stdlib/interfaceCode.tmpl @@ -0,0 +1,63 @@ +{{define "interfaceCodeStd"}} + type Querier interface { + {{- $dbtxParam := .EmitMethodsWithDBArgument -}} + {{- range .GoQueries}} + {{- if and (eq .Cmd ":one") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) + {{- else if eq .Cmd ":one"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) + {{- end}} + {{- if and (eq .Cmd ":many") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) + {{- else if eq .Cmd ":many"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) + {{- end}} + {{- if and (eq .Cmd ":exec") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) error + {{- else if eq .Cmd ":exec"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error + {{- end}} + {{- if and (eq .Cmd ":execrows") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error) + {{- else if eq .Cmd ":execrows"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) + {{- end}} + {{- if and (eq .Cmd ":execlastid") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error) + {{- else if eq .Cmd ":execlastid"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error) + {{- end}} + {{- if and (eq .Cmd ":execresult") ($dbtxParam) }} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (sql.Result, error) + {{- else if eq .Cmd ":execresult"}} + {{range .Comments}}//{{.}} + {{end -}} + {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (sql.Result, error) + {{- end}} + {{- end}} + } + + var _ Querier = (*Queries)(nil) +{{end}} diff --git a/internal/codegen/golang/templates/stdlib/queryCode.tmpl b/internal/codegen/golang/templates/stdlib/queryCode.tmpl new file mode 100644 index 0000000000..1e7f4e22a4 --- /dev/null +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -0,0 +1,171 @@ +{{define "queryCodeStd"}} +{{range .GoQueries}} +{{if $.OutputQuery .SourceName}} +const {{.ConstantName}} = {{$.Q}}-- name: {{.MethodName}} {{.Cmd}} +{{escape .SQL}} +{{$.Q}} + +{{if .Arg.EmitStruct}} +type {{.Arg.Type}} struct { {{- range .Arg.UniqueFields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} + +{{if .Ret.EmitStruct}} +type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} + +{{if eq .Cmd ":one"}} +{{range .Comments}}//{{.}} +{{end -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) { + {{- template "queryCodeStdExec" . }} + {{- if or (ne .Arg.Pair .Ret.Pair) (ne .Arg.DefineType .Ret.DefineType) }} + 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}} + +{{if eq .Cmd ":many"}} +{{range .Comments}}//{{.}} +{{end -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) { + {{- template "queryCodeStdExec" . }} + if err != nil { + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + defer rows.Close() + {{- if $.EmitEmptySlices}} + items := []{{.Ret.DefineType}}{} + {{else}} + var items []{{.Ret.DefineType}} + {{end -}} + for rows.Next() { + var {{.Ret.Name}} {{.Ret.Type}} + if err := rows.Scan({{.Ret.Scan}}); err != nil { + 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, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + if err := rows.Err(); err != nil { + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + return items, nil +} +{{end}} + +{{if eq .Cmd ":exec"}} +{{range .Comments}}//{{.}} +{{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}} + +{{if eq .Cmd ":execrows"}} +{{range .Comments}}//{{.}} +{{end -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { + {{- template "queryCodeStdExec" . }} + if err != nil { + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + return result.RowsAffected() +} +{{end}} + +{{if eq .Cmd ":execlastid"}} +{{range .Comments}}//{{.}} +{{end -}} +func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { + {{- template "queryCodeStdExec" . }} + if err != nil { + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} + } + return result.LastInsertId() +} +{{end}} + +{{if eq .Cmd ":execresult"}} +{{range .Comments}}//{{.}} +{{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}} + +{{end}} +{{end}} +{{end}} + +{{define "queryCodeStdExec"}} + {{- if .Arg.HasSqlcSlices }} + query := {{.ConstantName}} + var queryParams []interface{} + {{- if .Arg.Struct }} + {{- $arg := .Arg }} + {{- range .Arg.Struct.Fields }} + {{- if .HasSqlcSlice }} + if len({{$arg.VariableForField .}}) > 0 { + for _, v := range {{$arg.VariableForField .}} { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:{{.Column.Name}}*/?", strings.Repeat(",?", len({{$arg.VariableForField .}}))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:{{.Column.Name}}*/?", "NULL", 1) + } + {{- else }} + queryParams = append(queryParams, {{$arg.VariableForField .}}) + {{- end }} + {{- end }} + {{- else }} + {{- /* Single argument parameter to this goroutine (they are not packed + in a struct), because .Arg.HasSqlcSlices further up above was true, + this section is 100% a slice (impossible to get here otherwise). + */}} + if len({{.Arg.Name}}) > 0 { + for _, v := range {{.Arg.Name}} { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", strings.Repeat(",?", len({{.Arg.Name}}))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", "NULL", 1) + } + {{- end }} + {{- if emitPreparedQueries }} + {{ queryRetval . }} {{ queryMethod . }}(ctx, nil, query, queryParams...) + {{- else}} + {{ queryRetval . }} {{ queryMethod . }}(ctx, query, queryParams...) + {{- end -}} + {{- else if emitPreparedQueries }} + {{- queryRetval . }} {{ queryMethod . }}(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) + {{- else}} + {{- queryRetval . }} {{ queryMethod . }}(ctx, {{.ConstantName}}, {{.Arg.Params}}) + {{- end -}} +{{end}} diff --git a/internal/codegen/golang/templates/template.tmpl b/internal/codegen/golang/templates/template.tmpl new file mode 100644 index 0000000000..afd50c01ac --- /dev/null +++ b/internal/codegen/golang/templates/template.tmpl @@ -0,0 +1,254 @@ +{{define "dbFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "dbCode" . }} +{{end}} + +{{define "dbCode"}} + +{{if .SQLDriver.IsPGX }} + {{- template "dbCodeTemplatePgx" .}} +{{else}} + {{- template "dbCodeTemplateStd" .}} +{{end}} + +{{end}} + +{{define "interfaceFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "interfaceCode" . }} +{{end}} + +{{define "interfaceCode"}} + {{if .SQLDriver.IsPGX }} + {{- template "interfaceCodePgx" .}} + {{else}} + {{- template "interfaceCodeStd" .}} + {{end}} +{{end}} + +{{define "modelsFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "modelsCode" . }} +{{end}} + +{{define "modelsCode"}} +{{range .Enums}} +{{if .Comment}}{{comment .Comment}}{{end}} +type {{.Name}} string + +const ( + {{- range .Constants}} + {{.Name}} {{.Type}} = "{{.Value}}" + {{- end}} +) + +func (e *{{.Name}}) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = {{.Name}}(s) + case string: + *e = {{.Name}}(s) + default: + return fmt.Errorf("unsupported scan type for {{.Name}}: %T", src) + } + return nil +} + +type Null{{.Name}} struct { + {{.Name}} {{.Name}} {{if .NameTag}}{{$.Q}}{{.NameTag}}{{$.Q}}{{end}} + Valid bool {{if .ValidTag}}{{$.Q}}{{.ValidTag}}{{$.Q}}{{end}} // Valid is true if {{.Name}} is not NULL +} + +// Scan implements the Scanner interface. +func (ns *Null{{.Name}}) Scan(value interface{}) error { + if value == nil { + ns.{{.Name}}, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.{{.Name}}.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns Null{{.Name}}) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.{{.Name}}), nil +} + + +{{ if $.EmitEnumValidMethod }} +func (e {{.Name}}) Valid() bool { + switch e { + case {{ range $idx, $name := .Constants }}{{ if ne $idx 0 }},{{ "\n" }}{{ end }}{{ .Name }}{{ end }}: + return true + } + return false +} +{{ end }} + +{{ if $.EmitAllEnumValues }} +func All{{ .Name }}Values() []{{ .Name }} { + return []{{ .Name }}{ {{ range .Constants}}{{ "\n" }}{{ .Name }},{{ end }} + } +} +{{ end }} +{{end}} + +{{range .Structs}} +{{if .Comment}}{{comment .Comment}}{{end}} +type {{.Name}} struct { {{- range .Fields}} + {{- if .Comment}} + {{comment .Comment}}{{else}} + {{- end}} + {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} + {{- end}} +} +{{end}} +{{end}} + +{{define "queryFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}}// source: {{.SourceName}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "queryCode" . }} +{{end}} + +{{define "queryCode"}} +{{if .SQLDriver.IsPGX }} + {{- template "queryCodePgx" .}} +{{else}} + {{- template "queryCodeStd" .}} +{{end}} +{{end}} + +{{define "copyfromFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}}// source: {{.SourceName}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "copyfromCode" . }} +{{end}} + +{{define "copyfromCode"}} +{{if .SQLDriver.IsPGX }} + {{- template "copyfromCodePgx" .}} +{{else if .SQLDriver.IsGoSQLDriverMySQL }} + {{- template "copyfromCodeGoSqlDriver" .}} +{{end}} +{{end}} + +{{define "batchFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: +// sqlc {{.SqlcVersion}} +{{end}}// source: {{.SourceName}} + +package {{.Package}} + +{{ if hasImports .SourceName }} +import ( + {{range imports .SourceName}} + {{range .}}{{.}} + {{end}} + {{end}} +) +{{end}} + +{{template "batchCode" . }} +{{end}} + +{{define "batchCode"}} +{{if .SQLDriver.IsPGX }} + {{- template "batchCodePgx" .}} +{{end}} +{{end}} diff --git a/internal/codegen/json/gen.go b/internal/codegen/json/gen.go new file mode 100644 index 0000000000..ad797efd92 --- /dev/null +++ b/internal/codegen/json/gen.go @@ -0,0 +1,68 @@ +package json + +import ( + "bytes" + "context" + ejson "encoding/json" + "fmt" + + "google.golang.org/protobuf/encoding/protojson" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +func parseOptions(req *plugin.GenerateRequest) (*opts, error) { + if len(req.PluginOptions) == 0 { + return new(opts), nil + } + + var options *opts + dec := ejson.NewDecoder(bytes.NewReader(req.PluginOptions)) + dec.DisallowUnknownFields() + if err := dec.Decode(&options); err != nil { + return options, fmt.Errorf("unmarshalling options: %s", err) + } + return options, nil +} + +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { + options, err := parseOptions(req) + if err != nil { + return nil, err + } + + indent := " " + if options.Indent != "" { + indent = options.Indent + } + + filename := "codegen_request.json" + if options.Filename != "" { + filename = options.Filename + } + + // The output of protojson has randomized whitespace + // https://github.com/golang/protobuf/issues/1082 + m := &protojson.MarshalOptions{ + EmitUnpopulated: true, + Indent: "", + UseProtoNames: true, + } + data, err := m.Marshal(req) + if err != nil { + return nil, err + } + var rm ejson.RawMessage = data + blob, err := ejson.MarshalIndent(rm, "", indent) + if err != nil { + return nil, err + } + return &plugin.GenerateResponse{ + Files: []*plugin.File{ + { + Name: filename, + Contents: append(blob, '\n'), + }, + }, + }, nil +} diff --git a/internal/codegen/json/opts.go b/internal/codegen/json/opts.go new file mode 100644 index 0000000000..9b3654b1f4 --- /dev/null +++ b/internal/codegen/json/opts.go @@ -0,0 +1,7 @@ +package json + +type opts struct { + Out string `json:"out"` + Indent string `json:"indent,omitempty"` + Filename string `json:"filename,omitempty"` +} diff --git a/internal/codegen/kotlin/gen.go b/internal/codegen/kotlin/gen.go deleted file mode 100644 index 54cd2a5413..0000000000 --- a/internal/codegen/kotlin/gen.go +++ /dev/null @@ -1,817 +0,0 @@ -package kotlin - -import ( - "bufio" - "bytes" - "fmt" - "regexp" - "sort" - "strings" - "text/template" - - "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/core" - "github.com/kyleconroy/sqlc/internal/inflection" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" -) - -func sameTableName(n *ast.TableName, f core.FQN) bool { - if n == nil { - return false - } - schema := n.Schema - if n.Schema == "" { - schema = "public" - } - return n.Catalog == n.Catalog && schema == f.Schema && n.Name == f.Rel -} - -var ktIdentPattern = regexp.MustCompile("[^a-zA-Z0-9_]+") - -type Constant struct { - Name string - Type string - Value string -} - -type Enum struct { - Name string - Comment string - Constants []Constant -} - -type Field struct { - Name string - Type ktType - Comment string -} - -type Struct struct { - Table core.FQN - Name string - Fields []Field - JDBCParamBindings []Field - Comment string -} - -type QueryValue struct { - Emit bool - Name string - Struct *Struct - Typ ktType - JDBCParamBindCount int -} - -func (v QueryValue) EmitStruct() bool { - return v.Emit -} - -func (v QueryValue) IsStruct() bool { - return v.Struct != nil -} - -func (v QueryValue) isEmpty() bool { - return v.Typ == (ktType{}) && v.Name == "" && v.Struct == nil -} - -func (v QueryValue) Type() string { - if v.Typ != (ktType{}) { - return v.Typ.String() - } - if v.Struct != nil { - return v.Struct.Name - } - panic("no type for QueryValue: " + v.Name) -} - -func jdbcSet(t ktType, idx int, name string) string { - if t.IsEnum && t.IsArray { - return fmt.Sprintf(`stmt.setArray(%d, conn.createArrayOf("%s", %s.map { v -> v.value }.toTypedArray()))`, idx, t.DataType, name) - } - if t.IsEnum { - if t.Engine == config.EnginePostgreSQL { - return fmt.Sprintf("stmt.setObject(%d, %s.value, %s)", idx, name, "Types.OTHER") - } else { - return fmt.Sprintf("stmt.setString(%d, %s.value)", idx, name) - } - } - if t.IsArray { - return fmt.Sprintf(`stmt.setArray(%d, conn.createArrayOf("%s", %s.toTypedArray()))`, idx, t.DataType, name) - } - if t.IsTime() { - return fmt.Sprintf("stmt.setObject(%d, %s)", idx, name) - } - if t.IsInstant() { - return fmt.Sprintf("stmt.setTimestamp(%d, Timestamp.from(%s))", idx, name) - } - return fmt.Sprintf("stmt.set%s(%d, %s)", t.Name, idx, name) -} - -type Params struct { - Struct *Struct -} - -func (v Params) isEmpty() bool { - return len(v.Struct.Fields) == 0 -} - -func (v Params) Args() string { - if v.isEmpty() { - return "" - } - var out []string - for _, f := range v.Struct.Fields { - out = append(out, f.Name+": "+f.Type.String()) - } - if len(out) < 3 { - return strings.Join(out, ", ") - } - return "\n" + indent(strings.Join(out, ",\n"), 6, -1) -} - -func (v Params) Bindings() string { - if v.isEmpty() { - return "" - } - var out []string - for i, f := range v.Struct.JDBCParamBindings { - out = append(out, jdbcSet(f.Type, i+1, f.Name)) - } - return indent(strings.Join(out, "\n"), 10, 0) -} - -func jdbcGet(t ktType, idx int) string { - if t.IsEnum && t.IsArray { - return fmt.Sprintf(`(results.getArray(%d).array as Array).map { v -> %s.lookup(v)!! }.toList()`, idx, t.Name) - } - if t.IsEnum { - return fmt.Sprintf("%s.lookup(results.getString(%d))!!", t.Name, idx) - } - if t.IsArray { - return fmt.Sprintf(`(results.getArray(%d).array as Array<%s>).toList()`, idx, t.Name) - } - if t.IsTime() { - return fmt.Sprintf(`results.getObject(%d, %s::class.java)`, idx, t.Name) - } - if t.IsInstant() { - return fmt.Sprintf(`results.getTimestamp(%d).toInstant()`, idx) - } - return fmt.Sprintf(`results.get%s(%d)`, t.Name, idx) -} - -func (v QueryValue) ResultSet() string { - var out []string - if v.Struct == nil { - return jdbcGet(v.Typ, 1) - } - for i, f := range v.Struct.Fields { - out = append(out, jdbcGet(f.Type, i+1)) - } - ret := indent(strings.Join(out, ",\n"), 4, -1) - ret = indent(v.Struct.Name+"(\n"+ret+"\n)", 12, 0) - return ret -} - -func indent(s string, n int, firstIndent int) string { - lines := strings.Split(s, "\n") - buf := bytes.NewBuffer(nil) - for i, l := range lines { - indent := n - if i == 0 && firstIndent != -1 { - indent = firstIndent - } - if i != 0 { - buf.WriteRune('\n') - } - for i := 0; i < indent; i++ { - buf.WriteRune(' ') - } - buf.WriteString(l) - } - return buf.String() -} - -// A struct used to generate methods and fields on the Queries struct -type Query struct { - ClassName string - Cmd string - Comments []string - MethodName string - FieldName string - ConstantName string - SQL string - SourceName string - Ret QueryValue - Arg Params -} - -func ktEnumValueName(value string) string { - id := strings.Replace(value, "-", "_", -1) - id = strings.Replace(id, ":", "_", -1) - id = strings.Replace(id, "/", "_", -1) - id = ktIdentPattern.ReplaceAllString(id, "") - return strings.ToUpper(id) -} - -func buildEnums(r *compiler.Result, settings config.CombinedSettings) []Enum { - var enums []Enum - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { - continue - } - for _, typ := range schema.Types { - enum, ok := typ.(*catalog.Enum) - if !ok { - continue - } - var enumName string - if schema.Name == r.Catalog.DefaultSchema { - enumName = enum.Name - } else { - enumName = schema.Name + "_" + enum.Name - } - e := Enum{ - Name: DataClassName(enumName, settings), - Comment: enum.Comment, - } - for _, v := range enum.Vals { - e.Constants = append(e.Constants, Constant{ - Name: ktEnumValueName(v), - Value: v, - Type: e.Name, - }) - } - enums = append(enums, e) - } - } - if len(enums) > 0 { - sort.Slice(enums, func(i, j int) bool { return enums[i].Name < enums[j].Name }) - } - return enums -} - -func DataClassName(name string, settings config.CombinedSettings) string { - if rename := settings.Rename[name]; rename != "" { - return rename - } - out := "" - for _, p := range strings.Split(name, "_") { - out += strings.Title(p) - } - return out -} - -func MemberName(name string, settings config.CombinedSettings) string { - return codegen.LowerTitle(DataClassName(name, settings)) -} - -func buildDataClasses(r *compiler.Result, settings config.CombinedSettings) []Struct { - var structs []Struct - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { - continue - } - for _, table := range schema.Tables { - var tableName string - if schema.Name == r.Catalog.DefaultSchema { - tableName = table.Rel.Name - } else { - tableName = schema.Name + "_" + table.Rel.Name - } - structName := DataClassName(tableName, settings) - if !settings.Go.EmitExactTableNames { - structName = inflection.Singular(structName) - } - s := Struct{ - Table: core.FQN{Schema: schema.Name, Rel: table.Rel.Name}, - Name: structName, - Comment: table.Comment, - } - for _, column := range table.Columns { - s.Fields = append(s.Fields, Field{ - Name: MemberName(column.Name, settings), - Type: makeType(r, compiler.ConvertColumn(table.Rel, column), settings), - Comment: column.Comment, - }) - } - structs = append(structs, s) - } - } - if len(structs) > 0 { - sort.Slice(structs, func(i, j int) bool { return structs[i].Name < structs[j].Name }) - } - return structs -} - -type ktType struct { - Name string - IsEnum bool - IsArray bool - IsNull bool - DataType string - Engine config.Engine -} - -func (t ktType) String() string { - v := t.Name - if t.IsArray { - v = fmt.Sprintf("List<%s>", v) - } else if t.IsNull { - v += "?" - } - return v -} - -func (t ktType) jdbcSetter() string { - return "set" + t.jdbcType() -} - -func (t ktType) jdbcType() string { - if t.IsArray { - return "Array" - } - if t.IsEnum || t.IsTime() { - return "Object" - } - if t.IsInstant() { - return "Timestamp" - } - return t.Name -} - -func (t ktType) IsTime() bool { - return t.Name == "LocalDate" || t.Name == "LocalDateTime" || t.Name == "LocalTime" || t.Name == "OffsetDateTime" -} - -func (t ktType) IsInstant() bool { - return t.Name == "Instant" -} - -func makeType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) ktType { - typ, isEnum := ktInnerType(r, col, settings) - return ktType{ - Name: typ, - IsEnum: isEnum, - IsArray: col.IsArray, - IsNull: !col.NotNull, - DataType: col.DataType, - Engine: settings.Package.Engine, - } -} - -func ktInnerType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) (string, bool) { - // TODO: Extend the engine interface to handle types - switch settings.Package.Engine { - case config.EngineMySQL: - return mysqlType(r, col, settings) - case config.EnginePostgreSQL: - return postgresType(r, col, settings) - default: - return "Any", false - } -} - -type goColumn struct { - id int - *compiler.Column -} - -func ktColumnsToStruct(r *compiler.Result, name string, columns []goColumn, settings config.CombinedSettings, namer func(*compiler.Column, int) string) *Struct { - gs := Struct{ - Name: name, - } - idSeen := map[int]Field{} - nameSeen := map[string]int{} - for _, c := range columns { - if binding, ok := idSeen[c.id]; ok { - gs.JDBCParamBindings = append(gs.JDBCParamBindings, binding) - continue - } - fieldName := MemberName(namer(c.Column, c.id), settings) - if v := nameSeen[c.Name]; v > 0 { - fieldName = fmt.Sprintf("%s_%d", fieldName, v+1) - } - field := Field{ - Name: fieldName, - Type: makeType(r, c.Column, settings), - } - gs.Fields = append(gs.Fields, field) - gs.JDBCParamBindings = append(gs.JDBCParamBindings, field) - nameSeen[c.Name]++ - idSeen[c.id] = field - } - return &gs -} - -func ktArgName(name string) string { - out := "" - for i, p := range strings.Split(name, "_") { - if i == 0 { - out += strings.ToLower(p) - } else { - out += strings.Title(p) - } - } - return out -} - -func ktParamName(c *compiler.Column, number int) string { - if c.Name != "" { - return ktArgName(c.Name) - } - return fmt.Sprintf("dollar_%d", number) -} - -func ktColumnName(c *compiler.Column, pos int) string { - if c.Name != "" { - return c.Name - } - return fmt.Sprintf("column_%d", pos+1) -} - -var postgresPlaceholderRegexp = regexp.MustCompile(`\B\$\d+\b`) - -// HACK: jdbc doesn't support numbered parameters, so we need to transform them to question marks... -// But there's no access to the SQL parser here, so we just do a dumb regexp replace instead. This won't work if -// the literal strings contain matching values, but good enough for a prototype. -func jdbcSQL(s string, engine config.Engine) string { - if engine == config.EnginePostgreSQL { - return postgresPlaceholderRegexp.ReplaceAllString(s, "?") - } - return s -} - -func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs []Struct) []Query { - qs := make([]Query, 0, len(r.Queries)) - for _, query := range r.Queries { - if query.Name == "" { - continue - } - if query.Cmd == "" { - continue - } - - gq := Query{ - Cmd: query.Cmd, - ClassName: strings.Title(query.Name), - ConstantName: codegen.LowerTitle(query.Name), - FieldName: codegen.LowerTitle(query.Name) + "Stmt", - MethodName: codegen.LowerTitle(query.Name), - SourceName: query.Filename, - SQL: jdbcSQL(query.SQL, settings.Package.Engine), - Comments: query.Comments, - } - - var cols []goColumn - for _, p := range query.Params { - cols = append(cols, goColumn{ - id: p.Number, - Column: p.Column, - }) - } - params := ktColumnsToStruct(r, gq.ClassName+"Bindings", cols, settings, ktParamName) - gq.Arg = Params{ - Struct: params, - } - - if len(query.Columns) == 1 { - c := query.Columns[0] - gq.Ret = QueryValue{ - Name: "results", - Typ: makeType(r, c, settings), - } - } else if len(query.Columns) > 1 { - var gs *Struct - var emit bool - - for _, s := range structs { - if len(s.Fields) != len(query.Columns) { - continue - } - same := true - for i, f := range s.Fields { - c := query.Columns[i] - sameName := f.Name == MemberName(ktColumnName(c, i), settings) - sameType := f.Type == makeType(r, c, settings) - sameTable := sameTableName(c.Table, s.Table) - - if !sameName || !sameType || !sameTable { - same = false - } - } - if same { - gs = &s - break - } - } - - if gs == nil { - var columns []goColumn - for i, c := range query.Columns { - columns = append(columns, goColumn{ - id: i, - Column: c, - }) - } - gs = ktColumnsToStruct(r, gq.ClassName+"Row", columns, settings, ktColumnName) - emit = true - } - gq.Ret = QueryValue{ - Emit: emit, - Name: "results", - Struct: gs, - } - } - - qs = append(qs, gq) - } - sort.Slice(qs, func(i, j int) bool { return qs[i].MethodName < qs[j].MethodName }) - return qs -} - -var ktIfaceTmpl = `// Code generated by sqlc. DO NOT EDIT. - -package {{.Package}} - -{{range imports .SourceName}} -{{range .}}import {{.}} -{{end}} -{{end}} - -interface Queries { - {{- range .Queries}} - @Throws(SQLException::class) - {{- if eq .Cmd ":one"}} - fun {{.MethodName}}({{.Arg.Args}}): {{.Ret.Type}}? - {{- end}} - {{- if eq .Cmd ":many"}} - fun {{.MethodName}}({{.Arg.Args}}): List<{{.Ret.Type}}> - {{- end}} - {{- if eq .Cmd ":exec"}} - fun {{.MethodName}}({{.Arg.Args}}) - {{- end}} - {{- if eq .Cmd ":execrows"}} - fun {{.MethodName}}({{.Arg.Args}}): Int - {{- end}} - {{- if eq .Cmd ":execresult"}} - fun {{.MethodName}}({{.Arg.Args}}): Long - {{- end}} - {{end}} -} -` - -var ktModelsTmpl = `// Code generated by sqlc. DO NOT EDIT. - -package {{.Package}} - -{{range imports .SourceName}} -{{range .}}import {{.}} -{{end}} -{{end}} - -{{range .Enums}} -{{if .Comment}}{{comment .Comment}}{{end}} -enum class {{.Name}}(val value: String) { - {{- range $i, $e := .Constants}} - {{- if $i }},{{end}} - {{.Name}}("{{.Value}}") - {{- end}}; - - companion object { - private val map = {{.Name}}.values().associateBy({{.Name}}::value) - fun lookup(value: String) = map[value] - } -} -{{end}} - -{{range .DataClasses}} -{{if .Comment}}{{comment .Comment}}{{end}} -data class {{.Name}} ( {{- range $i, $e := .Fields}} - {{- if $i }},{{end}} - {{- if .Comment}} - {{comment .Comment}}{{else}} - {{- end}} - val {{.Name}}: {{.Type}} - {{- end}} -) -{{end}} -` - -var ktSqlTmpl = `// Code generated by sqlc. DO NOT EDIT. - -package {{.Package}} - -{{range imports .SourceName}} -{{range .}}import {{.}} -{{end}} -{{end}} - -{{range .Queries}} -const val {{.ConstantName}} = {{$.Q}}-- name: {{.MethodName}} {{.Cmd}} -{{.SQL}} -{{$.Q}} - -{{if .Ret.EmitStruct}} -data class {{.Ret.Type}} ( {{- range $i, $e := .Ret.Struct.Fields}} - {{- if $i }},{{end}} - val {{.Name}}: {{.Type}} - {{- end}} -) -{{end}} -{{end}} - -class QueriesImpl(private val conn: Connection) : Queries { -{{range .Queries}} -{{if eq .Cmd ":one"}} -{{range .Comments}}//{{.}} -{{end}} - @Throws(SQLException::class) - override fun {{.MethodName}}({{.Arg.Args}}): {{.Ret.Type}}? { - return conn.prepareStatement({{.ConstantName}}).use { stmt -> - {{.Arg.Bindings}} - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = {{.Ret.ResultSet}} - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } -{{end}} - -{{if eq .Cmd ":many"}} -{{range .Comments}}//{{.}} -{{end}} - @Throws(SQLException::class) - override fun {{.MethodName}}({{.Arg.Args}}): List<{{.Ret.Type}}> { - return conn.prepareStatement({{.ConstantName}}).use { stmt -> - {{.Arg.Bindings}} - - val results = stmt.executeQuery() - val ret = mutableListOf<{{.Ret.Type}}>() - while (results.next()) { - ret.add({{.Ret.ResultSet}}) - } - ret - } - } -{{end}} - -{{if eq .Cmd ":exec"}} -{{range .Comments}}//{{.}} -{{end}} - @Throws(SQLException::class) - {{ if $.EmitInterface }}override {{ end -}} - override fun {{.MethodName}}({{.Arg.Args}}) { - conn.prepareStatement({{.ConstantName}}).use { stmt -> - {{ .Arg.Bindings }} - - stmt.execute() - } - } -{{end}} - -{{if eq .Cmd ":execrows"}} -{{range .Comments}}//{{.}} -{{end}} - @Throws(SQLException::class) - {{ if $.EmitInterface }}override {{ end -}} - override fun {{.MethodName}}({{.Arg.Args}}): Int { - return conn.prepareStatement({{.ConstantName}}).use { stmt -> - {{ .Arg.Bindings }} - - stmt.execute() - stmt.updateCount - } - } -{{end}} - -{{if eq .Cmd ":execresult"}} -{{range .Comments}}//{{.}} -{{end}} - @Throws(SQLException::class) - {{ if $.EmitInterface }}override {{ end -}} - override fun {{.MethodName}}({{.Arg.Args}}): Long { - return conn.prepareStatement({{.ConstantName}}, Statement.RETURN_GENERATED_KEYS).use { stmt -> - {{ .Arg.Bindings }} - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } -{{end}} -{{end}} -} -` - -type ktTmplCtx struct { - Q string - Package string - Enums []Enum - DataClasses []Struct - Queries []Query - Settings config.Config - - // TODO: Race conditions - SourceName string - - EmitJSONTags bool - EmitPreparedQueries bool - EmitInterface bool -} - -func Offset(v int) int { - return v + 1 -} - -func ktFormat(s string) string { - // TODO: do more than just skip multiple blank lines, like maybe run ktlint to format - skipNextSpace := false - var lines []string - for _, l := range strings.Split(s, "\n") { - isSpace := len(strings.TrimSpace(l)) == 0 - if !isSpace || !skipNextSpace { - lines = append(lines, l) - } - skipNextSpace = isSpace - } - o := strings.Join(lines, "\n") - o += "\n" - return o -} - -func Generate(r *compiler.Result, settings config.CombinedSettings) (map[string]string, error) { - enums := buildEnums(r, settings) - structs := buildDataClasses(r, settings) - queries := buildQueries(r, settings, structs) - - i := &importer{ - Settings: settings, - Enums: enums, - DataClasses: structs, - Queries: queries, - } - - funcMap := template.FuncMap{ - "lowerTitle": codegen.LowerTitle, - "comment": codegen.DoubleSlashComment, - "imports": i.Imports, - "offset": Offset, - } - - modelsFile := template.Must(template.New("table").Funcs(funcMap).Parse(ktModelsTmpl)) - sqlFile := template.Must(template.New("table").Funcs(funcMap).Parse(ktSqlTmpl)) - ifaceFile := template.Must(template.New("table").Funcs(funcMap).Parse(ktIfaceTmpl)) - - pkg := settings.Package - tctx := ktTmplCtx{ - Settings: settings.Global, - Q: `"""`, - Package: pkg.Gen.Kotlin.Package, - Queries: queries, - Enums: enums, - DataClasses: structs, - } - - output := map[string]string{} - - execute := func(name string, t *template.Template) error { - var b bytes.Buffer - w := bufio.NewWriter(&b) - tctx.SourceName = name - err := t.Execute(w, tctx) - w.Flush() - if err != nil { - return err - } - if !strings.HasSuffix(name, ".kt") { - name += ".kt" - } - output[name] = ktFormat(b.String()) - return nil - } - - if err := execute("Models.kt", modelsFile); err != nil { - return nil, err - } - if err := execute("Queries.kt", ifaceFile); err != nil { - return nil, err - } - if err := execute("QueriesImpl.kt", sqlFile); err != nil { - return nil, err - } - - return output, nil -} diff --git a/internal/codegen/kotlin/imports.go b/internal/codegen/kotlin/imports.go deleted file mode 100644 index 31f2e5b86e..0000000000 --- a/internal/codegen/kotlin/imports.go +++ /dev/null @@ -1,172 +0,0 @@ -package kotlin - -import ( - "sort" - "strings" - - "github.com/kyleconroy/sqlc/internal/config" -) - -type importer struct { - Settings config.CombinedSettings - DataClasses []Struct - Enums []Enum - Queries []Query -} - -func (i *importer) usesType(typ string) bool { - for _, strct := range i.DataClasses { - for _, f := range strct.Fields { - if f.Type.Name == typ { - return true - } - } - } - return false -} - -func (i *importer) Imports(filename string) [][]string { - switch filename { - case "Models.kt": - return i.modelImports() - case "Querier.kt": - return i.interfaceImports() - default: - return i.queryImports(filename) - } -} - -func (i *importer) interfaceImports() [][]string { - uses := func(name string) bool { - for _, q := range i.Queries { - if !q.Ret.isEmpty() { - if strings.HasPrefix(q.Ret.Type(), name) { - return true - } - } - if !q.Arg.isEmpty() { - for _, f := range q.Arg.Struct.Fields { - if strings.HasPrefix(f.Type.Name, name) { - return true - } - } - } - } - return false - } - - std := stdImports(uses) - stds := make([]string, 0, len(std)) - for s := range std { - stds = append(stds, s) - } - - sort.Strings(stds) - return [][]string{stds} -} - -func (i *importer) modelImports() [][]string { - std := make(map[string]struct{}) - if i.usesType("Instant") { - std["java.time.Instant"] = struct{}{} - std["java.sql.Timestamp"] = struct{}{} - } - if i.usesType("LocalDate") { - std["java.time.LocalDate"] = struct{}{} - } - if i.usesType("LocalTime") { - std["java.time.LocalTime"] = struct{}{} - } - if i.usesType("LocalDateTime") { - std["java.time.LocalDateTime"] = struct{}{} - } - if i.usesType("OffsetDateTime") { - std["java.time.OffsetDateTime"] = struct{}{} - } - - stds := make([]string, 0, len(std)) - for s := range std { - stds = append(stds, s) - } - - sort.Strings(stds) - return [][]string{stds} -} - -func stdImports(uses func(name string) bool) map[string]struct{} { - std := map[string]struct{}{ - "java.sql.SQLException": {}, - "java.sql.Statement": {}, - } - if uses("Instant") { - std["java.time.Instant"] = struct{}{} - std["java.sql.Timestamp"] = struct{}{} - } - if uses("LocalDate") { - std["java.time.LocalDate"] = struct{}{} - } - if uses("LocalTime") { - std["java.time.LocalTime"] = struct{}{} - } - if uses("LocalDateTime") { - std["java.time.LocalDateTime"] = struct{}{} - } - if uses("OffsetDateTime") { - std["java.time.OffsetDateTime"] = struct{}{} - } - return std -} - -func (i *importer) queryImports(filename string) [][]string { - uses := func(name string) bool { - for _, q := range i.Queries { - if !q.Ret.isEmpty() { - if q.Ret.Struct != nil { - for _, f := range q.Ret.Struct.Fields { - if f.Type.Name == name { - return true - } - } - } - if q.Ret.Type() == name { - return true - } - } - if !q.Arg.isEmpty() { - for _, f := range q.Arg.Struct.Fields { - if f.Type.Name == name { - return true - } - } - } - } - return false - } - - hasEnum := func() bool { - for _, q := range i.Queries { - if !q.Arg.isEmpty() { - for _, f := range q.Arg.Struct.Fields { - if f.Type.IsEnum { - return true - } - } - } - } - return false - } - - std := stdImports(uses) - std["java.sql.Connection"] = struct{}{} - if hasEnum() && i.Settings.Package.Engine == config.EnginePostgreSQL { - std["java.sql.Types"] = struct{}{} - } - - stds := make([]string, 0, len(std)) - for s := range std { - stds = append(stds, s) - } - - sort.Strings(stds) - return [][]string{stds} -} diff --git a/internal/codegen/kotlin/mysql_type.go b/internal/codegen/kotlin/mysql_type.go deleted file mode 100644 index 1aafee7ce6..0000000000 --- a/internal/codegen/kotlin/mysql_type.go +++ /dev/null @@ -1,74 +0,0 @@ -package kotlin - -import ( - "log" - - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/sql/catalog" -) - -func mysqlType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) (string, bool) { - columnType := col.DataType - - switch columnType { - - case "varchar", "text", "char", "tinytext", "mediumtext", "longtext": - return "String", false - - case "int", "integer", "smallint", "mediumint", "year": - return "Int", false - - case "bigint": - return "Long", false - - case "blob", "binary", "varbinary", "tinyblob", "mediumblob", "longblob": - return "String", false - - case "double", "double precision", "real": - return "Double", false - - case "decimal", "dec", "fixed": - return "String", false - - case "enum": - // TODO: Proper Enum support - return "String", false - - case "date", "datetime", "time": - return "LocalDateTime", false - - case "timestamp": - return "Instant", false - - case "boolean", "bool", "tinyint": - return "Boolean", false - - case "json": - return "String", false - - case "any": - return "Any", false - - default: - for _, schema := range r.Catalog.Schemas { - for _, typ := range schema.Types { - switch t := typ.(type) { - case *catalog.Enum: - if t.Name == columnType { - if schema.Name == r.Catalog.DefaultSchema { - return DataClassName(t.Name, settings), true - } - return DataClassName(schema.Name+"_"+t.Name, settings), true - } - } - } - } - if debug.Active { - log.Printf("Unknown MySQL type: %s\n", columnType) - } - return "Any", false - - } -} diff --git a/internal/codegen/kotlin/postgresql_type.go b/internal/codegen/kotlin/postgresql_type.go deleted file mode 100644 index 4c2dee1d68..0000000000 --- a/internal/codegen/kotlin/postgresql_type.go +++ /dev/null @@ -1,108 +0,0 @@ -package kotlin - -import ( - "log" - - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/sql/catalog" -) - -func postgresType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) (string, bool) { - columnType := col.DataType - - switch columnType { - case "serial", "pg_catalog.serial4": - return "Int", false - - case "bigserial", "pg_catalog.serial8": - return "Long", false - - case "smallserial", "pg_catalog.serial2": - return "Short", false - - case "integer", "int", "int4", "pg_catalog.int4": - return "Int", false - - case "bigint", "pg_catalog.int8": - return "Long", false - - case "smallint", "pg_catalog.int2": - return "Short", false - - case "float", "double precision", "pg_catalog.float8": - return "Double", false - - case "real", "pg_catalog.float4": - return "Float", false - - case "pg_catalog.numeric": - return "java.math.BigDecimal", false - - case "bool", "pg_catalog.bool": - return "Boolean", false - - case "jsonb": - // TODO: support json and byte types - return "String", false - - case "bytea", "blob", "pg_catalog.bytea": - return "String", false - - case "date": - // Date and time mappings from https://jdbc.postgresql.org/documentation/head/java8-date-time.html - return "LocalDate", false - - case "pg_catalog.time", "pg_catalog.timetz": - return "LocalTime", false - - case "pg_catalog.timestamp": - return "LocalDateTime", false - - case "pg_catalog.timestamptz", "timestamptz": - // TODO - return "OffsetDateTime", false - - case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string": - return "String", false - - case "uuid": - // TODO - return "uuid.UUID", false - - case "inet": - // TODO - return "net.IP", false - - case "void": - // TODO - // A void value always returns NULL. Since there is no built-in NULL - // value into the SQL package, we'll use sql.NullBool - return "sql.NullBool", false - - case "any": - // TODO - return "Any", false - - default: - for _, schema := range r.Catalog.Schemas { - if schema.Name == "pg_catalog" { - continue - } - for _, typ := range schema.Types { - enum, ok := typ.(*catalog.Enum) - if !ok { - continue - } - if columnType == enum.Name { - if schema.Name == r.Catalog.DefaultSchema { - return DataClassName(enum.Name, settings), true - } - return DataClassName(schema.Name+"_"+enum.Name, settings), true - } - } - } - log.Printf("unknown PostgreSQL type: %s\n", columnType) - return "Any", false - } -} diff --git a/internal/codegen/sdk/sdk.go b/internal/codegen/sdk/sdk.go new file mode 100644 index 0000000000..53e3fc6a9f --- /dev/null +++ b/internal/codegen/sdk/sdk.go @@ -0,0 +1,33 @@ +package sdk + +import ( + "github.com/sqlc-dev/sqlc/internal/pattern" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +func DataType(n *plugin.Identifier) string { + if n.Schema != "" { + return n.Schema + "." + n.Name + } else { + return n.Name + } +} + +func MatchString(pat, target string) bool { + matcher, err := pattern.MatchCompile(pat) + if err != nil { + panic(err) + } + return matcher.MatchString(target) +} + +func SameTableName(tableID, f *plugin.Identifier, defaultSchema string) bool { + if tableID == nil { + return false + } + schema := tableID.Schema + if tableID.Schema == "" { + schema = defaultSchema + } + return tableID.Catalog == f.Catalog && schema == f.Schema && tableID.Name == f.Name +} diff --git a/internal/codegen/sdk/utils.go b/internal/codegen/sdk/utils.go new file mode 100644 index 0000000000..ec4a4e5ab4 --- /dev/null +++ b/internal/codegen/sdk/utils.go @@ -0,0 +1,42 @@ +package sdk + +import ( + "strings" + "unicode" +) + +func LowerTitle(s string) string { + if s == "" { + return s + } + + a := []rune(s) + a[0] = unicode.ToLower(a[0]) + return string(a) +} + +func Title(s string) string { + return strings.Title(s) +} + +// Go string literals cannot contain backtick. If a string contains +// a backtick, replace it the following way: +// +// input: +// +// SELECT `group` FROM foo +// +// output: +// +// 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 { + return strings.Replace(s, "`", "`+\"`\"+`", -1) +} + +func DoubleSlashComment(s string) string { + return "// " + strings.ReplaceAll(s, "\n", "\n// ") +} diff --git a/internal/codegen/sdk/utils_test.go b/internal/codegen/sdk/utils_test.go new file mode 100644 index 0000000000..e16244883a --- /dev/null +++ b/internal/codegen/sdk/utils_test.go @@ -0,0 +1,28 @@ +package sdk + +import ( + "testing" +) + +func TestLowerTitle(t *testing.T) { + + // empty + if LowerTitle("") != "" { + t.Fatal("expected empty title to remain empty") + } + + // all lowercase + if LowerTitle("lowercase") != "lowercase" { + t.Fatal("expected no changes when input is all lowercase") + } + + // all uppercase + if LowerTitle("UPPERCASE") != "uPPERCASE" { + t.Fatal("expected first rune to be lower when input is all uppercase") + } + + // Title Case + if LowerTitle("Title Case") != "title Case" { + t.Fatal("expected first rune to be lower when input is Title Case") + } +} diff --git a/internal/codegen/utils.go b/internal/codegen/utils.go deleted file mode 100644 index 8e21b9bdf5..0000000000 --- a/internal/codegen/utils.go +++ /dev/null @@ -1,32 +0,0 @@ -package codegen - -import ( - "strings" - "unicode" -) - -func LowerTitle(s string) string { - a := []rune(s) - a[0] = unicode.ToLower(a[0]) - return string(a) -} - -// Go string literals cannot contain backtick. If a string contains -// a backtick, replace it the following way: -// -// input: -// SELECT `group` FROM foo -// -// output: -// 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 { - return strings.Replace(s, "`", "`+\"`\"+`", -1) -} - -func DoubleSlashComment(s string) string { - return "// " + strings.ReplaceAll(s, "\n", "\n// ") -} diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go new file mode 100644 index 0000000000..0d7d507575 --- /dev/null +++ b/internal/compiler/analyze.go @@ -0,0 +1,215 @@ +package compiler + +import ( + "sort" + + 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/validate" +) + +type analysis struct { + Table *ast.TableName + Columns []*Column + Parameters []Parameter + Named *named.ParamSet + Query string +} + +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, + DataType: c.DataType, + NotNull: c.NotNull, + Unsigned: c.Unsigned, + IsArray: c.IsArray, + ArrayDims: int(c.ArrayDims), + Comment: c.Comment, + Length: &length, + IsNamedParam: c.IsNamedParam, + IsFuncCall: c.IsFuncCall, + Scope: c.Scope, + Table: convertTableName(c.Table), + TableAlias: c.TableAlias, + Type: convertTypeName(c.Type), + EmbedTable: convertTableName(c.EmbedTable), + IsSqlcSlice: c.IsSqlcSlice, + } +} + +func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { + var cols []*Column + for _, c := range a.Columns { + cols = append(cols, convertColumn(c)) + } + var params []Parameter + for _, p := range a.Params { + params = append(params, Parameter{ + Number: int(p.Number), + Column: convertColumn(p.Column), + }) + } + if len(prev.Columns) == len(cols) { + for i := range prev.Columns { + // 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 + for i := range prev.Columns { + if prev.Columns[i].EmbedTable != nil { + embedding = true + } + } + if !embedding { + prev.Columns = cols + } + } + if len(prev.Parameters) == len(params) { + for i := range prev.Parameters { + // 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 + } + return prev +} + +func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, true) +} + +func (c *Compiler) inferQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, false) +} + +func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) (*analysis, error) { + errors := make([]error, 0) + check := func(err error) error { + if failfast { + return err + } + if err != nil { + errors = append(errors, err) + } + return nil + } + + numbers, dollar, err := validate.ParamRef(raw) + if err := check(err); err != nil { + return nil, err + } + + raw, namedParams, edits := rewrite.NamedParameters(c.conf.Engine, raw, numbers, dollar) + + var table *ast.TableName + switch n := raw.Stmt.(type) { + 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 + } + } + + if err := check(validate.FuncCall(c.catalog, c.combo, raw)); err != nil { + return nil, err + } + + if err := check(validate.In(c.catalog, raw)); err != nil { + return nil, err + } + rvs := rangeVars(raw.Stmt) + refs, errs := findParameters(raw.Stmt) + if len(errs) > 0 { + if failfast { + return nil, errs[0] + } + errors = append(errors, errs...) + } + refs = uniqueParamRefs(refs, dollar) + if c.conf.Engine == config.EngineMySQL || !dollar { + sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Location < refs[j].ref.Location }) + } else { + sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Number < refs[j].ref.Number }) + } + raw, embeds := rewrite.Embeds(raw) + qc, err := c.buildQueryCatalog(c.catalog, raw.Stmt, embeds) + if err := check(err); err != nil { + return nil, err + } + + params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds) + if err := check(err); err != nil { + return nil, err + } + cols, err := c.outputColumns(qc, raw.Stmt) + if err := check(err); err != nil { + return nil, err + } + + expandEdits, 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 + } + + var rerr error + if len(errors) > 0 { + rerr = errors[0] + } + + return &analysis{ + Table: table, + Columns: cols, + Parameters: params, + Query: expanded, + Named: namedParams, + }, rerr +} diff --git a/internal/compiler/compat.go b/internal/compiler/compat.go index ef8c522541..097d889cfb 100644 --- a/internal/compiler/compat.go +++ b/internal/compiler/compat.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" ) // This is mainly copy-pasted from internal/postgresql/parse.go @@ -14,11 +14,6 @@ func stringSlice(list *ast.List) []string { for _, item := range list.Items { if n, ok := item.(*ast.String); ok { items = append(items, n.Str) - continue - } - if n, ok := item.(*ast.String); ok { - items = append(items, n.Str) - continue } } return items @@ -32,8 +27,16 @@ type Relation struct { func parseRelation(node ast.Node) (*Relation, error) { switch n := node.(type) { + case *ast.Boolean: + if n == nil { + return nil, fmt.Errorf("unexpected nil in %T node", n) + } + return &Relation{Name: "bool"}, nil case *ast.List: + if n == nil { + return nil, fmt.Errorf("unexpected nil in %T node", n) + } parts := stringSlice(n) switch len(parts) { case 1: @@ -56,6 +59,9 @@ func parseRelation(node ast.Node) (*Relation, error) { } case *ast.RangeVar: + if n == nil { + return nil, fmt.Errorf("unexpected nil in %T node", n) + } name := Relation{} if n.Catalogname != nil { name.Catalog = *n.Catalogname @@ -69,10 +75,17 @@ func parseRelation(node ast.Node) (*Relation, error) { return &name, nil case *ast.TypeName: - return parseRelation(n.Names) + if n == nil { + return nil, fmt.Errorf("unexpected nil in %T node", n) + } + if n.Names != nil { + return parseRelation(n.Names) + } else { + return &Relation{Name: n.Name}, nil + } default: - return nil, fmt.Errorf("unexpected node type: %T", n) + return nil, fmt.Errorf("unexpected node type: %T", node) } } @@ -91,7 +104,7 @@ func ParseTableName(node ast.Node) (*ast.TableName, error) { func ParseTypeName(node ast.Node) (*ast.TypeName, error) { rel, err := parseRelation(node) if err != nil { - return nil, fmt.Errorf("parse table name: %w", err) + return nil, fmt.Errorf("parse type name: %w", err) } return &ast.TypeName{ Catalog: rel.Catalog, diff --git a/internal/compiler/compile.go b/internal/compiler/compile.go index 171bc9a6c1..1a95b586f4 100644 --- a/internal/compiler/compile.go +++ b/internal/compiler/compile.go @@ -1,79 +1,61 @@ package compiler import ( + "context" "errors" "fmt" "io" - "io/ioutil" + "os" "path/filepath" - "regexp" "strings" - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/migrations" - "github.com/kyleconroy/sqlc/internal/multierr" - "github.com/kyleconroy/sqlc/internal/opts" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" - "github.com/kyleconroy/sqlc/internal/sql/sqlpath" + "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/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) // TODO: Rename this interface Engine type Parser interface { Parse(io.Reader) ([]ast.Statement, error) - CommentSyntax() metadata.CommentSyntax + CommentSyntax() source.CommentSyntax IsReservedKeyword(string) bool } -// copied over from gen.go -func structName(name string) string { - out := "" - for _, p := range strings.Split(name, "_") { - if p == "id" { - out += "ID" - } else { - out += strings.Title(p) - } - } - return out -} - -var identPattern = regexp.MustCompile("[^a-zA-Z0-9_]+") - -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) - } - return name -} - -// end copypasta -func parseCatalog(p Parser, c *catalog.Catalog, schemas []string) error { +func (c *Compiler) parseCatalog(schemas []string) error { files, err := sqlpath.Glob(schemas) if err != nil { return err } merr := multierr.New() for _, filename := range files { - blob, err := ioutil.ReadFile(filename) + blob, err := os.ReadFile(filename) if err != nil { merr.Add(filename, "", 0, err) continue } contents := migrations.RemoveRollbackStatements(string(blob)) - stmts, err := p.Parse(strings.NewReader(contents)) + c.schema = append(c.schema, contents) + + // In database-only mode, we parse the schema to validate syntax + // but don't update the catalog - the database will be the source of truth + stmts, err := c.parser.Parse(strings.NewReader(contents)) if err != nil { merr.Add(filename, contents, 0, err) continue } + + // Skip catalog updates in database-only mode + if c.databaseOnlyMode { + continue + } + for i := range stmts { - if err := c.Update(stmts[i]); err != nil { + if err := c.catalog.Update(stmts[i], c); err != nil { merr.Add(filename, contents, stmts[i].Pos(), err) continue } @@ -86,6 +68,15 @@ func parseCatalog(p Parser, c *catalog.Catalog, schemas []string) error { } func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { + ctx := context.Background() + + // In database-only mode, initialize the database connection before parsing queries + if c.databaseOnlyMode && c.analyzer != nil { + if err := c.analyzer.EnsureConn(ctx, c.schema); err != nil { + return nil, fmt.Errorf("failed to initialize database connection: %w", err) + } + } + var q []*Query merr := multierr.New() set := map[string]struct{}{} @@ -94,7 +85,7 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { return nil, err } for _, filename := range files { - blob, err := ioutil.ReadFile(filename) + blob, err := os.ReadFile(filename) if err != nil { merr.Add(filename, "", 0, err) continue @@ -107,9 +98,6 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { } for _, stmt := range stmts { query, err := c.parseQuery(stmt.Raw, src, o) - if err == ErrUnsupportedStatementType { - continue - } if err != nil { var e *sqlerr.Error loc := stmt.Raw.Pos() @@ -117,19 +105,25 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { loc = e.Location } merr.Add(filename, 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 + } + continue + } + if query == nil { continue } - if query.Name != "" { - if _, exists := set[query.Name]; exists { - merr.Add(filename, src, stmt.Raw.Pos(), fmt.Errorf("duplicate query name: %s", query.Name)) + query.Metadata.Filename = filepath.Base(filename) + queryName := query.Metadata.Name + if queryName != "" { + if _, exists := set[queryName]; exists { + merr.Add(filename, src, stmt.Raw.Pos(), fmt.Errorf("duplicate query name: %s", queryName)) continue } - set[query.Name] = struct{}{} - } - query.Filename = filepath.Base(filename) - if query != nil { - q = append(q, query) + set[queryName] = struct{}{} } + q = append(q, query) } } if len(merr.Errs()) > 0 { @@ -138,6 +132,7 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { 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, diff --git a/internal/compiler/engine.go b/internal/compiler/engine.go index 2c90bc315b..64fdf3d5c7 100644 --- a/internal/compiler/engine.go +++ b/internal/compiler/engine.go @@ -1,40 +1,120 @@ package compiler import ( + "context" "fmt" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/engine/dolphin" - "github.com/kyleconroy/sqlc/internal/engine/postgresql" - "github.com/kyleconroy/sqlc/internal/engine/sqlite" - "github.com/kyleconroy/sqlc/internal/opts" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/analyzer" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/engine/dolphin" + "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/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/x/expander" ) type Compiler struct { - conf config.SQL - combo config.CombinedSettings - catalog *catalog.Catalog - parser Parser - result *Result + conf config.SQL + combo config.CombinedSettings + catalog *catalog.Catalog + parser Parser + result *Result + analyzer analyzer.Analyzer + client dbmanager.Client + selector selector + + schema []string + + // databaseOnlyMode indicates that the compiler should use database-only analysis + // and skip building the internal catalog from schema files (analyzer.database: only) + databaseOnlyMode bool + // expander is used to expand SELECT * and RETURNING * in database-only mode + expander *expander.Expander } -func NewCompiler(conf config.SQL, combo config.CombinedSettings) *Compiler { +func NewCompiler(conf config.SQL, combo config.CombinedSettings, parserOpts opts.Parser) (*Compiler, error) { c := &Compiler{conf: conf, combo: combo} + + if conf.Database != nil && conf.Database.Managed { + client := dbmanager.NewClient(combo.Global.Servers) + c.client = client + } + + // Check for database-only mode (analyzer.database: only) + // This feature requires the analyzerv2 experiment to be enabled + databaseOnlyMode := conf.Analyzer.Database.IsOnly() && parserOpts.Experiment.AnalyzerV2 + switch conf.Engine { - case config.EngineXLemon: - c.parser = sqlite.NewParser() - c.catalog = catalog.New("main") + case config.EngineSQLite: + parser := sqlite.NewParser() + c.parser = parser + c.catalog = sqlite.NewCatalog() + c.selector = newSQLiteSelector() + + if databaseOnlyMode { + // Database-only mode requires a database connection + if conf.Database == nil { + return nil, fmt.Errorf("analyzer.database: only requires database configuration") + } + if conf.Database.URI == "" && !conf.Database.Managed { + return nil, fmt.Errorf("analyzer.database: only requires database.uri or database.managed") + } + c.databaseOnlyMode = true + // Create the SQLite analyzer (implements Analyzer interface) + sqliteAnalyzer := sqliteanalyze.New(*conf.Database) + c.analyzer = analyzer.Cached(sqliteAnalyzer, combo.Global, *conf.Database) + // Create the expander using the analyzer as the column getter + c.expander = expander.New(c.analyzer, parser, parser) + } else if conf.Database != nil { + if conf.Analyzer.Database.IsEnabled() { + c.analyzer = analyzer.Cached( + sqliteanalyze.New(*conf.Database), + combo.Global, + *conf.Database, + ) + } + } case config.EngineMySQL: c.parser = dolphin.NewParser() c.catalog = dolphin.NewCatalog() + c.selector = newDefaultSelector() case config.EnginePostgreSQL: - c.parser = postgresql.NewParser() + parser := postgresql.NewParser() + c.parser = parser c.catalog = postgresql.NewCatalog() + c.selector = newDefaultSelector() + + if databaseOnlyMode { + // Database-only mode requires a database connection + if conf.Database == nil { + return nil, fmt.Errorf("analyzer.database: only requires database configuration") + } + if conf.Database.URI == "" && !conf.Database.Managed { + return nil, fmt.Errorf("analyzer.database: only requires database.uri or database.managed") + } + c.databaseOnlyMode = true + // Create the PostgreSQL analyzer (implements Analyzer interface) + pgAnalyzer := pganalyze.New(c.client, *conf.Database) + c.analyzer = analyzer.Cached(pgAnalyzer, combo.Global, *conf.Database) + // Create the expander using the analyzer as the column getter + c.expander = expander.New(c.analyzer, parser, parser) + } else if conf.Database != nil { + if conf.Analyzer.Database.IsEnabled() { + c.analyzer = analyzer.Cached( + pganalyze.New(c.client, *conf.Database), + combo.Global, + *conf.Database, + ) + } + } default: - panic(fmt.Sprintf("unknown engine: %s", conf.Engine)) + return nil, fmt.Errorf("unknown engine: %s", conf.Engine) } - return c + return c, nil } func (c *Compiler) Catalog() *catalog.Catalog { @@ -42,7 +122,7 @@ func (c *Compiler) Catalog() *catalog.Catalog { } func (c *Compiler) ParseCatalog(schema []string) error { - return parseCatalog(c.parser, c.catalog, schema) + return c.parseCatalog(schema) } func (c *Compiler) ParseQueries(queries []string, o opts.Parser) error { @@ -57,3 +137,12 @@ func (c *Compiler) ParseQueries(queries []string, o opts.Parser) error { func (c *Compiler) Result() *Result { return c.result } + +func (c *Compiler) Close(ctx context.Context) { + if c.analyzer != nil { + c.analyzer.Close(ctx) + } + if c.client != nil { + c.client.Close(ctx) + } +} diff --git a/internal/compiler/expand.go b/internal/compiler/expand.go index 75ab05c4ed..c60b7618b2 100644 --- a/internal/compiler/expand.go +++ b/internal/compiler/expand.go @@ -2,15 +2,24 @@ package compiler import ( "fmt" + "regexp" "strings" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/source" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "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" ) func (c *Compiler) expand(qc *QueryCatalog, raw *ast.RawStmt) ([]source.Edit, error) { + // Return early if there are no A_Star nodes to expand + stars := astutils.Search(raw, func(node ast.Node) bool { + _, ok := node.(*ast.A_Star) + return ok + }) + if len(stars.Items) == 0 { + return nil, nil + } list := astutils.Search(raw, func(node ast.Node) bool { switch node.(type) { case *ast.DeleteStmt: @@ -36,20 +45,41 @@ func (c *Compiler) expand(qc *QueryCatalog, raw *ast.RawStmt) ([]source.Edit, er return edits, nil } +var validPostgresIdent = regexp.MustCompile(`^[a-z_][a-z0-9_$]*$`) + func (c *Compiler) quoteIdent(ident string) string { if c.parser.IsReservedKeyword(ident) { - switch c.conf.Engine { - case config.EngineMySQL: - return "`" + ident + "`" - default: - return "\"" + ident + "\"" + return c.quote(ident) + } + // SQL identifiers and key words must begin with a letter (a-z, but also + // letters with diacritical marks and non-Latin letters) or an underscore + // (_). Subsequent characters in an identifier or key word can be letters, + // underscores, digits (0-9), or dollar signs ($). + // + // https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS + if c.conf.Engine == config.EnginePostgreSQL { + // camelCase means the column is also camelCase + if strings.ToLower(ident) != ident { + return c.quote(ident) + } + if !validPostgresIdent.MatchString(strings.ToLower(ident)) { + return c.quote(ident) } } return ident } +func (c *Compiler) quote(x string) string { + switch c.conf.Engine { + case config.EngineMySQL: + return "`" + x + "`" + default: + return "\"" + x + "\"" + } +} + func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) ([]source.Edit, error) { - tables, err := sourceTables(qc, node) + tables, err := c.sourceTables(qc, node) if err != nil { return nil, err } @@ -119,18 +149,55 @@ func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) if counts[cname] > 1 { cname = tableName + "." + 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). + cname = c.selector.ColumnExpr(cname, column) cols = append(cols, cname) } } var old []string for _, p := range parts { - old = append(old, c.quoteIdent(p)) + 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 + } } + edits = append(edits, source.Edit{ Location: res.Location - raw.StmtLocation, - Old: strings.Join(old, "."), + Old: oldString, + OldFunc: oldFunc, New: strings.Join(cols, ", "), }) } + return edits, nil } diff --git a/internal/compiler/find_params.go b/internal/compiler/find_params.go index 725c04e049..8199addd33 100644 --- a/internal/compiler/find_params.go +++ b/internal/compiler/find_params.go @@ -1,15 +1,22 @@ package compiler import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" ) -func findParameters(root ast.Node) []paramRef { +func findParameters(root ast.Node) ([]paramRef, []error) { refs := make([]paramRef, 0) - v := paramSearch{seen: make(map[int]struct{}), refs: &refs} + errors := make([]error, 0) + v := paramSearch{seen: make(map[int]struct{}), refs: &refs, errs: &errors} astutils.Walk(v, root) - return refs + if len(*v.errs) > 0 { + return refs, *v.errs + } else { + return refs, nil + } } type paramRef struct { @@ -24,6 +31,7 @@ type paramSearch struct { rangeVar *ast.RangeVar refs *[]paramRef seen map[int]struct{} + errs *[]error // XXX: Gross state hack for limit limitCount ast.Node @@ -50,6 +58,17 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { case *ast.A_Expr: p.parent = node + case *ast.BetweenExpr: + p.parent = node + + case *ast.CallStmt: + p.parent = n.FuncCall + + case *ast.DeleteStmt: + if n.LimitCount != nil { + p.limitCount = n.LimitCount + } + case *ast.FuncCall: p.parent = node @@ -64,7 +83,10 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { if !ok { continue } - // TODO: Out-of-bounds panic + if len(n.Cols.Items) <= i { + *p.errs = append(*p.errs, fmt.Errorf("INSERT has more expressions than target columns")) + return p + } *p.refs = append(*p.refs, paramRef{parent: n.Cols.Items[i], ref: ref, rv: n.Relation}) p.seen[ref.Location] = struct{}{} } @@ -78,13 +100,39 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { if !ok { continue } - // TODO: Out-of-bounds panic + if len(n.Cols.Items) <= i { + *p.errs = append(*p.errs, fmt.Errorf("INSERT has more expressions than target columns")) + return p + } *p.refs = append(*p.refs, paramRef{parent: n.Cols.Items[i], ref: ref, rv: n.Relation}) p.seen[ref.Location] = struct{}{} } } } + case *ast.UpdateStmt: + for _, item := range n.TargetList.Items { + target, ok := item.(*ast.ResTarget) + if !ok { + continue + } + ref, ok := target.Val.(*ast.ParamRef) + if !ok { + continue + } + for _, relation := range n.Relations.Items { + rv, ok := relation.(*ast.RangeVar) + if !ok { + continue + } + *p.refs = append(*p.refs, paramRef{parent: target, ref: ref, rv: rv}) + } + p.seen[ref.Location] = struct{}{} + } + if n.LimitCount != nil { + p.limitCount = n.LimitCount + } + case *ast.RangeVar: p.rangeVar = n @@ -142,6 +190,25 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { p.seen[n.Location] = struct{}{} } return nil + + case *ast.In: + if n.Sel == nil { + p.parent = node + } else { + 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{ + Catalogname: schema.Catalogname, + Schemaname: schema.Schemaname, + Relname: schema.Relname, + } + } + } + } + if _, ok := n.Expr.(*ast.ParamRef); ok { + p.Visit(n.Expr) + } } return p } diff --git a/internal/compiler/output_columns.go b/internal/compiler/output_columns.go index 4a18f7cec5..dbd486359a 100644 --- a/internal/compiler/output_columns.go +++ b/internal/compiler/output_columns.go @@ -4,12 +4,40 @@ import ( "errors" "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/lang" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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/lang" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) +// OutputColumns determines which columns a statement will output +func (c *Compiler) OutputColumns(stmt ast.Node) ([]*catalog.Column, error) { + qc, err := c.buildQueryCatalog(c.catalog, stmt, nil) + if err != nil { + return nil, err + } + cols, err := c.outputColumns(qc, stmt) + if err != nil { + return nil, err + } + + catCols := make([]*catalog.Column, 0, len(cols)) + for _, col := range cols { + catCols = append(catCols, &catalog.Column{ + Name: col.Name, + Type: ast.TypeName{Name: col.DataType}, + IsNotNull: col.NotNull, + IsUnsigned: col.Unsigned, + IsArray: col.IsArray, + ArrayDims: col.ArrayDims, + Comment: col.Comment, + Length: col.Length, + }) + } + return catCols, nil +} + func hasStarRef(cf *ast.ColumnRef) bool { for _, item := range cf.Fields.Items { if _, ok := item.(*ast.A_Star); ok { @@ -23,13 +51,13 @@ func hasStarRef(cf *ast.ColumnRef) bool { // // Return an error if column references are ambiguous // Return an error if column references don't exist -func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { - tables, err := sourceTables(qc, node) +func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { + tables, err := c.sourceTables(qc, node) if err != nil { return nil, err } - var targets *ast.List + targets := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: targets = n.ReturningList @@ -37,17 +65,57 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { targets = n.ReturningList case *ast.SelectStmt: targets = n.TargetList + isUnion := len(targets.Items) == 0 && n.Larg != nil + + if n.GroupClause != nil { + for _, item := range n.GroupClause.Items { + if err := findColumnForNode(item, tables, targets); err != nil { + return nil, err + } + } + } + validateOrderBy := true + if c.conf.StrictOrderBy != nil { + validateOrderBy = *c.conf.StrictOrderBy + } + if !isUnion && validateOrderBy { + if n.SortClause != nil { + for _, item := range n.SortClause.Items { + sb, ok := item.(*ast.SortBy) + if !ok { + continue + } + if err := 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) + } + } + } + if n.WindowClause != nil { + for _, item := range n.WindowClause.Items { + sb, ok := item.(*ast.List) + if !ok { + continue + } + for _, single := range sb.Items { + caseExpr, ok := single.(*ast.CaseExpr) + if !ok { + continue + } + if err := 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) + } + } + } + } + } + // For UNION queries, targets is empty and we need to look for the // columns in Largs. - if len(targets.Items) == 0 && n.Larg != nil { - return outputColumns(qc, n.Larg) + if isUnion { + return c.outputColumns(qc, n.Larg) } - case *ast.TruncateStmt: - targets = &ast.List{} case *ast.UpdateStmt: targets = n.ReturningList - default: - return nil, fmt.Errorf("outputColumns: unsupported node type: %T", n) } var cols []*Column @@ -59,27 +127,68 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { } switch n := res.Val.(type) { + case *ast.A_Const: + name := "" + if res.Name != nil { + name = *res.Name + } + switch n.Val.(type) { + case *ast.String: + cols = append(cols, &Column{Name: name, DataType: "text", NotNull: true}) + case *ast.Integer: + cols = append(cols, &Column{Name: name, DataType: "int", NotNull: true}) + case *ast.Float: + cols = append(cols, &Column{Name: name, DataType: "float", NotNull: true}) + case *ast.Boolean: + cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: true}) + default: + cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) + } + case *ast.A_Expr: name := "" 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}) } + case *ast.BoolExpr: + name := "" + if res.Name != nil { + name = *res.Name + } + notNull := false + if len(n.Args.Items) == 1 { + switch n.Boolop { + case ast.BoolExprTypeIsNull, ast.BoolExprTypeIsNotNull: + notNull = true + case ast.BoolExprTypeNot: + sublink, ok := n.Args.Items[0].(*ast.SubLink) + if ok && sublink.SubLinkType == ast.EXISTS_SUBLINK { + notNull = true + if name == "" { + name = "not_exists" + } + } + } + } + cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: notNull}) + case *ast.CaseExpr: name := "" if res.Name != nil { name = *res.Name } - // TODO: The TypeCase code has been copied from below. Instead, we need a recurse function to get the type of a node. + // TODO: The TypeCase and A_Const code has been copied from below. Instead, we + // need a recurse function to get the type of a node. if tc, ok := n.Defresult.(*ast.TypeCast); ok { if tc.TypeName == nil { return nil, errors.New("no type name type cast") @@ -95,14 +204,33 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { col := toColumn(tc.TypeName) col.Name = name cols = append(cols, col) + } else if aconst, ok := n.Defresult.(*ast.A_Const); ok { + switch aconst.Val.(type) { + case *ast.String: + cols = append(cols, &Column{Name: name, DataType: "text", NotNull: true}) + case *ast.Integer: + cols = append(cols, &Column{Name: name, DataType: "int", NotNull: true}) + case *ast.Float: + cols = append(cols, &Column{Name: name, DataType: "float", NotNull: true}) + case *ast.Boolean: + cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: true}) + default: + cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) + } } else { cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) } case *ast.CoalesceExpr: - var found bool + name := "coalesce" + if res.Name != nil { + name = *res.Name + } + var firstColumn *Column + var shouldNotBeNull bool for _, arg := range n.Args.Items { - if found { + if _, ok := arg.(*ast.A_Const); ok { + shouldNotBeNull = true continue } if ref, ok := arg.(*ast.ColumnRef); ok { @@ -111,18 +239,33 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { return nil, err } for _, c := range columns { - found = true - c.NotNull = true - cols = append(cols, c) + if firstColumn == nil { + firstColumn = c + } + shouldNotBeNull = shouldNotBeNull || c.NotNull } } } - if !found { - cols = append(cols, &Column{Name: "coalesce", DataType: "any", NotNull: false}) + if firstColumn != nil { + firstColumn.NotNull = shouldNotBeNull + firstColumn.skipTableRequiredCheck = true + cols = append(cols, firstColumn) + } else { + cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) } case *ast.ColumnRef: if hasStarRef(n) { + + // add a column with a reference to an embedded table + if embed, ok := qc.embeds.Find(n); ok { + cols = append(cols, &Column{ + Name: embed.Table.Name, + EmbedTable: embed.Table, + }) + continue + } + // TODO: This code is copied in func expand() for _, t := range tables { scope := astutils.Join(n.Fields, ".") @@ -135,13 +278,18 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { cname = *res.Name } cols = append(cols, &Column{ - Name: cname, - Type: c.Type, - Scope: scope, - Table: c.Table, - DataType: c.DataType, - NotNull: c.NotNull, - IsArray: c.IsArray, + Name: cname, + OriginalName: c.Name, + Type: c.Type, + Scope: scope, + Table: c.Table, + TableAlias: t.Rel.Name, + DataType: c.DataType, + NotNull: c.NotNull, + Unsigned: c.Unsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Length: c.Length, }) } } @@ -162,9 +310,18 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { } fun, err := qc.catalog.ResolveFuncCall(n) if err == nil { - cols = append(cols, &Column{Name: name, DataType: dataType(fun.ReturnType), NotNull: true}) + cols = append(cols, &Column{ + Name: name, + DataType: dataType(fun.ReturnType), + NotNull: !fun.ReturnTypeNullable, + IsFuncCall: true, + }) } else { - cols = append(cols, &Column{Name: name, DataType: "any"}) + cols = append(cols, &Column{ + Name: name, + DataType: "any", + IsFuncCall: true, + }) } case *ast.SubLink: @@ -175,6 +332,16 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { switch n.SubLinkType { case ast.EXISTS_SUBLINK: cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: true}) + case ast.EXPR_SUBLINK: + subcols, err := c.outputColumns(qc, n.Subselect) + if err != nil { + return nil, err + } + first := subcols[0] + if res.Name != nil { + first.Name = *res.Name + } + cols = append(cols, first) default: cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) } @@ -193,8 +360,25 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { // TODO Validate column names col := toColumn(n.TypeName) col.Name = name + // TODO Add correct, real type inference + if constant, ok := n.Arg.(*ast.A_Const); ok { + if _, ok := constant.Val.(*ast.Null); ok { + col.NotNull = false + } + } cols = append(cols, col) + case *ast.SelectStmt: + subcols, err := c.outputColumns(qc, n) + if err != nil { + return nil, err + } + first := subcols[0] + if res.Name != nil { + first.Name = *res.Name + } + cols = append(cols, first) + default: name := "" if res.Name != nil { @@ -205,59 +389,229 @@ func outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, error) { } } + if n, ok := node.(*ast.SelectStmt); ok { + for _, col := range cols { + if !col.NotNull || col.Table == nil || col.skipTableRequiredCheck { + continue + } + for _, f := range n.FromClause.Items { + res := isTableRequired(f, col, tableRequired) + if res != tableNotFound { + col.NotNull = res == tableRequired + break + } + } + } + } + return cols, nil } +const ( + tableNotFound = iota + tableRequired + tableOptional +) + +func isTableRequired(n ast.Node, col *Column, prior int) int { + switch n := n.(type) { + case *ast.RangeVar: + tableMatch := *n.Relname == col.Table.Name + aliasMatch := true + if n.Alias != nil && col.TableAlias != "" { + aliasMatch = *n.Alias.Aliasname == col.TableAlias + } + if aliasMatch && tableMatch { + return prior + } + case *ast.JoinExpr: + helper := func(l, r int) int { + if res := isTableRequired(n.Larg, col, l); res != tableNotFound { + return res + } + if res := isTableRequired(n.Rarg, col, r); res != tableNotFound { + return res + } + return tableNotFound + } + switch n.Jointype { + case ast.JoinTypeLeft: + return helper(tableRequired, tableOptional) + case ast.JoinTypeRight: + return helper(tableOptional, tableRequired) + case ast.JoinTypeFull: + return helper(tableOptional, tableOptional) + case ast.JoinTypeInner: + return helper(tableRequired, tableRequired) + } + case *ast.List: + for _, item := range n.Items { + if res := isTableRequired(item, col, prior); res != tableNotFound { + return res + } + } + } + + return tableNotFound +} + +type tableVisitor struct { + list ast.List +} + +func (r *tableVisitor) Visit(n ast.Node) astutils.Visitor { + switch n.(type) { + case *ast.RangeVar, *ast.RangeFunction: + r.list.Items = append(r.list.Items, n) + return r + case *ast.RangeSubselect: + r.list.Items = append(r.list.Items, n) + return nil + default: + return r + } +} + // Compute the output columns for a statement. // // Return an error if column references are ambiguous // Return an error if column references don't exist // Return an error if a table is referenced twice // Return an error if an unknown column is referenced -func sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { - var list *ast.List +func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { + list := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: - list = &ast.List{ - Items: []ast.Node{n.Relation}, + 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}, } case *ast.SelectStmt: - list = astutils.Search(n.FromClause, func(node ast.Node) bool { - switch node.(type) { - case *ast.RangeVar, *ast.RangeSubselect: - return true - default: - return false - } - }) + var tv tableVisitor + astutils.Walk(&tv, n.FromClause) + list = &tv.list case *ast.TruncateStmt: list = astutils.Search(n.Relations, func(node ast.Node) bool { _, ok := node.(*ast.RangeVar) return ok }) + case *ast.RefreshMatViewStmt: + list = astutils.Search(n.Relation, func(node ast.Node) bool { + _, ok := node.(*ast.RangeVar) + return ok + }) case *ast.UpdateStmt: - list = &ast.List{ - Items: append(n.FromClause.Items, n.Relation), - } - default: - return nil, fmt.Errorf("sourceTables: unsupported node type: %T", n) + var tv tableVisitor + astutils.Walk(&tv, n.FromClause) + astutils.Walk(&tv, n.Relations) + list = &tv.list } var tables []*Table for _, item := range list.Items { + item := item switch n := item.(type) { + + case *ast.RangeFunction: + var funcCall *ast.FuncCall + switch f := n.Functions.Items[0].(type) { + case *ast.List: + switch fi := f.Items[0].(type) { + case *ast.FuncCall: + funcCall = fi + case *ast.SQLValueFunction: + continue // TODO handle this correctly + default: + continue + } + case *ast.FuncCall: + funcCall = f + default: + return nil, fmt.Errorf("sourceTables: unsupported function call type %T", n.Functions.Items[0]) + } + + // If the function or table can't be found, don't error out. There + // are many queries that depend on functions unknown to sqlc. + fn, err := qc.GetFunc(funcCall.Func) + if err != nil { + continue + } + 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 { + table.Columns = append(table.Columns, &Column{ + Name: colName.(*ast.String).Str, + DataType: "any", + }) + } + } else { + colName := fn.Rel.Name + if n.Alias != nil { + colName = *n.Alias.Aliasname + } + table = &Table{ + Rel: &ast.TableName{ + Catalog: fn.Rel.Catalog, + Schema: fn.Rel.Schema, + Name: fn.Rel.Name, + }, + } + 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, + }, + } + } + } + } + if n.Alias != nil { + table.Rel = &ast.TableName{ + Name: *n.Alias.Aliasname, + } + } + tables = append(tables, table) + case *ast.RangeSubselect: - cols, err := outputColumns(qc, n.Subquery) + cols, err := c.outputColumns(qc, n.Subquery) 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, }) @@ -267,6 +621,9 @@ func sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { 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 @@ -282,6 +639,7 @@ func sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { } } tables = append(tables, table) + default: return nil, fmt.Errorf("sourceTable: unsupported list item type: %T", n) } @@ -291,23 +649,31 @@ func sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) ([]*Column, error) { parts := stringSlice(node.Fields) - var name, alias string + var schema, name, alias string switch { case len(parts) == 1: name = parts[0] case len(parts) == 2: alias = parts[0] name = parts[1] + case len(parts) == 3: + schema = parts[0] + alias = parts[1] + name = parts[2] default: return nil, fmt.Errorf("unknown number of fields: %d", len(parts)) } var cols []*Column var found int for _, t := range tables { + if schema != "" && t.Rel.Schema != schema { + continue + } if alias != "" && t.Rel.Name != alias { continue } for _, c := range t.Columns { + if c.Name == name { found += 1 cname := c.Name @@ -315,12 +681,18 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) cname = *res.Name } cols = append(cols, &Column{ - Name: cname, - Type: c.Type, - Table: c.Table, - DataType: c.DataType, - NotNull: c.NotNull, - IsArray: c.IsArray, + Name: cname, + Type: c.Type, + Table: c.Table, + TableAlias: alias, + DataType: c.DataType, + NotNull: c.NotNull, + Unsigned: c.Unsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Length: c.Length, + EmbedTable: c.EmbedTable, + OriginalName: c.Name, }) } } @@ -328,16 +700,80 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) if found == 0 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", name), + Message: fmt.Sprintf("column %q does not exist", name), Location: res.Location, } } if found > 1 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" is ambiguous", name), + Message: fmt.Sprintf("column reference %q is ambiguous", name), Location: res.Location, } } return cols, nil } + +func findColumnForNode(item ast.Node, tables []*Table, targetList *ast.List) error { + ref, ok := item.(*ast.ColumnRef) + if !ok { + return nil + } + return findColumnForRef(ref, tables, targetList) +} + +func findColumnForRef(ref *ast.ColumnRef, tables []*Table, targetList *ast.List) error { + parts := stringSlice(ref.Fields) + var alias, name string + if len(parts) == 1 { + name = parts[0] + } else if len(parts) == 2 { + alias = parts[0] + name = parts[1] + } + + var found int + for _, t := range tables { + if alias != "" && t.Rel.Name != alias { + continue + } + + // Find matching column + for _, c := range t.Columns { + if c.Name == name { + found++ + break + } + } + } + + // Find matching alias if necessary + if found == 0 { + for _, c := range targetList.Items { + resTarget, ok := c.(*ast.ResTarget) + if !ok { + continue + } + if resTarget.Name != nil && *resTarget.Name == name { + found++ + } + } + } + + if found == 0 { + return &sqlerr.Error{ + Code: "42703", + Message: fmt.Sprintf("column reference %q not found", name), + Location: ref.Location, + } + } + if found > 1 { + return &sqlerr.Error{ + Code: "42703", + Message: fmt.Sprintf("column reference %q is ambiguous", name), + Location: ref.Location, + } + } + + return nil +} diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 551bd08515..751cb3271a 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -1,62 +1,38 @@ package compiler import ( + "context" "errors" "fmt" - "sort" "strings" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/opts" - "github.com/kyleconroy/sqlc/internal/source" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/rewrite" - "github.com/kyleconroy/sqlc/internal/sql/validate" + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/opts" + "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/validate" ) -var ErrUnsupportedStatementType = errors.New("parseQuery: unsupported statement type") - -func rewriteNumberedParameters(refs []paramRef, raw *ast.RawStmt, sql string) ([]source.Edit, error) { - edits := make([]source.Edit, len(refs)) - for i, ref := range refs { - edits[i] = source.Edit{ - Location: ref.ref.Location - raw.StmtLocation, - Old: fmt.Sprintf("$%d", ref.ref.Number), - New: "?", - } - } - return edits, nil -} - func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, error) { + ctx := context.Background() + if o.Debug.DumpAST { debug.Dump(stmt) } - if err := validate.ParamStyle(stmt); err != nil { - return nil, err - } - if err := validate.ParamRef(stmt); err != nil { + + // validate sqlc-specific syntax + if err := validate.SqlcFunctions(stmt); err != nil { return nil, err } + + // rewrite queries to remove sqlc.* functions + raw, ok := stmt.(*ast.RawStmt) if !ok { return nil, errors.New("node is not a statement") } - switch n := raw.Stmt.(type) { - case *ast.SelectStmt: - case *ast.DeleteStmt: - case *ast.InsertStmt: - if err := validate.InsertStmt(n); err != nil { - return nil, err - } - case *ast.TruncateStmt: - case *ast.UpdateStmt: - default: - return nil, ErrUnsupportedStatementType - } - rawSQL, err := source.Pluck(src, raw.StmtLocation, raw.StmtLen) if err != nil { return nil, err @@ -64,54 +40,123 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, if rawSQL == "" { return nil, errors.New("missing semicolon at end of file") } - if err := validate.FuncCall(c.catalog, raw); err != nil { - return nil, err - } - name, cmd, err := metadata.Parse(strings.TrimSpace(rawSQL), c.parser.CommentSyntax()) + + name, cmd, err := metadata.ParseQueryNameAndType(rawSQL, metadata.CommentSyntax(c.parser.CommentSyntax())) if err != nil { return nil, err } - if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { - return nil, err - } - raw, namedParams, edits := rewrite.NamedParameters(c.conf.Engine, raw) - rvs := rangeVars(raw.Stmt) - refs := findParameters(raw.Stmt) - if o.UsePositionalParameters { - edits, err = rewriteNumberedParameters(refs, raw, rawSQL) - if err != nil { - return nil, err - } - } else { - refs = uniqueParamRefs(refs) - sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Number < refs[j].ref.Number }) + if name == "" { + return nil, nil } - params, err := resolveCatalogRefs(c.catalog, rvs, refs, namedParams) - if err != nil { + + if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { return nil, err } - qc, err := buildQueryCatalog(c.catalog, raw.Stmt) - if err != nil { - return nil, err + md := metadata.Metadata{ + Name: name, + Cmd: cmd, } - cols, err := outputColumns(qc, raw.Stmt) + + // 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 } - expandEdits, err := c.expand(qc, raw) + md.Params, md.Flags, md.RuleSkiplist, err = metadata.ParseCommentFlags(cleanedComments) if err != nil { return nil, err } - edits = append(edits, expandEdits...) - expanded, err := source.Mutate(rawSQL, edits) - if err != nil { - return nil, err + var anlys *analysis + if c.databaseOnlyMode && c.expander != nil { + // In database-only mode, use the expander for star expansion + // and rely entirely on the database analyzer for type resolution + expandedQuery, err := c.expander.Expand(ctx, rawSQL) + if err != nil { + return nil, fmt.Errorf("star expansion failed: %w", err) + } + + // Parse named parameters from the expanded query + expandedStmts, err := c.parser.Parse(strings.NewReader(expandedQuery)) + if err != nil { + return nil, fmt.Errorf("parsing expanded query failed: %w", err) + } + if len(expandedStmts) == 0 { + return nil, errors.New("no statements in expanded query") + } + expandedRaw := expandedStmts[0].Raw + + // Use the analyzer to get type information from the database + result, err := c.analyzer.Analyze(ctx, expandedRaw, expandedQuery, c.schema, nil) + if err != nil { + return nil, err + } + + // Convert the analyzer result to the internal analysis format + var cols []*Column + for _, col := range result.Columns { + cols = append(cols, convertColumn(col)) + } + var params []Parameter + for _, p := range result.Params { + params = append(params, Parameter{ + Number: int(p.Number), + Column: convertColumn(p.Column), + }) + } + + // Determine the insert table if applicable + var table *ast.TableName + if insert, ok := expandedRaw.Stmt.(*ast.InsertStmt); ok { + table, _ = ParseTableName(insert.Relation) + } + + anlys = &analysis{ + Table: table, + Columns: cols, + Parameters: params, + Query: expandedQuery, + } + } else if c.analyzer != nil { + inference, _ := c.inferQuery(raw, rawSQL) + if inference == nil { + inference = &analysis{} + } + if inference.Query == "" { + inference.Query = rawSQL + } + + result, err := c.analyzer.Analyze(ctx, raw, inference.Query, c.schema, inference.Named) + if err != nil { + 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) + if err != nil { + return nil, err + } } + expanded := anlys.Query + // If the query string was edited, make sure the syntax is valid if expanded != rawSQL { if _, err := c.parser.Parse(strings.NewReader(expanded)); err != nil { @@ -124,13 +169,15 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, return nil, err } + md.Comments = comments + return &Query{ - Cmd: cmd, - Comments: comments, - Name: name, - Params: params, - Columns: cols, - SQL: trimmed, + RawStmt: raw, + Metadata: md, + Params: anlys.Parameters, + Columns: anlys.Columns, + SQL: trimmed, + InsertIntoTable: anlys.Table, }, nil } @@ -146,13 +193,27 @@ func rangeVars(root ast.Node) []*ast.RangeVar { return vars } -func uniqueParamRefs(in []paramRef) []paramRef { - m := make(map[int]struct{}, len(in)) +func uniqueParamRefs(in []paramRef, dollar bool) []paramRef { + m := make(map[int]bool, len(in)) o := make([]paramRef, 0, len(in)) for _, v := range in { - if _, ok := m[v.ref.Number]; !ok { - m[v.ref.Number] = struct{}{} - o = append(o, v) + if !m[v.ref.Number] { + m[v.ref.Number] = true + if v.ref.Number != 0 { + o = append(o, v) + } + } + } + if !dollar { + start := 1 + for _, v := range in { + if v.ref.Number == 0 { + for m[start] { + start++ + } + v.ref.Number = start + o = append(o, v) + } } } return o diff --git a/internal/compiler/query.go b/internal/compiler/query.go index 3c6ebfc266..b3cf9d6154 100644 --- a/internal/compiler/query.go +++ b/internal/compiler/query.go @@ -1,38 +1,58 @@ package compiler import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" + "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 { Rel *ast.TableName Columns []*Column } type Column struct { - Name string - DataType string - NotNull bool - IsArray bool - Comment string - Length *int + 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 - Type *ast.TypeName + Scope string + Table *ast.TableName + TableAlias string + Type *ast.TypeName + EmbedTable *ast.TableName + + IsSqlcSlice bool // is this sqlc.slice() + + skipTableRequiredCheck bool } type Query struct { SQL string - Name string - Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows + Metadata metadata.Metadata Columns []*Column Params []Parameter - Comments []string - // XXX: Hack - Filename string + // Needed for CopyFrom + InsertIntoTable *ast.TableName + + // Needed for vet + RawStmt *ast.RawStmt } type Parameter struct { diff --git a/internal/compiler/query_catalog.go b/internal/compiler/query_catalog.go index ea477208c2..80b59d876c 100644 --- a/internal/compiler/query_catalog.go +++ b/internal/compiler/query_catalog.go @@ -1,18 +1,24 @@ package compiler import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/rewrite" ) type QueryCatalog struct { catalog *catalog.Catalog ctes map[string]*Table + embeds rewrite.EmbedSet } -func buildQueryCatalog(c *catalog.Catalog, node ast.Node) (*QueryCatalog, error) { +func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embeds rewrite.EmbedSet) (*QueryCatalog, error) { var with *ast.WithClause switch n := node.(type) { + case *ast.DeleteStmt: + with = n.WithClause case *ast.InsertStmt: with = n.WithClause case *ast.UpdateStmt: @@ -22,17 +28,30 @@ func buildQueryCatalog(c *catalog.Catalog, node ast.Node) (*QueryCatalog, error) default: with = nil } - qc := &QueryCatalog{catalog: c, ctes: map[string]*Table{}} + qc := &QueryCatalog{catalog: c, ctes: map[string]*Table{}, embeds: embeds} if with != nil { for _, item := range with.Ctes.Items { if cte, ok := item.(*ast.CommonTableExpr); ok { - cols, err := outputColumns(qc, cte.Ctequery) + cols, err := comp.outputColumns(qc, cte.Ctequery) if err != nil { return nil, err } + var names []string + if cte.Aliascolnames != nil { + for _, item := range cte.Aliascolnames.Items { + if val, ok := item.(*ast.String); ok { + names = append(names, val.Str) + } else { + names = append(names, "") + } + } + } rel := &ast.TableName{Name: *cte.Ctename} for i := range cols { cols[i].Table = rel + if len(names) > i { + cols[i].Name = names[i] + } } qc.ctes[*cte.Ctename] = &Table{ Rel: rel, @@ -46,20 +65,22 @@ func buildQueryCatalog(c *catalog.Catalog, node ast.Node) (*QueryCatalog, error) func ConvertColumn(rel *ast.TableName, c *catalog.Column) *Column { return &Column{ - Table: rel, - Name: c.Name, - DataType: dataType(&c.Type), - NotNull: c.IsNotNull, - IsArray: c.IsArray, - Type: &c.Type, - Length: c.Length, + Table: rel, + Name: c.Name, + DataType: dataType(&c.Type), + NotNull: c.IsNotNull, + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Type: &c.Type, + Length: c.Length, } } func (qc QueryCatalog) GetTable(rel *ast.TableName) (*Table, error) { cte, exists := qc.ctes[rel.Name] if exists { - return cte, nil + return &Table{Rel: rel, Columns: cte.Columns}, nil } src, err := qc.catalog.GetTable(rel) if err != nil { @@ -71,3 +92,18 @@ func (qc QueryCatalog) GetTable(rel *ast.TableName) (*Table, error) { } return &Table{Rel: rel, Columns: cols}, nil } + +func (qc QueryCatalog) GetFunc(rel *ast.FuncName) (*Function, error) { + funcs, err := qc.catalog.ListFuncsByName(rel) + if err != nil { + return nil, err + } + if len(funcs) == 0 { + return nil, fmt.Errorf("function not found: %s", rel.Name) + } + 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 5871701ed2..b1fbb1990e 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -2,12 +2,15 @@ package compiler import ( "fmt" + "log/slog" "strconv" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/catalog" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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/named" + "github.com/sqlc-dev/sqlc/internal/sql/rewrite" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) func dataType(n *ast.TypeName) string { @@ -18,17 +21,33 @@ func dataType(n *ast.TypeName) string { } } -func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef, names map[int]string) ([]Parameter, error) { +func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet) ([]Parameter, error) { + c := comp.catalog + aliasMap := map[string]*ast.TableName{} // TODO: Deprecate defaultTable var defaultTable *ast.TableName var tables []*ast.TableName - parameterName := func(n int, defaultName string) string { - if n, ok := names[n]; ok { - return n + typeMap := map[string]map[string]map[string]*catalog.Column{} + indexTable := func(table catalog.Table) error { + tables = append(tables, table.Rel) + if defaultTable == nil { + defaultTable = table.Rel + } + schema := table.Rel.Schema + if schema == "" { + schema = c.DefaultSchema + } + if _, exists := typeMap[schema]; !exists { + typeMap[schema] = map[string]map[string]*catalog.Column{} } - return defaultName + typeMap[schema][table.Rel.Name] = map[string]*catalog.Column{} + for _, c := range table.Columns { + cc := c + typeMap[schema][table.Rel.Name][c.Name] = cc + } + return nil } for _, rv := range rvs { @@ -39,53 +58,86 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef if err != nil { return nil, err } - tables = append(tables, fqn) - if defaultTable == nil { - defaultTable = fqn - } - if rv.Alias == nil { + if _, found := aliasMap[fqn.Name]; found { continue } - aliasMap[*rv.Alias.Aliasname] = fqn - } - - typeMap := map[string]map[string]map[string]*catalog.Column{} - for _, fqn := range tables { table, err := c.GetTable(fqn) if err != nil { + 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 + } continue } - if _, exists := typeMap[fqn.Schema]; !exists { - typeMap[fqn.Schema] = map[string]map[string]*catalog.Column{} + err = indexTable(table) + if err != nil { + return nil, err + } + if rv.Alias != nil { + aliasMap[*rv.Alias.Aliasname] = fqn } - typeMap[fqn.Schema][fqn.Name] = map[string]*catalog.Column{} - for _, c := range table.Columns { - cc := c - typeMap[fqn.Schema][fqn.Name][c.Name] = cc + } + + // resolve a table for an embed + for _, embed := range embeds { + table, err := c.GetTable(embed.Table) + if err == nil { + embed.Table = table.Rel + continue } + + if alias, ok := aliasMap[embed.Table.Name]; ok { + embed.Table = alias + continue + } + + return nil, fmt.Errorf("unable to resolve table with %q: %w", embed.Orig(), err) } 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) { case *limitOffset: + defaultP := named.NewInferredParam("offset", true) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ - Name: parameterName(ref.ref.Number, "offset"), - DataType: "integer", - NotNull: true, + Name: p.Name(), + DataType: "integer", + NotNull: p.NotNull(), + IsNamedParam: isNamed, }, }) case *limitCount: + defaultP := named.NewInferredParam("limit", true) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ - Name: parameterName(ref.ref.Number, "limit"), - DataType: "integer", - NotNull: true, + Name: p.Name(), + DataType: "integer", + NotNull: p.NotNull(), + IsNamedParam: isNamed, }, }) @@ -96,26 +148,38 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef _, ok := node.(*ast.ColumnRef) return ok }) + if len(list.Items) == 0 { + list = astutils.Search(n.Rexpr, func(node ast.Node) bool { + _, ok := node.(*ast.ColumnRef) + return ok + }) + } if len(list.Items) == 0 { // TODO: Move this to database-specific engine package dataType := "any" if astutils.Join(n.Name, ".") == "||" { - dataType = "string" + dataType = "text" } + + defaultP := named.NewParam("") + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ - Name: parameterName(ref.ref.Number, ""), - DataType: dataType, + Name: p.Name(), + DataType: dataType, + IsNamedParam: isNamed, + NotNull: p.NotNull(), + IsSqlcSlice: p.IsSqlcSlice(), }, }) continue } - switch left := list.Items[0].(type) { + switch node := list.Items[0].(type) { case *ast.ColumnRef: - items := stringSlice(left.Fields) + items := stringSlice(node.Fields) var key, alias string switch len(items) { case 1: @@ -123,6 +187,10 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef 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))) } @@ -132,29 +200,51 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef if original, ok := aliasMap[alias]; ok { search = []*ast.TableName{original} } else { + var located bool for _, fqn := range tables { if fqn.Name == alias { + located = true search = []*ast.TableName{fqn} } } + if !located { + return nil, &sqlerr.Error{ + Code: "42703", + Message: fmt.Sprintf("table alias %q does not exist", alias), + Location: node.Location, + } + } } } var found int for _, table := range search { - if c, ok := typeMap[table.Schema][table.Name][key]; ok { + schema := table.Schema + if schema == "" { + schema = c.DefaultSchema + } + if c, ok := typeMap[schema][table.Name][key]; ok { found += 1 if ref.name != "" { key = ref.name } + + defaultP := named.NewInferredParam(key, c.IsNotNull) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ - Name: parameterName(ref.ref.Number, key), - DataType: dataType(&c.Type), - NotNull: c.IsNotNull, - IsArray: c.IsArray, - Table: table, + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Length: c.Length, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), }, }) } @@ -163,19 +253,68 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef if found == 0 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", key), - Location: left.Location, + Message: fmt.Sprintf("column %q does not exist", key), + Location: node.Location, } } if found > 1 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" is ambiguous", key), - Location: left.Location, + Message: fmt.Sprintf("column reference %q is ambiguous", key), + Location: node.Location, } } } + case *ast.BetweenExpr: + if n == nil || n.Expr == nil || n.Left == nil || n.Right == nil { + fmt.Println("ast.BetweenExpr is nil") + continue + } + + var key string + if ref, ok := n.Expr.(*ast.ColumnRef); ok { + itemsCount := len(ref.Fields.Items) + if str, ok := ref.Fields.Items[itemsCount-1].(*ast.String); ok { + key = str.Str + } + } + + for _, table := range tables { + schema := table.Schema + if schema == "" { + schema = c.DefaultSchema + } + + if c, ok := typeMap[schema][table.Name][key]; ok { + defaultP := named.NewInferredParam(key, c.IsNotNull) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + var namePrefix string + if !isNamed { + if ref.ref == n.Left { + namePrefix = "from_" + } else if ref.ref == n.Right { + namePrefix = "to_" + } + } + + a = append(a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: namePrefix + p.Name(), + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, + }) + } + } + case *ast.FuncCall: fun, err := c.ResolveFuncCall(n) if err != nil { @@ -193,6 +332,8 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef ReturnType: &ast.TypeName{Name: "any"}, } } + + var added bool for i, item := range n.Args.Items { funcName := fun.Name var argName string @@ -229,11 +370,18 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef if argName != "" { defaultName = argName } + + 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{ - Name: parameterName(ref.ref.Number, defaultName), - DataType: "any", + Name: p.Name(), + DataType: "any", + IsNamedParam: isNamed, + NotNull: p.NotNull(), + IsSqlcSlice: p.IsSqlcSlice(), }, }) continue @@ -241,9 +389,12 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef var paramName string var paramType *ast.TypeName + if argName == "" { - paramName = fun.Args[i].Name - paramType = fun.Args[i].Type + if i < len(fun.Args) { + paramName = fun.Args[i].Name + paramType = fun.Args[i].Type + } } else { paramName = argName for _, arg := range fun.Args { @@ -258,26 +409,60 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef if paramName == "" { paramName = funcName } + if paramType == nil { + paramType = &ast.TypeName{Name: ""} + } + 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{ - Name: parameterName(ref.ref.Number, paramName), - DataType: dataType(paramType), - NotNull: true, + Name: p.Name(), + DataType: dataType(paramType), + NotNull: p.NotNull(), + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), }, }) } + if fun.ReturnType == nil { + if !added { + addUnknownParam(ref) + } + continue + } + + table, err := c.GetTable(&ast.TableName{ + Catalog: fun.ReturnType.Catalog, + Schema: fun.ReturnType.Schema, + Name: fun.ReturnType.Name, + }) + if err != nil { + if !added { + addUnknownParam(ref) + } + continue + } + err = indexTable(table) + if err != nil { + return nil, err + } + case *ast.ResTarget: if n.Name == nil { return nil, fmt.Errorf("*ast.ResTarget has nil name") } key := *n.Name + var schema, rel string // TODO: Deprecate defaultTable - schema := defaultTable.Schema - rel := defaultTable.Name + if defaultTable != nil { + schema = defaultTable.Schema + rel = defaultTable.Name + } if ref.rv != nil { fqn, err := ParseTableName(ref.rv) if err != nil { @@ -286,21 +471,38 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef schema = fqn.Schema rel = fqn.Name } - if c, ok := typeMap[schema][rel][key]; ok { + if schema == "" { + schema = c.DefaultSchema + } + + tableMap, ok := typeMap[schema][rel] + if !ok { + return nil, sqlerr.RelationNotFound(rel) + } + + if c, ok := tableMap[key]; ok { + defaultP := named.NewInferredParam(key, c.IsNotNull) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ - Name: parameterName(ref.ref.Number, key), - DataType: dataType(&c.Type), - NotNull: c.IsNotNull, - IsArray: c.IsArray, - Table: &ast.TableName{Schema: schema, Name: rel}, + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: &ast.TableName{Schema: schema, Name: rel}, + Length: c.Length, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), }, }) } else { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", key), + Message: fmt.Sprintf("column %q does not exist", key), Location: n.Location, } } @@ -310,7 +512,11 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef return nil, fmt.Errorf("*ast.TypeCast has nil type name") } col := toColumn(n.TypeName) - col.Name = parameterName(ref.ref.Number, col.Name) + defaultP := named.NewInferredParam(col.Name, col.NotNull) + p, _ := params.FetchMerge(ref.ref.Number, defaultP) + + col.Name = p.Name() + col.NotNull = p.NotNull() a = append(a, Parameter{ Number: ref.ref.Number, Column: col, @@ -319,8 +525,112 @@ func resolveCatalogRefs(c *catalog.Catalog, rvs []*ast.RangeVar, args []paramRef case *ast.ParamRef: a = append(a, Parameter{Number: ref.ref.Number}) + case *ast.In: + if n == nil || n.List == nil { + fmt.Println("ast.In is nil") + continue + } + + number := 0 + if pr, ok := n.List[0].(*ast.ParamRef); ok { + number = pr.Number + } + + location := 0 + var key, alias string + var items []string + + if left, ok := n.Expr.(*ast.ColumnRef); ok { + location = left.Location + items = stringSlice(left.Fields) + } else if left, ok := n.Expr.(*ast.ParamRef); ok { + if len(n.List) <= 0 { + continue + } + if right, ok := n.List[0].(*ast.ColumnRef); ok { + location = left.Location + items = stringSlice(right.Fields) + } else { + continue + } + } else { + continue + } + + switch len(items) { + case 1: + key = items[0] + case 2: + alias = items[0] + key = items[1] + default: + panic("too many field items: " + strconv.Itoa(len(items))) + } + + var found int + if n.Sel == nil { + search := tables + if alias != "" { + if original, ok := aliasMap[alias]; ok { + search = []*ast.TableName{original} + } else { + for _, fqn := range tables { + if fqn.Name == alias { + search = []*ast.TableName{fqn} + } + } + } + } + + for _, table := range search { + schema := table.Schema + if schema == "" { + schema = c.DefaultSchema + } + if c, ok := typeMap[schema][table.Name][key]; ok { + found += 1 + if ref.name != "" { + key = ref.name + } + defaultP := named.NewInferredParam(key, c.IsNotNull) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + a = append(a, Parameter{ + Number: number, + Column: &Column{ + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: c.IsNotNull, + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, + }) + } + } + } + + if found == 0 { + return nil, &sqlerr.Error{ + Code: "42703", + Message: fmt.Sprintf("396: column %q does not exist", key), + Location: location, + } + } + if found > 1 { + return nil, &sqlerr.Error{ + Code: "42703", + Message: fmt.Sprintf("in same name column reference %q is ambiguous", key), + Location: location, + } + } + default: - fmt.Printf("unsupported reference type: %T", n) + slog.Debug("unsupported reference type", "type", fmt.Sprintf("%T", n)) + addUnknownParam(ref) } } return a, nil diff --git a/internal/compiler/result.go b/internal/compiler/result.go index bf522bbaa4..3647da630f 100644 --- a/internal/compiler/result.go +++ b/internal/compiler/result.go @@ -1,7 +1,7 @@ package compiler import ( - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) type Result struct { diff --git a/internal/compiler/selector.go b/internal/compiler/selector.go new file mode 100644 index 0000000000..04d118ff9c --- /dev/null +++ b/internal/compiler/selector.go @@ -0,0 +1,46 @@ +package compiler + +// 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 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/compiler/to_column.go b/internal/compiler/to_column.go index 14dee0ac2f..3267107c8b 100644 --- a/internal/compiler/to_column.go +++ b/internal/compiler/to_column.go @@ -3,15 +3,15 @@ package compiler import ( "strings" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" ) -func isArray(n *ast.TypeName) bool { - if n == nil { - return false +func arrayDims(n *ast.TypeName) int { + if n == nil || n.ArrayBounds == nil { + return 0 } - return len(n.ArrayBounds.Items) > 0 + return len(n.ArrayBounds.Items) } func toColumn(n *ast.TypeName) *Column { @@ -22,10 +22,12 @@ func toColumn(n *ast.TypeName) *Column { if err != nil { panic("toColumn: " + err.Error()) } + arrayDims := arrayDims(n) return &Column{ - Type: typ, - DataType: strings.TrimPrefix(astutils.Join(n.Names, "."), "."), - NotNull: true, // XXX: How do we know if this should be null? - IsArray: isArray(n), + Type: typ, + DataType: strings.TrimPrefix(astutils.Join(n.Names, "."), "."), + NotNull: true, // XXX: How do we know if this should be null? + IsArray: arrayDims > 0, + ArrayDims: arrayDims, } } diff --git a/internal/config/config.go b/internal/config/config.go index e4eeff91ca..d3e610ef05 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -4,31 +4,13 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "io" - "os" - "strings" - yaml "gopkg.in/yaml.v3" + "gopkg.in/yaml.v3" - "github.com/kyleconroy/sqlc/internal/core" + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) -const errMessageNoVersion = `The configuration file must have a version number. -Set the version to 1 at the top of sqlc.json: - -{ - "version": "1" - ... -} -` - -const errMessageUnknownVersion = `The configuration file has an invalid version number. -The only supported version is "1". -` - -const errMessageNoPackages = `No packages are configured` - type versionSetting struct { Number string `json:"version" yaml:"version"` } @@ -71,153 +53,194 @@ func (p *Paths) UnmarshalYAML(unmarshal func(interface{}) error) error { const ( EngineMySQL Engine = "mysql" EnginePostgreSQL Engine = "postgresql" - - // Experimental engines - EngineXLemon Engine = "_lemon" + EngineSQLite Engine = "sqlite" ) type Config struct { - Version string `json:"version" yaml:"version"` - SQL []SQL `json:"sql" yaml:"sql"` - Gen Gen `json:"overrides,omitempty" yaml:"overrides"` + 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,omitempty" yaml:"overrides"` + Plugins []Plugin `json:"plugins" yaml:"plugins"` + Rules []Rule `json:"rules" yaml:"rules"` + Options map[string]yaml.Node `json:"options" yaml:"options"` } -type Gen struct { - Go *GenGo `json:"go,omitempty" yaml:"go"` - Kotlin *GenKotlin `json:"kotlin,omitempty" yaml:"kotlin"` +type Server struct { + Name string `json:"name,omitempty" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + URI string `json:"uri" yaml:"uri"` } -type GenGo struct { - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +type Database struct { + URI string `json:"uri" yaml:"uri"` + Managed bool `json:"managed" yaml:"managed"` } -type GenKotlin struct { - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +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 SQL struct { - Engine Engine `json:"engine,omitempty" yaml:"engine"` - Schema Paths `json:"schema" yaml:"schema"` - Queries Paths `json:"queries" yaml:"queries"` - Gen SQLGen `json:"gen" yaml:"gen"` +type Plugin struct { + Name string `json:"name" yaml:"name"` + Env []string `json:"env" yaml:"env"` + Process *struct { + Cmd string `json:"cmd" yaml:"cmd"` + Format string `json:"format" yaml:"format"` + } `json:"process" yaml:"process"` + WASM *struct { + URL string `json:"url" yaml:"url"` + SHA256 string `json:"sha256" yaml:"sha256"` + } `json:"wasm" yaml:"wasm"` } -type SQLGen struct { - Go *SQLGo `json:"go,omitempty" yaml:"go"` - Kotlin *SQLKotlin `json:"kotlin,omitempty" yaml:"kotlin"` +type Rule struct { + Name string `json:"name" yaml:"name"` + Rule string `json:"rule" yaml:"rule"` + Msg string `json:"message" yaml:"message"` } -type SQLGo struct { - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - 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"` - 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"` +type Overrides struct { + Go *golang.GlobalOptions `json:"go,omitempty" yaml:"go"` } -type SQLKotlin struct { - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - Package string `json:"package" yaml:"package"` - Out string `json:"out" yaml:"out"` +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"` + Database *Database `json:"database" yaml:"database"` + StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` + StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` + Gen SQLGen `json:"gen" yaml:"gen"` + Codegen []Codegen `json:"codegen" yaml:"codegen"` + Rules []string `json:"rules" yaml:"rules"` + Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` } -type Override struct { - // name of the golang type to use, e.g. `github.com/segmentio/ksuid.KSUID` - GoType GoType `json:"go_type" yaml:"go_type"` - - // fully qualified name of the Go type, e.g. `github.com/segmentio/ksuid.KSUID` - DBType string `json:"db_type" yaml:"db_type"` - 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"` - - // True if the GoType should override if the maching postgres type is nullable - Nullable bool `json:"nullable" yaml:"nullable"` - // Deprecated. Use the `nullable` property instead - Deprecated_Null bool `json:"null" yaml:"null"` +// AnalyzerDatabase represents the database analyzer setting. +// It can be a boolean (true/false) or the string "only" for database-only mode. +type AnalyzerDatabase struct { + value *bool // nil means not set, true/false for boolean values + isOnly bool // true when set to "only" +} - // fully qualified name of the column, e.g. `accounts.id` - Column string `json:"column" yaml:"column"` +// IsEnabled returns true if the database analyzer should be used. +// Returns true for both `true` and `"only"` settings. +func (a AnalyzerDatabase) IsEnabled() bool { + if a.isOnly { + return true + } + return a.value == nil || *a.value +} - ColumnName string - Table core.FQN - GoImportPath string - GoPackage string - GoTypeName string - GoBasicType bool +// IsOnly returns true if the analyzer is set to "only" mode. +func (a AnalyzerDatabase) IsOnly() bool { + return a.isOnly } -func (o *Override) Parse() error { +func (a *AnalyzerDatabase) UnmarshalJSON(data []byte) error { + // Try to unmarshal as boolean first + var b bool + if err := json.Unmarshal(data, &b); err == nil { + a.value = &b + a.isOnly = false + return nil + } - // 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") - if o.DBType != "" { - return fmt.Errorf(`Type override configurations cannot have "db_type" and "postres_type" together. Use "db_type" alone`) + // Try to unmarshal as string + var s string + if err := json.Unmarshal(data, &s); err == nil { + if s == "only" { + a.isOnly = true + a.value = nil + return nil } - o.DBType = o.Deprecated_PostgresType + return errors.New("analyzer.database must be true, false, or \"only\"") } - // validate deprecated null field - if o.Deprecated_Null { - fmt.Fprintf(os.Stderr, "WARNING: \"null\" is deprecated. Instead, use the \"nullable\" field.\n") - o.Nullable = true - } + return errors.New("analyzer.database must be true, false, or \"only\"") +} - // validate option combinations - switch { - case o.Column != "" && o.DBType != "": - return fmt.Errorf("Override specifying both `column` (%q) and `db_type` (%q) is not valid.", o.Column, o.DBType) - case o.Column == "" && o.DBType == "": - return fmt.Errorf("Override must specify one of either `column` or `db_type`") +func (a *AnalyzerDatabase) UnmarshalYAML(unmarshal func(interface{}) error) error { + // Try to unmarshal as boolean first + var b bool + if err := unmarshal(&b); err == nil { + a.value = &b + a.isOnly = false + return nil } - // validate Column - if o.Column != "" { - colParts := strings.Split(o.Column, ".") - switch len(colParts) { - case 2: - o.ColumnName = colParts[1] - o.Table = core.FQN{Schema: "public", Rel: colParts[0]} - case 3: - o.ColumnName = colParts[2] - o.Table = core.FQN{Schema: colParts[0], Rel: colParts[1]} - case 4: - o.ColumnName = colParts[3] - o.Table = core.FQN{Catalog: colParts[0], Schema: colParts[1], Rel: colParts[2]} - default: - return fmt.Errorf("Override `column` specifier %q is not the proper format, expected '[catalog.][schema.]colname.tablename'", o.Column) + // Try to unmarshal as string + var s string + if err := unmarshal(&s); err == nil { + if s == "only" { + a.isOnly = true + a.value = nil + return nil } + return errors.New("analyzer.database must be true, false, or \"only\"") } - // validate GoType - parsed, err := o.GoType.Parse() - if err != nil { - return err - } - o.GoImportPath = parsed.ImportPath - o.GoPackage = parsed.Package - o.GoTypeName = parsed.TypeName - o.GoBasicType = parsed.BasicType + return errors.New("analyzer.database must be true, false, or \"only\"") +} - return nil +type Analyzer struct { + Database AnalyzerDatabase `json:"database" yaml:"database"` +} + +// TODO: Figure out a better name for this +type Codegen struct { + Out string `json:"out" yaml:"out"` + Plugin string `json:"plugin" yaml:"plugin"` + Options yaml.Node `json:"options" yaml:"options"` +} + +type SQLGen struct { + Go *golang.Options `json:"go,omitempty" yaml:"go"` + JSON *SQLJSON `json:"json,omitempty" yaml:"json"` +} + +type SQLJSON struct { + Out string `json:"out" yaml:"out"` + Indent string `json:"indent,omitempty" yaml:"indent"` + Filename string `json:"filename,omitempty" yaml:"filename"` } -var ErrMissingVersion = errors.New("no version number") -var ErrUnknownVersion = errors.New("invalid version number") var ErrMissingEngine = errors.New("unknown engine") -var ErrUnknownEngine = errors.New("invalid engine") -var ErrNoPackages = errors.New("no packages") -var ErrNoPackageName = errors.New("missing package name") +var ErrMissingVersion = errors.New("no version number") +var ErrNoOutPath = errors.New("no output path") var ErrNoPackagePath = errors.New("missing package path") -var ErrKotlinNoOutPath = errors.New("no output 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 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: `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 @@ -232,23 +255,36 @@ 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 - Kotlin SQLKotlin - 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 } func Combine(conf Config, pkg SQL) CombinedSettings { @@ -256,19 +292,11 @@ func Combine(conf Config, pkg SQL) CombinedSettings { Global: conf, Package: pkg, } - if conf.Gen.Go != nil { - cs.Rename = conf.Gen.Go.Rename - cs.Overrides = append(cs.Overrides, conf.Gen.Go.Overrides...) - } - if conf.Gen.Kotlin != nil { - cs.Rename = conf.Gen.Kotlin.Rename - } if pkg.Gen.Go != nil { cs.Go = *pkg.Gen.Go - cs.Overrides = append(cs.Overrides, pkg.Gen.Go.Overrides...) } - if pkg.Gen.Kotlin != nil { - cs.Kotlin = *pkg.Gen.Kotlin + if pkg.Gen.JSON != nil { + cs.JSON = *pkg.Gen.JSON } return cs } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 3249d93398..57211d674c 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -64,87 +64,28 @@ func TestBadConfigs(t *testing.T) { } } -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, - }, - } { - 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"}, +const validConfigOne = `{ + "version": "1" + "packages": [] +}` + +func FuzzConfig(f *testing.F) { + f.Add(validConfigOne) + f.Fuzz(func(t *testing.T, orig string) { + ParseConfig(strings.NewReader(orig)) + }) +} + +func TestInvalidConfig(t *testing.T) { + err := Validate(&Config{ + SQL: []SQL{{ + Database: &Database{ + URI: "", + Managed: false, }, - "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 pars to fail; got nil") - } - if diff := cmp.Diff(tt.err, err.Error()); diff != "" { - t.Errorf("error mismatch;\n%s", diff) - } - }) + }}, + }) + if err == nil { + t.Errorf("expected err; got nil") } } diff --git a/internal/config/convert/convert.go b/internal/config/convert/convert.go new file mode 100644 index 0000000000..2bd0550886 --- /dev/null +++ b/internal/config/convert/convert.go @@ -0,0 +1,84 @@ +package convert + +import ( + "encoding/json" + "fmt" + "strconv" + + "gopkg.in/yaml.v3" +) + +func gen(n *yaml.Node) (interface{}, error) { + switch n.Kind { + + case yaml.MappingNode: + nn := map[string]interface{}{} + for i, _ := range n.Content { + if i%2 == 0 { + k := n.Content[i] + v, err := gen(n.Content[i+1]) + if err != nil { + return nil, err + } + nn[k.Value] = v + } + } + return nn, nil + + case yaml.SequenceNode: + nn := []interface{}{} + for i, _ := range n.Content { + v, err := gen(n.Content[i]) + if err != nil { + return nil, err + } + nn = append(nn, v) + } + return nn, nil + + case yaml.ScalarNode: + switch n.Tag { + + case "!!bool": + return strconv.ParseBool(n.Value) + + case "!!float": + return strconv.ParseFloat(n.Value, 64) + + case "!!int": + return strconv.Atoi(n.Value) + + case "!!null": + return nil, nil + + case "!!str": + return n.Value, nil + + default: + return n.Value, nil + + } + + case yaml.AliasNode: + return gen(n.Alias) + + default: + return nil, fmt.Errorf("unknown yaml value: %s (%s)", n.Value, n.Tag) + + } +} + +func YAMLtoJSON(n yaml.Node) ([]byte, error) { + if n.Kind == 0 { + return []byte{}, nil + } + iface, err := gen(&n) + if err != nil { + return nil, err + } + blob, err := json.Marshal(iface) + if err != nil { + return nil, err + } + return blob, nil +} diff --git a/internal/config/convert/convert_test.go b/internal/config/convert/convert_test.go new file mode 100644 index 0000000000..11e62ba571 --- /dev/null +++ b/internal/config/convert/convert_test.go @@ -0,0 +1,47 @@ +package convert + +import ( + "testing" + + "gopkg.in/yaml.v3" +) + +const anchor = ` +sql: + - schema: query.sql + queries: query.sql + engine: postgresql + codegen: + - out: gateway/src/gateway/services/organization + plugin: py + options: &base-options + query_parameter_limit: 1 + package: gateway + output_models_file_name: null + emit_module: true + emit_generators: false + emit_async: true + + - schema: query.sql + queries: query.sql + engine: postgresql + codegen: + - out: gateway/src/gateway/services/project + plugin: py + options: *base-options +` + +type config struct { + SQL yaml.Node `yaml:"sql"` +} + +func TestAlias(t *testing.T) { + var a config + err := yaml.Unmarshal([]byte(anchor), &a) + if err != nil { + t.Fatal(err) + } + if _, err := gen(&a.SQL); err != nil { + t.Fatal(err) + } +} 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/go_type.go b/internal/config/go_type.go deleted file mode 100644 index 8a2b3fa06a..0000000000 --- a/internal/config/go_type.go +++ /dev/null @@ -1,160 +0,0 @@ -package config - -import ( - "encoding/json" - "fmt" - "go/types" - "regexp" - "strings" -) - -type GoType struct { - Path string `json:"import" yaml:"import"` - Package string `json:"package" yaml:"package"` - Name string `json:"type" yaml:"type"` - Pointer bool `json:"pointer" yaml:"pointer"` - Spec string - BuiltIn bool -} - -type ParsedGoType struct { - ImportPath string - Package string - TypeName string - BasicType bool -} - -func (o *GoType) UnmarshalJSON(data []byte) error { - var spec string - if err := json.Unmarshal(data, &spec); err == nil { - *o = GoType{Spec: spec} - return nil - } - type alias GoType - var a alias - if err := json.Unmarshal(data, &a); err != nil { - return err - } - *o = GoType(a) - return nil -} - -func (o *GoType) UnmarshalYAML(unmarshal func(interface{}) error) error { - var spec string - if err := unmarshal(&spec); err == nil { - *o = GoType{Spec: spec} - return nil - } - type alias GoType - var a alias - if err := unmarshal(&a); err != nil { - return err - } - *o = GoType(a) - return nil -} - -var validIdentifier = regexp.MustCompile(`^[a-zA-Z0-9_]+$`) -var versionNumber = regexp.MustCompile(`^v[0-9]+$`) -var invalidIdentifier = regexp.MustCompile(`[^a-zA-Z0-9_]`) - -func generatePackageID(importPath string) (string, bool) { - parts := strings.Split(importPath, "/") - name := parts[len(parts)-1] - // If the last part of the import path is a valid identifier, assume that's the package name - if versionNumber.MatchString(name) && len(parts) >= 2 { - name = parts[len(parts)-2] - return invalidIdentifier.ReplaceAllString(strings.ToLower(name), "_"), true - } - if validIdentifier.MatchString(name) { - return name, false - } - return invalidIdentifier.ReplaceAllString(strings.ToLower(name), "_"), true -} - -// validate GoType -func (gt GoType) Parse() (*ParsedGoType, error) { - var o ParsedGoType - - if gt.Spec == "" { - // TODO: Validation - if gt.Path == "" && gt.Package != "" { - return nil, fmt.Errorf("Package override `go_type`: package name requires an import path") - } - var pkg string - var pkgNeedsAlias bool - - if gt.Package == "" && gt.Path != "" { - pkg, pkgNeedsAlias = generatePackageID(gt.Path) - if pkgNeedsAlias { - o.Package = pkg - } - } else { - pkg = gt.Package - o.Package = gt.Package - } - - o.ImportPath = gt.Path - o.TypeName = gt.Name - o.BasicType = gt.Path == "" && gt.Package == "" - if pkg != "" { - o.TypeName = pkg + "." + o.TypeName - } - if gt.Pointer { - o.TypeName = "*" + o.TypeName - } - return &o, nil - } - - input := gt.Spec - lastDot := strings.LastIndex(input, ".") - lastSlash := strings.LastIndex(input, "/") - typename := input - if lastDot == -1 && lastSlash == -1 { - // if the type name has no slash and no dot, validate that the type is a basic Go type - var found bool - for _, typ := range types.Typ { - info := typ.Info() - if info == 0 { - continue - } - if info&types.IsUntyped != 0 { - continue - } - if typename == typ.Name() { - found = true - } - } - if !found { - return nil, fmt.Errorf("Package override `go_type` specifier %q is not a Go basic type e.g. 'string'", input) - } - o.BasicType = true - } else { - // assume the type lives in a Go package - if lastDot == -1 { - return nil, fmt.Errorf("Package override `go_type` specifier %q is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'", input) - } - if lastSlash == -1 { - return nil, fmt.Errorf("Package override `go_type` specifier %q is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'", input) - } - typename = input[lastSlash+1:] - if strings.HasPrefix(typename, "go-") { - // a package name beginning with "go-" will give syntax errors in - // generated code. We should do the right thing and get the actual - // import name, but in lieu of that, stripping the leading "go-" may get - // us what we want. - typename = typename[len("go-"):] - } - if strings.HasSuffix(typename, "-go") { - typename = typename[:len(typename)-len("-go")] - } - o.ImportPath = input[:lastDot] - } - o.TypeName = typename - isPointer := input[0] == '*' - if isPointer { - o.ImportPath = o.ImportPath[1:] - o.TypeName = "*" + o.TypeName - } - return &o, nil -} diff --git a/internal/config/v_one.go b/internal/config/v_one.go index 55d6b3ae32..8efa9f42fc 100644 --- a/internal/config/v_one.go +++ b/internal/config/v_one.go @@ -6,28 +6,59 @@ 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"` - 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"` - 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"` - Overrides []Override `json:"overrides" yaml:"overrides"` + 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"` + 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"` + 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) { @@ -50,27 +81,20 @@ 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 } - 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 } @@ -94,31 +118,65 @@ func (c *V1GenerateSettings) ValidateGlobalOverrides() error { func (c *V1GenerateSettings) Translate() Config { conf := Config{ Version: c.Version, + Cloud: c.Cloud, + Rules: c.Rules, } for _, pkg := range c.Packages { + if pkg.StrictOrderBy == nil { + defaultValue := true + pkg.StrictOrderBy = &defaultValue + } conf.SQL = append(conf.SQL, SQL{ - Engine: pkg.Engine, - Schema: pkg.Schema, - Queries: pkg.Queries, + Name: pkg.Name, + Engine: pkg.Engine, + Database: pkg.Database, + Schema: pkg.Schema, + Queries: pkg.Queries, + Rules: pkg.Rules, + Analyzer: pkg.Analyzer, Gen: SQLGen{ - Go: &SQLGo{ - EmitInterface: pkg.EmitInterface, - EmitJSONTags: pkg.EmitJSONTags, - EmitDBTags: pkg.EmitDBTags, - EmitPreparedQueries: pkg.EmitPreparedQueries, - EmitExactTableNames: pkg.EmitExactTableNames, - EmitEmptySlices: pkg.EmitEmptySlices, - Package: pkg.Name, - Out: pkg.Path, - Overrides: pkg.Overrides, + 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, + 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, + OutputQuerierFileName: pkg.OutputQuerierFileName, + OutputCopyfromFileName: pkg.OutputCopyFromFileName, + OutputFilesSuffix: pkg.OutputFilesSuffix, + QueryParameterLimit: pkg.QueryParameterLimit, + OmitSqlcVersion: pkg.OmitSqlcVersion, + OmitUnusedStructs: pkg.OmitUnusedStructs, + BuildTags: pkg.BuildTags, }, }, + StrictFunctionChecks: pkg.StrictFunctionChecks, + StrictOrderBy: pkg.StrictOrderBy, }) } 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 new file mode 100644 index 0000000000..e5ce9ec549 --- /dev/null +++ b/internal/config/v_one.json @@ -0,0 +1,349 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "const": "1" + }, + "cloud": { + "type": "object", + "properties": { + "organization": { + "type": "string" + }, + "project": { + "type": "string" + }, + "hostname": { + "type": "string" + } + } + }, + "packages": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "engine" + ], + "properties": { + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "schema": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "queries": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "database": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "managed": { + "type": "boolean" + } + } + }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "oneOf": [ + {"type": "boolean"}, + {"const": "only"} + ] + } + } + }, + "strict_function_checks": { + "type": "boolean" + }, + "strict_order_by": { + "type": "boolean" + }, + "emit_interface": { + "type": "boolean" + }, + "emit_json_tags": { + "type": "boolean" + }, + "json_tags_id_uppercase": { + "type": "boolean" + }, + "emit_db_tags": { + "type": "boolean" + }, + "emit_prepared_queries": { + "type": "boolean" + }, + "emit_exact_table_names": { + "type": "boolean" + }, + "emit_empty_slices": { + "type": "boolean" + }, + "emit_exported_queries": { + "type": "boolean" + }, + "emit_result_struct_pointers": { + "type": "boolean" + }, + "emit_params_struct_pointers": { + "type": "boolean" + }, + "emit_methods_with_db_argument": { + "type": "boolean" + }, + "emit_pointers_for_null_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" + }, + "json_tags_case_style": { + "type": "string" + }, + "package": { + "type": "string" + }, + "out": { + "type": "string" + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + }, + "sql_package": { + "type": "string" + }, + "sql_driver": { + "type": "string" + }, + "output_batch_file_name": { + "type": "string" + }, + "output_db_file_name": { + "type": "string" + }, + "output_models_file_name": { + "type": "string" + }, + "output_querier_file_name": { + "type": "string" + }, + "output_copyfrom_file_name": { + "type": "string" + }, + "output_files_suffix": { + "type": "string" + }, + "inflection_exclude_table_names": { + "type": "array", + "items": { + "type": "string" + } + }, + "query_parameter_limit": { + "type": "integer" + }, + "omit_unused_structs": { + "type": "boolean" + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "rule": { + "type": "string" + }, + "message": { + "type": "string" + } + } + } + } +} diff --git a/internal/config/v_two.go b/internal/config/v_two.go index 46c8ad31c4..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,12 +26,34 @@ 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": {}, + "json": {}, + } + plugins := map[string]struct{}{} + for i := range conf.Plugins { + if conf.Plugins[i].Name == "" { + return conf, ErrPluginNoName + } + if _, ok := builtins[conf.Plugins[i].Name]; ok { + return conf, ErrPluginBuiltin + } + if _, ok := plugins[conf.Plugins[i].Name]; ok { + return conf, ErrPluginExists + } + if conf.Plugins[i].Process == nil && conf.Plugins[i].WASM == nil { + return conf, ErrPluginNoType + } + if conf.Plugins[i].Process != nil && conf.Plugins[i].WASM != nil { + return conf, ErrPluginBothTypes + } + if conf.Plugins[i].Process != nil { + if conf.Plugins[i].Process.Cmd == "" { + return conf, ErrPluginProcessNoCmd } } + plugins[conf.Plugins[i].Name] = struct{}{} } for j := range conf.SQL { if conf.SQL[j].Engine == "" { @@ -42,22 +63,27 @@ 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) - } - for i := range conf.SQL[j].Gen.Go.Overrides { - if err := conf.SQL[j].Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } + } + if conf.SQL[j].Gen.JSON != nil { + if conf.SQL[j].Gen.JSON.Out == "" { + return conf, ErrNoOutPath } } - if conf.SQL[j].Gen.Kotlin != nil { - if conf.SQL[j].Gen.Kotlin.Out == "" { - return conf, ErrKotlinNoOutPath + for _, cg := range conf.SQL[j].Codegen { + if cg.Plugin == "" { + return conf, ErrPluginNoName } - if conf.SQL[j].Gen.Kotlin.Package == "" { - return conf, ErrNoPackageName + if cg.Out == "" { + return conf, ErrNoOutPath } + // TODO: Allow the use of built-in codegen from here + if _, ok := plugins[cg.Plugin]; !ok { + return conf, ErrPluginNotFound + } + } + if conf.SQL[j].StrictOrderBy == nil { + defaultValidate := true + conf.SQL[j].StrictOrderBy = &defaultValidate } } return conf, nil @@ -70,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 new file mode 100644 index 0000000000..22591d7335 --- /dev/null +++ b/internal/config/v_two.json @@ -0,0 +1,451 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "const": "2" + }, + "cloud": { + "type": "object", + "properties": { + "organization": { + "type": "string" + }, + "project": { + "type": "string" + }, + "hostname": { + "type": "string" + } + } + }, + "sql": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "engine" + ], + "properties": { + "name": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "schema": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "queries": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "database": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "managed": { + "type": "boolean" + } + } + }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "oneOf": [ + {"type": "boolean"}, + {"const": "only"} + ] + } + } + }, + "strict_function_checks": { + "type": "boolean" + }, + "strict_order_by": { + "type": "boolean" + }, + "gen": { + "type": "object", + "properties": { + "go": { + "type": "object", + "properties": { + "emit_interface": { + "type": "boolean" + }, + "emit_json_tags": { + "type": "boolean" + }, + "json_tags_id_uppercase": { + "type": "boolean" + }, + "emit_db_tags": { + "type": "boolean" + }, + "emit_prepared_queries": { + "type": "boolean" + }, + "emit_exact_table_names": { + "type": "boolean" + }, + "emit_empty_slices": { + "type": "boolean" + }, + "emit_exported_queries": { + "type": "boolean" + }, + "emit_result_struct_pointers": { + "type": "boolean" + }, + "emit_params_struct_pointers": { + "type": "boolean" + }, + "emit_methods_with_db_argument": { + "type": "boolean" + }, + "emit_pointers_for_null_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" + }, + "json_tags_case_style": { + "type": "string" + }, + "package": { + "type": "string" + }, + "out": { + "type": "string" + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "sql_package": { + "type": "string" + }, + "sql_driver": { + "type": "string" + }, + "output_batch_file_name": { + "type": "string" + }, + "output_db_file_name": { + "type": "string" + }, + "output_models_file_name": { + "type": "string" + }, + "output_querier_file_name": { + "type": "string" + }, + "output_copyfrom_file_name": { + "type": "string" + }, + "output_files_suffix": { + "type": "string" + }, + "inflection_exclude_table_names": { + "type": "array", + "items": { + "type": "string" + } + }, + "query_parameter_limit": { + "type": "integer" + }, + "omit_unused_structs": { + "type": "boolean" + } + }, + "json": { + "type": "object", + "properties": { + "out": { + "type": "string" + }, + "indent": { + "type": "string" + }, + "filename": { + "type": "string" + } + } + } + } + }, + "codegen": { + "type": "array", + "items": { + "type": "object", + "properties": { + "out": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "options": { + "type": "object" + } + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "overrides": { + "type": "object", + "properties": { + "go": { + "type": "object", + "properties": { + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + } + } + } + }, + "plugins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "process": { + "type": "object", + "properties": { + "cmd": { + "type": "string" + } + } + }, + "wasm": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "sha256": { + "type": "string" + } + } + } + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "rule": { + "type": "string" + }, + "message": { + "type": "string" + } + } + } + } + } +} diff --git a/internal/config/validate.go b/internal/config/validate.go new file mode 100644 index 0000000000..fadef4fb3b --- /dev/null +++ b/internal/config/validate.go @@ -0,0 +1,12 @@ +package config + +func Validate(c *Config) error { + for _, sql := range c.SQL { + if sql.Database != nil { + if sql.Database.URI == "" && !sql.Database.Managed { + return ErrInvalidDatabase + } + } + } + return nil +} 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/fqn.go b/internal/core/fqn.go deleted file mode 100644 index 5d76342787..0000000000 --- a/internal/core/fqn.go +++ /dev/null @@ -1,20 +0,0 @@ -package core - -// TODO: This is the last struct left over from the old architecture. Figure -// out how to remove it at some point -type FQN struct { - Catalog string - Schema string - Rel string -} - -func (f FQN) String() string { - s := f.Rel - if f.Schema != "" { - s = f.Schema + "." + s - } - if f.Catalog != "" { - s = f.Catalog + "." + s - } - return s -} diff --git a/internal/dbmanager/client.go b/internal/dbmanager/client.go new file mode 100644 index 0000000000..18aec947cb --- /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() (interface{}, 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 8eb4b83a31..6921ecb67f 100644 --- a/internal/debug/dump.go +++ b/internal/debug/dump.go @@ -1,15 +1,23 @@ package debug import ( + "encoding/json" + "fmt" "os" "github.com/davecgh/go-spew/spew" + + "github.com/sqlc-dev/sqlc/internal/opts" ) var Active bool +var Debug opts.Debug func init() { Active = os.Getenv("SQLCDEBUG") != "" + if Active { + Debug = opts.DebugFromEnv() + } } func Dump(n ...interface{}) { @@ -17,3 +25,10 @@ func Dump(n ...interface{}) { spew.Dump(n) } } + +func DumpAsJSON(a any) { + if Active { + out, _ := json.MarshalIndent(a, "", " ") + fmt.Printf("%s\n", out) + } +} 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 new file mode 100644 index 0000000000..4389a4da28 --- /dev/null +++ b/internal/endtoend/case_test.go @@ -0,0 +1,96 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "testing" +) + +type Testcase struct { + Name string + Path string + ConfigName string + Stderr []byte + Exec *Exec +} + +type ExecMeta struct { + InvalidSchema bool `json:"invalid_schema"` +} + +type Exec struct { + Command string `json:"command"` + 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 { + if _, err := os.Stat(path); !os.IsNotExist(err) { + blob, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + return blob + } + } + return nil +} + +func parseExec(t *testing.T, dir string) *Exec { + t.Helper() + path := filepath.Join(dir, "exec.json") + if _, err := os.Stat(path); os.IsNotExist(err) { + return nil + } + var e Exec + blob, err := os.ReadFile(path) + if err != nil { + t.Fatalf("%s: %s", path, err) + } + if err := json.Unmarshal(blob, &e); err != nil { + t.Fatalf("%s: %s", path, err) + } + if e.Command == "" { + e.Command = "generate" + } + return &e +} + +func FindTests(t *testing.T, root, testctx string) []*Testcase { + var tcs []*Testcase + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" { + dir := filepath.Dir(path) + tcs = append(tcs, &Testcase{ + Path: dir, + Name: strings.TrimPrefix(dir, root+string(filepath.Separator)), + ConfigName: info.Name(), + Stderr: parseStderr(t, dir, testctx), + Exec: parseExec(t, dir), + }) + return filepath.SkipDir + } + return nil + }) + if err != nil { + t.Fatal(err) + } + return tcs +} diff --git a/internal/endtoend/ddl_test.go b/internal/endtoend/ddl_test.go new file mode 100644 index 0000000000..bed9333743 --- /dev/null +++ b/internal/endtoend/ddl_test.go @@ -0,0 +1,61 @@ +package main + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" +) + +func TestValidSchema(t *testing.T) { + for _, replay := range FindTests(t, "testdata", "base") { + replay := replay // https://golang.org/doc/faq#closures_and_goroutines + + if replay.Exec != nil { + if replay.Exec.Meta.InvalidSchema { + continue + } + } + + file := filepath.Join(replay.Path, replay.ConfigName) + rd, err := os.Open(file) + if err != nil { + t.Fatal(err) + } + + conf, err := config.ParseConfig(rd) + if err != nil { + t.Fatal(err) + } + + for j, pkg := range conf.SQL { + j, pkg := j, pkg + 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() + + var schema []string + for _, path := range pkg.Schema { + schema = append(schema, filepath.Join(filepath.Dir(file), path)) + } + + switch pkg.Engine { + case config.EnginePostgreSQL: + local.PostgreSQL(t, schema) + case config.EngineMySQL: + local.MySQL(t, schema) + } + }) + } + } +} diff --git a/internal/endtoend/endtoend_test.go b/internal/endtoend/endtoend_test.go index c0fa4f4423..7634918446 100644 --- a/internal/endtoend/endtoend_test.go +++ b/internal/endtoend/endtoend_test.go @@ -2,26 +2,49 @@ package main import ( "bytes" - "io/ioutil" + "context" "os" + osexec "os/exec" "path/filepath" + "runtime" + "slices" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/kyleconroy/sqlc/internal/cmd" + "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/sqltest/docker" + "github.com/sqlc-dev/sqlc/internal/sqltest/native" ) +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() + examples, err := filepath.Abs(filepath.Join("..", "..", "examples")) if err != nil { t.Fatal(err) } - files, err := ioutil.ReadDir(examples) + files, err := os.ReadDir(examples) if err != nil { t.Fatal(err) } @@ -35,7 +58,11 @@ func TestExamples(t *testing.T) { t.Parallel() path := filepath.Join(examples, tc) var stderr bytes.Buffer - output, err := cmd.Generate(cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + output, err := cmd.Generate(ctx, path, "", opts) if err != nil { t.Fatalf("sqlc generate failed: %s", stderr.String()) } @@ -45,11 +72,12 @@ func TestExamples(t *testing.T) { } func BenchmarkExamples(b *testing.B) { + ctx := context.Background() examples, err := filepath.Abs(filepath.Join("..", "..", "examples")) if err != nil { b.Fatal(err) } - files, err := ioutil.ReadDir(examples) + files, err := os.ReadDir(examples) if err != nil { b.Fatal(err) } @@ -62,44 +90,215 @@ func BenchmarkExamples(b *testing.B) { path := filepath.Join(examples, tc) for i := 0; i < b.N; i++ { var stderr bytes.Buffer - cmd.Generate(cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + cmd.Generate(ctx, path, "", opts) } }) } } +type textContext struct { + Mutate func(*testing.T, string) func(*config.Config) + Enabled func() bool +} + func TestReplay(t *testing.T) { - t.Parallel() - var dirs []string - err := filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" { - dirs = append(dirs, filepath.Dir(path)) - return filepath.SkipDir + // Ensure that this environment variable is always set to true when running + // end-to-end tests + os.Setenv("SQLC_DUMMY_VALUE", "true") + + // 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 + } + } } - return nil - }) - if err != nil { - t.Fatal(err) } - for _, replay := range dirs { - tc := replay - t.Run(tc, func(t *testing.T) { - t.Parallel() - path, _ := filepath.Abs(tc) - var stderr bytes.Buffer - expected := expectedStderr(t, path) - output, err := cmd.Generate(cmd.Env{}, path, "", &stderr) - if len(expected) == 0 && err != nil { - t.Fatalf("sqlc generate failed: %s", stderr.String()) + + // 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 + } } - cmpDirectory(t, path, output) - if diff := cmp.Diff(expected, stderr.String()); diff != "" { - t.Errorf("stderr differed (-want +got):\n%s", diff) + 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(t *testing.T, path string) func(*config.Config) { return func(c *config.Config) {} }, + Enabled: func() bool { return true }, + }, + "managed-db": { + 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 { + // Enabled if at least one database URI is available + return postgresURI != "" || mysqlURI != "" + }, + }, + } + + for name, testctx := range contexts { + name := name + testctx := testctx + + if !testctx.Enabled() { + continue + } + + for _, replay := range FindTests(t, "testdata", name) { + tc := replay + t.Run(filepath.Join(name, tc.Name), func(t *testing.T) { + var stderr bytes.Buffer + var output map[string]string + var err error + + path, _ := filepath.Abs(tc.Path) + args := tc.Exec + if args == nil { + args = &Exec{Command: "generate"} + } + expected := string(tc.Stderr) + + if args.Process != "" { + _, err := osexec.LookPath(args.Process) + if err != nil { + t.Skipf("executable not found: %s %s", args.Process, err) + } + } + + if len(args.Contexts) > 0 { + if !slices.Contains(args.Contexts, name) { + t.Skipf("unsupported context: %s", name) + } + } + + if len(args.OS) > 0 { + if !slices.Contains(args.OS, runtime.GOOS) { + t.Skipf("unsupported os: %s", runtime.GOOS) + } + } + + opts := cmd.Options{ + Env: cmd.Env{ + Debug: opts.DebugFromString(args.Env["SQLCDEBUG"]), + Experiment: opts.ExperimentFromString(args.Env["SQLCEXPERIMENT"]), + NoRemote: true, + }, + Stderr: &stderr, + MutateConfig: testctx.Mutate(t, path), + } + + switch args.Command { + case "diff": + err = cmd.Diff(ctx, path, "", &opts) + case "generate": + output, err = cmd.Generate(ctx, path, "", &opts) + if err == nil { + cmpDirectory(t, path, output) + } + case "vet": + err = cmd.Vet(ctx, path, "", &opts) + default: + t.Fatalf("unknown command") + } + + if len(expected) == 0 && err != nil { + t.Fatalf("sqlc %s failed: %s", args.Command, stderr.String()) + } + + diff := cmp.Diff( + strings.TrimSpace(expected), + strings.TrimSpace(stderr.String()), + stderrTransformer(), + ) + if diff != "" { + t.Fatalf("stderr differed (-want +got):\n%s", diff) + } + }) + } } } @@ -112,7 +311,17 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) { if file.IsDir() { return nil } - if !strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, ".kt") { + if !strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, ".kt") && !strings.HasSuffix(path, ".py") && !strings.HasSuffix(path, ".json") && !strings.HasSuffix(path, ".txt") { + return nil + } + // TODO: Figure out a better way to ignore certain files + if strings.HasSuffix(path, ".txt") && filepath.Base(path) != "hello.txt" { + return nil + } + if filepath.Base(path) == "sqlc.json" { + return nil + } + if filepath.Base(path) == "exec.json" { return nil } if strings.Contains(path, "/kotlin/build") { @@ -121,7 +330,12 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) { if strings.HasSuffix(path, "_test.go") || strings.Contains(path, "src/test/") { return nil } - blob, err := ioutil.ReadFile(path) + if strings.Contains(path, "/python/.venv") || strings.Contains(path, "/python/src/tests/") || + strings.HasSuffix(path, "__init__.py") || strings.Contains(path, "/python/src/dbtest/") || + strings.Contains(path, "/python/.mypy_cache") { + return nil + } + blob, err := os.ReadFile(path) if err != nil { return err } @@ -132,44 +346,34 @@ 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 - tn := strings.Replace(name, dir+"/", "", -1) - t.Run(tn, func(t *testing.T) { - if actual[name] == "" { - t.Errorf("%s is empty", name) - return - } - if diff := cmp.Diff(contents, actual[name]); diff != "" { - t.Errorf("%s differed (-want +got):\n%s", name, diff) - } - }) - } - } -} - -func expectedStderr(t *testing.T, dir string) string { - t.Helper() - path := filepath.Join(dir, "stderr.txt") - if _, err := os.Stat(path); !os.IsNotExist(err) { - blob, err := ioutil.ReadFile(path) - if err != nil { - t.Fatal(err) + if actual[name] == "" { + t.Errorf("%s is empty", name) + return + } + if diff := cmp.Diff(contents, actual[name], opts...); diff != "" { + t.Errorf("%s differed (-want +got):\n%s", name, diff) + } } - return string(blob) } - return "" } func BenchmarkReplay(b *testing.B) { + ctx := context.Background() var dirs []string err := filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { if err != nil { return err } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" { + if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" { dirs = append(dirs, filepath.Dir(path)) return filepath.SkipDir } @@ -184,7 +388,11 @@ func BenchmarkReplay(b *testing.B) { path, _ := filepath.Abs(tc) for i := 0; i < b.N; i++ { var stderr bytes.Buffer - cmd.Generate(cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + cmd.Generate(ctx, path, "", opts) } }) } diff --git a/internal/endtoend/fmt_test.go b/internal/endtoend/fmt_test.go new file mode 100644 index 0000000000..eac3fa0390 --- /dev/null +++ b/internal/endtoend/fmt_test.go @@ -0,0 +1,186 @@ +package main + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "strings" + "testing" + + "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() + for _, tc := range FindTests(t, "testdata", "base") { + tc := tc + t.Run(tc.Name, func(t *testing.T) { + // 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) + } + 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 { + return "", err + } + if len(stmts) == 0 { + return "", nil + } + 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 len(stmts) == 0 { + return "", nil + } + return strings.ToLower(ast.Format(stmts[0].Raw, sqliteParser)), nil + } + default: + // Skip unsupported engines + return + } + + // 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 { + continue + } + 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 { + stmt := stmt + 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) + 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/json_schema_test.go b/internal/endtoend/json_schema_test.go new file mode 100644 index 0000000000..64893e2379 --- /dev/null +++ b/internal/endtoend/json_schema_test.go @@ -0,0 +1,82 @@ +package main + +import ( + "encoding/json" + "io/fs" + "os" + "path/filepath" + "testing" + + "github.com/xeipuuv/gojsonschema" +) + +type conf struct { + Version string `json:"version"` +} + +func loadSchema(t *testing.T, path string) *gojsonschema.Schema { + t.Helper() + + schemaBytes, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + + loader := gojsonschema.NewStringLoader(string(schemaBytes)) + schema, err := gojsonschema.NewSchema(loader) + if err != nil { + t.Fatalf("invalid schema: %s", err) + } + return schema +} + +func TestJsonSchema(t *testing.T) { + t.Parallel() + + schemaOne := loadSchema(t, filepath.Join("..", "config", "v_one.json")) + schemaTwo := loadSchema(t, filepath.Join("..", "config", "v_two.json")) + + srcs := []string{ + filepath.Join("..", "..", "examples"), + filepath.Join("testdata"), + } + + for _, dir := range srcs { + err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if filepath.Base(path) != "sqlc.json" { + return nil + } + t.Run(path, func(t *testing.T) { + t.Parallel() + contents, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + var c conf + if err := json.Unmarshal(contents, &c); err != nil { + t.Fatal(err) + } + l := gojsonschema.NewStringLoader(string(contents)) + switch c.Version { + case "1": + if _, err := schemaOne.Validate(l); err != nil { + t.Fatal(err) + } + case "2": + if _, err := schemaTwo.Validate(l); err != nil { + t.Fatal(err) + } + default: + t.Fatalf("unknown schema version: %s", c.Version) + } + }) + return nil + }) + if err != nil { + t.Error(err) + } + } +} diff --git a/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/exec.json b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..aaf587c793 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["managed-db"], + "env": { + "SQLCEXPERIMENT": "analyzerv2" + } +} diff --git a/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/accurate_cte/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..90b88c3389 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Product struct { + ID int32 + Name string + Price string +} diff --git a/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..8d31d41cdf --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getProductStats = `-- name: GetProductStats :one +WITH product_stats AS ( + SELECT COUNT(*) as total, AVG(price) as avg_price FROM products +) +SELECT total, avg_price FROM product_stats +` + +type GetProductStatsRow struct { + Total int64 + AvgPrice string +} + +func (q *Queries) GetProductStats(ctx context.Context) (GetProductStatsRow, error) { + row := q.db.QueryRowContext(ctx, getProductStats) + var i GetProductStatsRow + err := row.Scan(&i.Total, &i.AvgPrice) + return i, err +} + +const listExpensiveProducts = `-- name: ListExpensiveProducts :many +WITH expensive AS ( + SELECT id, name, price FROM products WHERE price > 100 +) +SELECT id, name, price FROM expensive +` + +type ListExpensiveProductsRow struct { + ID int32 + Name string + Price string +} + +func (q *Queries) ListExpensiveProducts(ctx context.Context) ([]ListExpensiveProductsRow, error) { + rows, err := q.db.QueryContext(ctx, listExpensiveProducts) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListExpensiveProductsRow + for rows.Next() { + var i ListExpensiveProductsRow + if err := rows.Scan(&i.ID, &i.Name, &i.Price); 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/accurate_cte/postgresql/stdlib/query.sql b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..4626fe0f04 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: ListExpensiveProducts :many +WITH expensive AS ( + SELECT * FROM products WHERE price > 100 +) +SELECT * FROM expensive; + +-- name: GetProductStats :one +WITH product_stats AS ( + SELECT COUNT(*) as total, AVG(price) as avg_price FROM products +) +SELECT * FROM product_stats; diff --git a/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..17aaa6e650 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE products ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + price NUMERIC(10,2) NOT NULL +); diff --git a/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..629b01dea6 --- /dev/null +++ b/internal/endtoend/testdata/accurate_cte/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,13 @@ +version: "2" +sql: + - engine: postgresql + schema: "schema.sql" + queries: "query.sql" + database: + managed: true + analyzer: + database: "only" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/exec.json b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..aaf587c793 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["managed-db"], + "env": { + "SQLCEXPERIMENT": "analyzerv2" + } +} diff --git a/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/accurate_enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..2b42787339 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/models.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusPending Status = "pending" + StatusActive Status = "active" + StatusCompleted Status = "completed" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 Task struct { + ID int32 + Title string + Status Status +} diff --git a/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..263a6b6736 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const createTask = `-- name: CreateTask :one +INSERT INTO tasks (title, status) VALUES ($1, $2) RETURNING id, title, status +` + +type CreateTaskParams struct { + Title string + Status Status +} + +func (q *Queries) CreateTask(ctx context.Context, arg CreateTaskParams) (Task, error) { + row := q.db.QueryRowContext(ctx, createTask, arg.Title, arg.Status) + var i Task + err := row.Scan(&i.ID, &i.Title, &i.Status) + return i, err +} + +const getTasksByStatus = `-- name: GetTasksByStatus :many +SELECT id, title, status FROM tasks WHERE status = $1 +` + +func (q *Queries) GetTasksByStatus(ctx context.Context, status Status) ([]Task, error) { + rows, err := q.db.QueryContext(ctx, getTasksByStatus, status) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Task + for rows.Next() { + var i Task + if err := rows.Scan(&i.ID, &i.Title, &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 listTasks = `-- name: ListTasks :many +SELECT id, title, status FROM tasks +` + +func (q *Queries) ListTasks(ctx context.Context) ([]Task, error) { + rows, err := q.db.QueryContext(ctx, listTasks) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Task + for rows.Next() { + var i Task + if err := rows.Scan(&i.ID, &i.Title, &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/accurate_enum/postgresql/stdlib/query.sql b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..11dcd9bf48 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: ListTasks :many +SELECT * FROM tasks; + +-- name: GetTasksByStatus :many +SELECT * FROM tasks WHERE status = $1; + +-- name: CreateTask :one +INSERT INTO tasks (title, status) VALUES ($1, $2) RETURNING *; diff --git a/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..443ae9845f --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TYPE status AS ENUM ('pending', 'active', 'completed'); + +CREATE TABLE tasks ( + id SERIAL PRIMARY KEY, + title TEXT NOT NULL, + status status NOT NULL DEFAULT 'pending' +); diff --git a/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..629b01dea6 --- /dev/null +++ b/internal/endtoend/testdata/accurate_enum/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,13 @@ +version: "2" +sql: + - engine: postgresql + schema: "schema.sql" + queries: "query.sql" + database: + managed: true + analyzer: + database: "only" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/exec.json b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/exec.json new file mode 100644 index 0000000000..aaf587c793 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["managed-db"], + "env": { + "SQLCEXPERIMENT": "analyzerv2" + } +} diff --git a/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/db.go b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/accurate_sqlite/sqlite/stdlib/go/models.go b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/query.sql.go b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/query.sql.go new file mode 100644 index 0000000000..203224ead2 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/go/query.sql.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (name, bio) VALUES (?, ?) 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 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, bio FROM authors +` + +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/accurate_sqlite/sqlite/stdlib/query.sql b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/query.sql new file mode 100644 index 0000000000..8fe23a8600 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = ?; + +-- name: ListAuthors :many +SELECT * FROM authors; + +-- name: CreateAuthor :one +INSERT INTO authors (name, bio) VALUES (?, ?) RETURNING *; diff --git a/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/schema.sql b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/schema.sql new file mode 100644 index 0000000000..22fc0993c1 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/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/accurate_sqlite/sqlite/stdlib/sqlc.yaml b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/sqlc.yaml new file mode 100644 index 0000000000..d2da6c31b2 --- /dev/null +++ b/internal/endtoend/testdata/accurate_sqlite/sqlite/stdlib/sqlc.yaml @@ -0,0 +1,13 @@ +version: "2" +sql: + - engine: sqlite + schema: "schema.sql" + queries: "query.sql" + database: + managed: true + analyzer: + database: "only" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/exec.json b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..aaf587c793 --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["managed-db"], + "env": { + "SQLCEXPERIMENT": "analyzerv2" + } +} diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/accurate_star_expansion/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ec1cb8d670 --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..9e2820cdbd --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,93 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +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 :one +DELETE FROM authors WHERE id = $1 RETURNING id, name, bio +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int32) (Author, error) { + row := q.db.QueryRowContext(ctx, deleteAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors WHERE id = $1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int32) (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 +` + +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 +} + +const updateAuthor = `-- name: UpdateAuthor :one +UPDATE authors SET name = $1, bio = $2 WHERE id = $3 RETURNING id, name, bio +` + +type UpdateAuthorParams struct { + Name string + Bio sql.NullString + ID int32 +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, updateAuthor, arg.Name, arg.Bio, arg.ID) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/query.sql b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..e091a5eaef --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/query.sql @@ -0,0 +1,14 @@ +-- name: ListAuthors :many +SELECT * FROM authors; + +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = $1; + +-- name: CreateAuthor :one +INSERT INTO authors (name, bio) VALUES ($1, $2) RETURNING *; + +-- name: UpdateAuthor :one +UPDATE authors SET name = $1, bio = $2 WHERE id = $3 RETURNING *; + +-- name: DeleteAuthor :one +DELETE FROM authors WHERE id = $1 RETURNING *; diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca6ad1e2cf --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); diff --git a/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..629b01dea6 --- /dev/null +++ b/internal/endtoend/testdata/accurate_star_expansion/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,13 @@ +version: "2" +sql: + - engine: postgresql + schema: "schema.sql" + queries: "query.sql" + database: + managed: true + analyzer: + database: "only" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/alias/mysql/go/db.go b/internal/endtoend/testdata/alias/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/alias/mysql/go/db.go +++ b/internal/endtoend/testdata/alias/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/mysql/go/models.go b/internal/endtoend/testdata/alias/mysql/go/models.go index 18039acde9..65820844a6 100644 --- a/internal/endtoend/testdata/alias/mysql/go/models.go +++ b/internal/endtoend/testdata/alias/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + 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 f91a24ca01..65c9e9044e 100644 --- a/internal/endtoend/testdata/alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/alias/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +14,7 @@ DELETE FROM bar b WHERE b.id = ? ` -func (q *Queries) AliasBar(ctx context.Context, id int64) error { +func (q *Queries) AliasBar(ctx context.Context, id uint64) error { _, err := q.db.ExecContext(ctx, aliasBar, id) return err } diff --git a/internal/endtoend/testdata/alias/mysql/query.sql b/internal/endtoend/testdata/alias/mysql/query.sql index b9f6249f78..d762623472 100644 --- a/internal/endtoend/testdata/alias/mysql/query.sql +++ b/internal/endtoend/testdata/alias/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: AliasBar :exec DELETE FROM bar b WHERE b.id = ?; diff --git a/internal/endtoend/testdata/alias/mysql/schema.sql b/internal/endtoend/testdata/alias/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/mysql/sqlc.json b/internal/endtoend/testdata/alias/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/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/alias/postgresql/go/db.go b/internal/endtoend/testdata/alias/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/alias/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/alias/postgresql/go/models.go b/internal/endtoend/testdata/alias/postgresql/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/alias/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/alias/postgresql/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/go/query.sql.go deleted file mode 100644 index 0645e07f2b..0000000000 --- a/internal/endtoend/testdata/alias/postgresql/go/query.sql.go +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const aliasBar = `-- name: AliasBar :exec -DELETE FROM bar b -WHERE b.id = $1 -` - -func (q *Queries) AliasBar(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, aliasBar, id) - return err -} diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..91a4336a66 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const aliasBar = `-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1 +` + +func (q *Queries) AliasBar(ctx context.Context, id int32) error { + _, err := q.db.Exec(ctx, aliasBar, id) + return err +} diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..69c610ce9b --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..91a4336a66 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const aliasBar = `-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1 +` + +func (q *Queries) AliasBar(ctx context.Context, id int32) error { + _, err := q.db.Exec(ctx, aliasBar, id) + return err +} diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..69c610ce9b --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/alias/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/alias/postgresql/query.sql b/internal/endtoend/testdata/alias/postgresql/query.sql deleted file mode 100644 index f92b01765d..0000000000 --- a/internal/endtoend/testdata/alias/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: AliasBar :exec -DELETE FROM bar b -WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/sqlc.json b/internal/endtoend/testdata/alias/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/alias/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d082362095 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const aliasBar = `-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1 +` + +func (q *Queries) AliasBar(ctx context.Context, id int32) error { + _, err := q.db.ExecContext(ctx, aliasBar, id) + return err +} diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..69c610ce9b --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: AliasBar :exec +DELETE FROM bar b +WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/sqlc.json b/internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/sqlc.json rename to internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/alias/sqlite/go/db.go b/internal/endtoend/testdata/alias/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/alias/sqlite/go/models.go b/internal/endtoend/testdata/alias/sqlite/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..66c338beb1 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const aliasBar = `-- name: AliasBar :exec +DELETE FROM bar AS b +WHERE b.id = ? +` + +func (q *Queries) AliasBar(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, aliasBar, id) + return err +} diff --git a/internal/endtoend/testdata/alias/sqlite/query.sql b/internal/endtoend/testdata/alias/sqlite/query.sql new file mode 100644 index 0000000000..05df804af7 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/query.sql @@ -0,0 +1,3 @@ +-- name: AliasBar :exec +DELETE FROM bar AS b +WHERE b.id = ?; diff --git a/internal/endtoend/testdata/alias/sqlite/schema.sql b/internal/endtoend/testdata/alias/sqlite/schema.sql new file mode 100644 index 0000000000..89b739c996 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer NOT NULL PRIMARY KEY AUTOINCREMENT); + diff --git a/internal/endtoend/testdata/alias/sqlite/sqlc.json b/internal/endtoend/testdata/alias/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/any/go/db.go b/internal/endtoend/testdata/any/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/any/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/any/go/models.go b/internal/endtoend/testdata/any/go/models.go deleted file mode 100644 index 18039acde9..0000000000 --- a/internal/endtoend/testdata/any/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int64 -} diff --git a/internal/endtoend/testdata/any/go/query.sql.go b/internal/endtoend/testdata/any/go/query.sql.go deleted file mode 100644 index e52110bf4f..0000000000 --- a/internal/endtoend/testdata/any/go/query.sql.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/lib/pq" -) - -const any = `-- name: Any :many -SELECT id -FROM bar -WHERE foo = ANY($1::bigserial[]) -` - -func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, any, pq.Array(dollar_1)) - 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/any/pgx/v4/go/db.go b/internal/endtoend/testdata/any/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/any/pgx/v4/go/models.go b/internal/endtoend/testdata/any/pgx/v4/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d191817769 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/any/pgx/v4/query.sql b/internal/endtoend/testdata/any/pgx/v4/query.sql new file mode 100644 index 0000000000..82f863a2a0 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/query.sql @@ -0,0 +1,4 @@ +-- name: Any :many +SELECT id +FROM bar +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/pgx/v4/schema.sql b/internal/endtoend/testdata/any/pgx/v4/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/pgx/v4/sqlc.json b/internal/endtoend/testdata/any/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/any/pgx/v5/go/db.go b/internal/endtoend/testdata/any/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/any/pgx/v5/go/models.go b/internal/endtoend/testdata/any/pgx/v5/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d191817769 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/any/pgx/v5/query.sql b/internal/endtoend/testdata/any/pgx/v5/query.sql new file mode 100644 index 0000000000..82f863a2a0 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/query.sql @@ -0,0 +1,4 @@ +-- name: Any :many +SELECT id +FROM bar +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/pgx/v5/schema.sql b/internal/endtoend/testdata/any/pgx/v5/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/pgx/v5/sqlc.json b/internal/endtoend/testdata/any/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/any/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/any/query.sql b/internal/endtoend/testdata/any/query.sql deleted file mode 100644 index 9836cf66ea..0000000000 --- a/internal/endtoend/testdata/any/query.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE bar (id bigserial not null); - --- name: Any :many -SELECT id -FROM bar -WHERE foo = ANY($1::bigserial[]); diff --git a/internal/endtoend/testdata/any/sqlc.json b/internal/endtoend/testdata/any/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/any/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/any/stdlib/go/db.go b/internal/endtoend/testdata/any/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/any/stdlib/go/models.go b/internal/endtoend/testdata/any/stdlib/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..7adc371a65 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/lib/pq" +) + +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)) + 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/any/stdlib/query.sql b/internal/endtoend/testdata/any/stdlib/query.sql new file mode 100644 index 0000000000..82f863a2a0 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: Any :many +SELECT id +FROM bar +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/stdlib/schema.sql b/internal/endtoend/testdata/any/stdlib/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/stdlib/sqlc.json b/internal/endtoend/testdata/any/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/array_in/go/db.go b/internal/endtoend/testdata/array_in/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/array_in/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_in/go/models.go b/internal/endtoend/testdata/array_in/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/array_in/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/array_in/go/query.sql.go b/internal/endtoend/testdata/array_in/go/query.sql.go deleted file mode 100644 index efd55a1d37..0000000000 --- a/internal/endtoend/testdata/array_in/go/query.sql.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const in = `-- name: In :many -SELECT id -FROM bar -WHERE id IN ($1, $2) -` - -type InParams struct { - ID int32 - ID_2 int32 -} - -func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, in, arg.ID, arg.ID_2) - 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/array_in/pgx/v4/go/db.go b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/array_in/pgx/v4/go/models.go b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..6f95dad606 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const in = `-- name: In :many +SELECT id +FROM bar +WHERE id IN ($1, $2) +` + +type InParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { + rows, err := q.db.Query(ctx, in, arg.ID, arg.ID_2) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_in/pgx/v4/query.sql b/internal/endtoend/testdata/array_in/pgx/v4/query.sql new file mode 100644 index 0000000000..d412b55664 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/query.sql @@ -0,0 +1,4 @@ +-- name: In :many +SELECT * +FROM bar +WHERE id IN ($1, $2); diff --git a/internal/endtoend/testdata/array_in/pgx/v4/schema.sql b/internal/endtoend/testdata/array_in/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/db.go b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/array_in/pgx/v5/go/models.go b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..6f95dad606 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const in = `-- name: In :many +SELECT id +FROM bar +WHERE id IN ($1, $2) +` + +type InParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { + rows, err := q.db.Query(ctx, in, arg.ID, arg.ID_2) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_in/pgx/v5/query.sql b/internal/endtoend/testdata/array_in/pgx/v5/query.sql new file mode 100644 index 0000000000..d412b55664 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/query.sql @@ -0,0 +1,4 @@ +-- name: In :many +SELECT * +FROM bar +WHERE id IN ($1, $2); diff --git a/internal/endtoend/testdata/array_in/pgx/v5/schema.sql b/internal/endtoend/testdata/array_in/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/array_in/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/array_in/query.sql b/internal/endtoend/testdata/array_in/query.sql deleted file mode 100644 index 5a43588fdf..0000000000 --- a/internal/endtoend/testdata/array_in/query.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: In :many -SELECT * -FROM bar -WHERE id IN ($1, $2); diff --git a/internal/endtoend/testdata/array_in/sqlc.json b/internal/endtoend/testdata/array_in/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/array_in/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/array_in/stdlib/go/db.go b/internal/endtoend/testdata/array_in/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_in/stdlib/go/models.go b/internal/endtoend/testdata/array_in/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e63538bd0e --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const in = `-- name: In :many +SELECT id +FROM bar +WHERE id IN ($1, $2) +` + +type InParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, in, arg.ID, arg.ID_2) + 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/array_in/stdlib/query.sql b/internal/endtoend/testdata/array_in/stdlib/query.sql new file mode 100644 index 0000000000..d412b55664 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: In :many +SELECT * +FROM bar +WHERE id IN ($1, $2); diff --git a/internal/endtoend/testdata/array_in/stdlib/schema.sql b/internal/endtoend/testdata/array_in/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/stdlib/sqlc.json b/internal/endtoend/testdata/array_in/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/array_text/go/db.go b/internal/endtoend/testdata/array_text/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/array_text/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_text/go/models.go b/internal/endtoend/testdata/array_text/go/models.go deleted file mode 100644 index 0492fe3a51..0000000000 --- a/internal/endtoend/testdata/array_text/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - Tags []string -} diff --git a/internal/endtoend/testdata/array_text/go/query.sql.go b/internal/endtoend/testdata/array_text/go/query.sql.go deleted file mode 100644 index aafed82547..0000000000 --- a/internal/endtoend/testdata/array_text/go/query.sql.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/lib/pq" -) - -const textArray = `-- name: TextArray :many -SELECT tags FROM bar -` - -func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, textArray) - if err != nil { - return nil, err - } - defer rows.Close() - var items [][]string - for rows.Next() { - var tags []string - if err := rows.Scan(pq.Array(&tags)); err != nil { - return nil, err - } - items = append(items, tags) - } - 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_text/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/array_text/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go new file mode 100644 index 0000000000..84b877e966 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1c1dec9c23 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.Query(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var tags []string + if err := rows.Scan(&tags); err != nil { + return nil, err + } + items = append(items, tags) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_text/pgx/v4/query.sql b/internal/endtoend/testdata/array_text/pgx/v4/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/pgx/v4/schema.sql b/internal/endtoend/testdata/array_text/pgx/v4/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/db.go b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/array_text/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go new file mode 100644 index 0000000000..84b877e966 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1c1dec9c23 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.Query(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var tags []string + if err := rows.Scan(&tags); err != nil { + return nil, err + } + items = append(items, tags) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_text/pgx/v5/query.sql b/internal/endtoend/testdata/array_text/pgx/v5/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/pgx/v5/schema.sql b/internal/endtoend/testdata/array_text/pgx/v5/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/array_text/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/array_text/query.sql b/internal/endtoend/testdata/array_text/query.sql deleted file mode 100644 index cdb0878271..0000000000 --- a/internal/endtoend/testdata/array_text/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (tags text[] not null); - --- name: TextArray :many -SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/sqlc.json b/internal/endtoend/testdata/array_text/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/array_text/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/array_text/stdlib/go/db.go b/internal/endtoend/testdata/array_text/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_text/stdlib/go/models.go b/internal/endtoend/testdata/array_text/stdlib/go/models.go new file mode 100644 index 0000000000..84b877e966 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..20946c6015 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/lib/pq" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.QueryContext(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var tags []string + if err := rows.Scan(pq.Array(&tags)); err != nil { + return nil, err + } + items = append(items, tags) + } + 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_text/stdlib/query.sql b/internal/endtoend/testdata/array_text/stdlib/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/stdlib/schema.sql b/internal/endtoend/testdata/array_text/stdlib/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/stdlib/sqlc.json b/internal/endtoend/testdata/array_text/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/array_text_join/go/db.go b/internal/endtoend/testdata/array_text_join/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/array_text_join/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_text_join/go/models.go b/internal/endtoend/testdata/array_text_join/go/models.go deleted file mode 100644 index 1344e7ffea..0000000000 --- a/internal/endtoend/testdata/array_text_join/go/models.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID string - Info []string -} - -type Foo struct { - ID string - Bar string -} diff --git a/internal/endtoend/testdata/array_text_join/go/query.sql.go b/internal/endtoend/testdata/array_text_join/go/query.sql.go deleted file mode 100644 index 1e613f8db8..0000000000 --- a/internal/endtoend/testdata/array_text_join/go/query.sql.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/lib/pq" -) - -const joinTextArray = `-- name: JoinTextArray :many -SELECT bar.info -FROM foo -JOIN bar ON foo.bar = bar.id -` - -func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, joinTextArray) - if err != nil { - return nil, err - } - defer rows.Close() - var items [][]string - for rows.Next() { - var info []string - if err := rows.Scan(pq.Array(&info)); err != nil { - return nil, err - } - items = append(items, info) - } - 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_text_join/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/array_text_join/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go new file mode 100644 index 0000000000..90d0021ea1 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string + Info []string +} + +type Foo struct { + ID string + Bar 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 new file mode 100644 index 0000000000..f4eab73a31 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinTextArray = `-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id +` + +func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.Query(ctx, joinTextArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var info []string + if err := rows.Scan(&info); err != nil { + return nil, err + } + items = append(items, info) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql b/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql new file mode 100644 index 0000000000..68135c6cd9 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql @@ -0,0 +1,4 @@ +-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id; diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql b/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/array_text_join/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go new file mode 100644 index 0000000000..90d0021ea1 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string + Info []string +} + +type Foo struct { + ID string + Bar 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 new file mode 100644 index 0000000000..f4eab73a31 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinTextArray = `-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id +` + +func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.Query(ctx, joinTextArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var info []string + if err := rows.Scan(&info); err != nil { + return nil, err + } + items = append(items, info) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql b/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql new file mode 100644 index 0000000000..68135c6cd9 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql @@ -0,0 +1,4 @@ +-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id; diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql b/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/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/array_text_join/query.sql b/internal/endtoend/testdata/array_text_join/query.sql deleted file mode 100644 index 4b2417b860..0000000000 --- a/internal/endtoend/testdata/array_text_join/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE foo (id text not null, bar text not null); -CREATE TABLE bar (id text not null, info text[] not null); - --- name: JoinTextArray :many -SELECT bar.info -FROM foo -JOIN bar ON foo.bar = bar.id; diff --git a/internal/endtoend/testdata/array_text_join/sqlc.json b/internal/endtoend/testdata/array_text_join/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/array_text_join/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/db.go b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_text_join/stdlib/go/models.go b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go new file mode 100644 index 0000000000..90d0021ea1 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string + Info []string +} + +type Foo struct { + ID string + Bar 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 new file mode 100644 index 0000000000..5ffc67158e --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/lib/pq" +) + +const joinTextArray = `-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id +` + +func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { + rows, err := q.db.QueryContext(ctx, joinTextArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var info []string + if err := rows.Scan(pq.Array(&info)); err != nil { + return nil, err + } + items = append(items, info) + } + 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_text_join/stdlib/query.sql b/internal/endtoend/testdata/array_text_join/stdlib/query.sql new file mode 100644 index 0000000000..68135c6cd9 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: JoinTextArray :many +SELECT bar.info +FROM foo +JOIN bar ON foo.bar = bar.id; diff --git a/internal/endtoend/testdata/array_text_join/stdlib/schema.sql b/internal/endtoend/testdata/array_text_join/stdlib/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json b/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "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 new file mode 100644 index 0000000000..adaedfa3c0 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go @@ -0,0 +1,180 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package querytest + +import ( + "context" + "database/sql" + "errors" + + "github.com/jackc/pgx/v4" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const getValues = `-- name: GetValues :batchmany +SELECT a, b +FROM myschema.foo +WHERE b = $1 +` + +type GetValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range b { + vals := []interface{}{ + a, + } + batch.Queue(getValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &GetValuesBatchResults{br, len(b), false} +} + +func (b *GetValuesBatchResults) Query(f func(int, []MyschemaFoo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []MyschemaFoo + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var i MyschemaFoo + if err := rows.Scan(&i.A, &i.B); err != nil { + return err + } + items = append(items, i) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *GetValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const insertValues = `-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, sql.NullString, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var a sql.NullString + if b.closed { + if f != nil { + f(t, a, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&a) + if f != nil { + f(t, a, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const updateValues = `-- name: UpdateValues :batchexec +UPDATE myschema.foo SET a = $1, b = $2 +` + +type UpdateValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type UpdateValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *UpdateValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(updateValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &UpdateValuesBatchResults{br, len(arg), false} +} + +func (b *UpdateValuesBatchResults) 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 *UpdateValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..fa88475d3d --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f0e5a24373 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type MyschemaFoo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c8e2570a55 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql @@ -0,0 +1,12 @@ +-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a; + +-- name: GetValues :batchmany +SELECT * +FROM myschema.foo +WHERE b = $1; + +-- name: UpdateValues :batchexec +UPDATE myschema.foo SET a = $1, b = $2; diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go new file mode 100644 index 0000000000..b61a4ca6c8 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go @@ -0,0 +1,180 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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 getValues = `-- name: GetValues :batchmany +SELECT a, b +FROM myschema.foo +WHERE b = $1 +` + +type GetValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range b { + vals := []interface{}{ + a, + } + batch.Queue(getValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &GetValuesBatchResults{br, len(b), false} +} + +func (b *GetValuesBatchResults) Query(f func(int, []MyschemaFoo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []MyschemaFoo + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var i MyschemaFoo + if err := rows.Scan(&i.A, &i.B); err != nil { + return err + } + items = append(items, i) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *GetValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const insertValues = `-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, pgtype.Text, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var a pgtype.Text + if b.closed { + if f != nil { + f(t, a, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&a) + if f != nil { + f(t, a, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const updateValues = `-- name: UpdateValues :batchexec +UPDATE myschema.foo SET a = $1, b = $2 +` + +type UpdateValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type UpdateValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *UpdateValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(updateValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &UpdateValuesBatchResults{br, len(arg), false} +} + +func (b *UpdateValuesBatchResults) 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 *UpdateValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..9a44027379 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + 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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7226216da5 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type MyschemaFoo struct { + A pgtype.Text + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c8e2570a55 --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql @@ -0,0 +1,12 @@ +-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a; + +-- name: GetValues :batchmany +SELECT * +FROM myschema.foo +WHERE b = $1; + +-- name: UpdateValues :batchexec +UPDATE myschema.foo SET a = $1, b = $2; diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/batch/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/batch_imports/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go new file mode 100644 index 0000000000..adefff482a --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go @@ -0,0 +1,131 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package querytest + +import ( + "context" + "database/sql" + "errors" + + "github.com/jackc/pgx/v4" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const getValues = `-- name: GetValues :batchmany +SELECT a, b +FROM myschema.foo +WHERE b = $1 +` + +type GetValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range b { + vals := []interface{}{ + a, + } + batch.Queue(getValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &GetValuesBatchResults{br, len(b), false} +} + +func (b *GetValuesBatchResults) Query(f func(int, []MyschemaFoo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []MyschemaFoo + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var i MyschemaFoo + if err := rows.Scan(&i.A, &i.B); err != nil { + return err + } + items = append(items, i) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *GetValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const insertValues = `-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, sql.NullString, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var a sql.NullString + if b.closed { + if f != nil { + f(t, a, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&a) + if f != nil { + f(t, a, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..fa88475d3d --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f0e5a24373 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type MyschemaFoo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..e5b3f3a089 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const updateValues = `-- name: UpdateValues :exec +UPDATE myschema.foo SET a = $1, b = $2 +` + +type UpdateValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) UpdateValues(ctx context.Context, arg UpdateValuesParams) error { + _, err := q.db.Exec(ctx, updateValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..def00fb6ac --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql @@ -0,0 +1,12 @@ +-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a; + +-- name: GetValues :batchmany +SELECT * +FROM myschema.foo +WHERE b = $1; + +-- name: UpdateValues :exec +UPDATE myschema.foo SET a = $1, b = $2; diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..e9ed1d9634 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go @@ -0,0 +1,131 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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 getValues = `-- name: GetValues :batchmany +SELECT a, b +FROM myschema.foo +WHERE b = $1 +` + +type GetValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range b { + vals := []interface{}{ + a, + } + batch.Queue(getValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &GetValuesBatchResults{br, len(b), false} +} + +func (b *GetValuesBatchResults) Query(f func(int, []MyschemaFoo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []MyschemaFoo + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var i MyschemaFoo + if err := rows.Scan(&i.A, &i.B); err != nil { + return err + } + items = append(items, i) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *GetValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} + +const insertValues = `-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, pgtype.Text, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var a pgtype.Text + if b.closed { + if f != nil { + f(t, a, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&a) + if f != nil { + f(t, a, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..9a44027379 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + 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_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7226216da5 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type MyschemaFoo struct { + A pgtype.Text + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..c3bd3f6e65 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateValues = `-- name: UpdateValues :exec +UPDATE myschema.foo SET a = $1, b = $2 +` + +type UpdateValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) UpdateValues(ctx context.Context, arg UpdateValuesParams) error { + _, err := q.db.Exec(ctx, updateValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..def00fb6ac --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql @@ -0,0 +1,12 @@ +-- name: InsertValues :batchone +INSERT INTO myschema.foo (a, b) +VALUES ($1, $2) +RETURNING a; + +-- name: GetValues :batchmany +SELECT * +FROM myschema.foo +WHERE b = $1; + +-- name: UpdateValues :exec +UPDATE myschema.foo SET a = $1, b = $2; diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/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/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..9e0fc66652 --- /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.30.0 +// 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 := []interface{}{ + 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..9a44027379 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 + 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..e4cf9d17ae --- /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.30.0 + +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..a80cdbd2f0 --- /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.30.0 +// 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..bf8da49f59 --- /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.30.0 +// 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 := []interface{}{ + 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..9a44027379 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 + 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..c75fd00ac3 --- /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.30.0 + +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..a80cdbd2f0 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/between_args/mysql/go/models.go b/internal/endtoend/testdata/between_args/mysql/go/models.go new file mode 100644 index 0000000000..5d811ab385 --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Product struct { + ID int64 + Name string + Price int32 +} diff --git a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go new file mode 100644 index 0000000000..6270cb28c0 --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go @@ -0,0 +1,146 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBetweenPrices = `-- name: GetBetweenPrices :many +SELECT id, name, price +FROM products +WHERE price BETWEEN ? AND ? +` + +type GetBetweenPricesParams struct { + FromPrice int32 + ToPrice int32 +} + +func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPrices, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.ID, &i.Name, &i.Price); 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 getBetweenPricesNamed = `-- name: GetBetweenPricesNamed :many +SELECT id, name, price +FROM products +WHERE price BETWEEN ? AND ? +` + +type GetBetweenPricesNamedParams struct { + MinPrice int32 + MaxPrice int32 +} + +func (q *Queries) GetBetweenPricesNamed(ctx context.Context, arg GetBetweenPricesNamedParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPricesNamed, arg.MinPrice, arg.MaxPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.ID, &i.Name, &i.Price); 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 getBetweenPricesTable = `-- name: GetBetweenPricesTable :many +SELECT id, name, price +FROM products +WHERE products.price BETWEEN ? AND ? +` + +type GetBetweenPricesTableParams struct { + FromPrice int32 + ToPrice int32 +} + +func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPricesTableParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPricesTable, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.ID, &i.Name, &i.Price); 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 getBetweenPricesTableAlias = `-- name: GetBetweenPricesTableAlias :many +SELECT id, name, price +FROM products as p +WHERE p.price BETWEEN ? AND ? +` + +type GetBetweenPricesTableAliasParams struct { + FromPrice int32 + ToPrice int32 +} + +func (q *Queries) GetBetweenPricesTableAlias(ctx context.Context, arg GetBetweenPricesTableAliasParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAlias, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.ID, &i.Name, &i.Price); 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/between_args/mysql/query.sql b/internal/endtoend/testdata/between_args/mysql/query.sql new file mode 100644 index 0000000000..3632dfb5ca --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/query.sql @@ -0,0 +1,19 @@ +-- name: GetBetweenPrices :many +SELECT * +FROM products +WHERE price BETWEEN ? AND ?; + +-- name: GetBetweenPricesTable :many +SELECT * +FROM products +WHERE products.price BETWEEN ? AND ?; + +-- name: GetBetweenPricesTableAlias :many +SELECT * +FROM products as p +WHERE p.price BETWEEN ? AND ?; + +-- name: GetBetweenPricesNamed :many +SELECT * +FROM products +WHERE price BETWEEN sqlc.arg(min_price) AND sqlc.arg(max_price); diff --git a/internal/endtoend/testdata/between_args/mysql/schema.sql b/internal/endtoend/testdata/between_args/mysql/schema.sql new file mode 100644 index 0000000000..76f64e9ac2 --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE products ( + id BIGINT NOT NULL AUTO_INCREMENT, + name TEXT NOT NULL, + price INT NOT NULL, + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/between_args/mysql/sqlc.json b/internal/endtoend/testdata/between_args/mysql/sqlc.json new file mode 100644 index 0000000000..f0d61c7e82 --- /dev/null +++ b/internal/endtoend/testdata/between_args/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/between_args/sqlite/go/db.go b/internal/endtoend/testdata/between_args/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/between_args/sqlite/go/models.go b/internal/endtoend/testdata/between_args/sqlite/go/models.go new file mode 100644 index 0000000000..d03b9b329b --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4265ed944d --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go @@ -0,0 +1,112 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBetweenPrices = `-- name: GetBetweenPrices :many +SELECT name, price +FROM products +WHERE price BETWEEN ? AND ? +` + +type GetBetweenPricesParams struct { + FromPrice int64 + ToPrice int64 +} + +func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPrices, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.Name, &i.Price); 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 getBetweenPricesTable = `-- name: GetBetweenPricesTable :many +SELECT name, price +FROM products +WHERE products.price BETWEEN ? AND ? +` + +type GetBetweenPricesTableParams struct { + FromPrice int64 + ToPrice int64 +} + +func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPricesTableParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPricesTable, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.Name, &i.Price); 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 getBetweenPricesTableAlias = `-- name: GetBetweenPricesTableAlias :many +SELECT name, price +FROM products as p +WHERE p.price BETWEEN ? AND ? +` + +type GetBetweenPricesTableAliasParams struct { + FromPrice int64 + ToPrice int64 +} + +func (q *Queries) GetBetweenPricesTableAlias(ctx context.Context, arg GetBetweenPricesTableAliasParams) ([]Product, error) { + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAlias, arg.FromPrice, arg.ToPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Product + for rows.Next() { + var i Product + if err := rows.Scan(&i.Name, &i.Price); 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/between_args/sqlite/query.sql b/internal/endtoend/testdata/between_args/sqlite/query.sql new file mode 100644 index 0000000000..a7648ca582 --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/query.sql @@ -0,0 +1,14 @@ +-- name: GetBetweenPrices :many +SELECT * +FROM products +WHERE price BETWEEN ? AND ?; + +-- name: GetBetweenPricesTable :many +SELECT * +FROM products +WHERE products.price BETWEEN ? AND ?; + +-- name: GetBetweenPricesTableAlias :many +SELECT * +FROM products as p +WHERE p.price BETWEEN ? AND ?; diff --git a/internal/endtoend/testdata/between_args/sqlite/schema.sql b/internal/endtoend/testdata/between_args/sqlite/schema.sql new file mode 100644 index 0000000000..b13fafb48e --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE products ( + name TEXT NOT NULL, + price INT NOT NULL +); + diff --git a/internal/endtoend/testdata/between_args/sqlite/sqlc.json b/internal/endtoend/testdata/between_args/sqlite/sqlc.json new file mode 100644 index 0000000000..494a33e004 --- /dev/null +++ b/internal/endtoend/testdata/between_args/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/bit_string/pgx/v4/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/bit_string/pgx/v4/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go new file mode 100644 index 0000000000..0c086e39e1 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VBitNull pgtype.Varbit + VVarbitNull pgtype.Varbit + VBit pgtype.Varbit + VVarbit pgtype.Varbit +} 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 new file mode 100644 index 0000000000..c69ebfb265 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_bit_null, v_varbit_null, v_bit, v_varbit +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBitNull, + &i.VVarbitNull, + &i.VBit, + &i.VVarbit, + ); 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/bit_string/pgx/v4/query.sql b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql b/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql new file mode 100644 index 0000000000..0790c781d8 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE test_table +( + v_bit_null bit(3), + v_varbit_null bit varying(3), + v_bit bit(3) not null, + v_varbit bit varying(3) not null +); + diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/bit_string/pgx/v5/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go new file mode 100644 index 0000000000..0b1dad3b41 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TestTable struct { + VBitNull pgtype.Bits + VVarbitNull pgtype.Bits + VBit pgtype.Bits + VVarbit pgtype.Bits +} 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 new file mode 100644 index 0000000000..c69ebfb265 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_bit_null, v_varbit_null, v_bit, v_varbit +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBitNull, + &i.VVarbitNull, + &i.VBit, + &i.VVarbit, + ); 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/bit_string/pgx/v5/query.sql b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql b/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql new file mode 100644 index 0000000000..0790c781d8 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE test_table +( + v_bit_null bit(3), + v_varbit_null bit varying(3), + v_bit bit(3) not null, + v_varbit bit varying(3) not null +); + diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/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/build_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..60956b99c4 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go @@ -0,0 +1,33 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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/build_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4365cb07ec --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go @@ -0,0 +1,17 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go new file mode 100644 index 0000000000..0fe1b09fe9 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go @@ -0,0 +1,20 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" +) + +type Querier interface { + CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) + DeleteAuthor(ctx context.Context, id int64) error + GetAuthor(ctx context.Context, id int64) (Author, error) + ListAuthors(ctx context.Context) ([]Author, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..9dc153a3aa --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,84 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/internal/endtoend/testdata/build_tags/postgresql/stdlib/query.sql b/internal/endtoend/testdata/build_tags/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/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/build_tags/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/build_tags/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/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/build_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/build_tags/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..3255dad106 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "authors", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "omit_unused_structs": true, + "emit_interface": true, + "build_tags": "some_tag" + } + ] +} diff --git a/internal/endtoend/testdata/builtins/go/db.go b/internal/endtoend/testdata/builtins/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/builtins/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/builtins/go/models.go b/internal/endtoend/testdata/builtins/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/builtins/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/builtins/postgresql/go/models.go b/internal/endtoend/testdata/builtins/postgresql/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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..1c72cea1c8 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..2c62e5f772 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/query.sql @@ -0,0 +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[]); diff --git a/internal/endtoend/testdata/builtins/postgresql/schema.sql b/internal/endtoend/testdata/builtins/postgresql/schema.sql new file mode 100644 index 0000000000..1974548e2b --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/schema.sql @@ -0,0 +1,2 @@ +create schema if not exists sqlc; + diff --git a/internal/endtoend/testdata/builtins/postgresql/sqlc.json b/internal/endtoend/testdata/builtins/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/builtins/query.sql b/internal/endtoend/testdata/builtins/query.sql deleted file mode 100644 index ee4723f8ed..0000000000 --- a/internal/endtoend/testdata/builtins/query.sql +++ /dev/null @@ -1,25 +0,0 @@ -SELECT abs(-17.4); -SELECT cbrt(27.0); -SELECT ceil(-42.8); -SELECT ceiling(-95.3); -SELECT degrees(0.5); -SELECT div(9,4); -SELECT exp(1.0); -SELECT floor(-42.8); -SELECT ln(2.0); -SELECT log(100.0); -SELECT log(2.0, 64.0); -SELECT mod(9,4); -SELECT pi(); -SELECT power(9.0, 3.0); -SELECT radians(45.0); -SELECT round(42.4); -SELECT round(42.4382, 2); -SELECT scale(8.41); -SELECT sign(-8.4); -SELECT sqrt(2.0); -SELECT trunc(42.8); -SELECT trunc(42.4382, 2); -SELECT width_bucket(5.35, 0.024, 10.06, 5); -SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]); -create schema if not exists sqlc; diff --git a/internal/endtoend/testdata/builtins/sqlc.json b/internal/endtoend/testdata/builtins/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/builtins/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go new file mode 100644 index 0000000000..370401e4d7 --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go @@ -0,0 +1,165 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: aggfunc.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAvg = `-- name: GetAvg :one +SELECT avg(int_val) FROM test +` + +func (q *Queries) GetAvg(ctx context.Context) (sql.NullFloat64, error) { + row := q.db.QueryRowContext(ctx, getAvg) + var avg sql.NullFloat64 + err := row.Scan(&avg) + return avg, err +} + +const getCount = `-- name: GetCount :one +SELECT count(*) FROM test +` + +func (q *Queries) GetCount(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getCount) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getCountId = `-- name: GetCountId :one +SELECT count(id) FROM test +` + +func (q *Queries) GetCountId(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getCountId) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getGroupConcatInt = `-- name: GetGroupConcatInt :one +SELECT group_concat(int_val) FROM test +` + +func (q *Queries) GetGroupConcatInt(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getGroupConcatInt) + var group_concat string + err := row.Scan(&group_concat) + return group_concat, err +} + +const getGroupConcatInt2 = `-- name: GetGroupConcatInt2 :one +SELECT group_concat(1, ':') FROM test +` + +func (q *Queries) GetGroupConcatInt2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getGroupConcatInt2) + var group_concat string + err := row.Scan(&group_concat) + return group_concat, err +} + +const getGroupConcatText = `-- name: GetGroupConcatText :one +SELECT group_concat(text_val) FROM test +` + +func (q *Queries) GetGroupConcatText(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getGroupConcatText) + var group_concat string + err := row.Scan(&group_concat) + return group_concat, err +} + +const getGroupConcatText2 = `-- name: GetGroupConcatText2 :one +SELECT group_concat(text_val, ':') FROM test +` + +func (q *Queries) GetGroupConcatText2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getGroupConcatText2) + var group_concat string + err := row.Scan(&group_concat) + return group_concat, err +} + +const getMaxInt = `-- name: GetMaxInt :one +SELECT max(int_val) FROM test +` + +func (q *Queries) GetMaxInt(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMaxInt) + var max interface{} + err := row.Scan(&max) + return max, err +} + +const getMaxText = `-- name: GetMaxText :one +SELECT max(text_val) FROM test +` + +func (q *Queries) GetMaxText(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMaxText) + var max interface{} + err := row.Scan(&max) + return max, err +} + +const getMinInt = `-- name: GetMinInt :one +SELECT min(int_val) FROM test +` + +func (q *Queries) GetMinInt(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMinInt) + var min interface{} + err := row.Scan(&min) + return min, err +} + +const getMinText = `-- name: GetMinText :one +SELECT min(text_val) FROM test +` + +func (q *Queries) GetMinText(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMinText) + var min interface{} + err := row.Scan(&min) + return min, err +} + +const getSumInt = `-- name: GetSumInt :one +SELECT sum(int_val) FROM test +` + +func (q *Queries) GetSumInt(ctx context.Context) (sql.NullFloat64, error) { + row := q.db.QueryRowContext(ctx, getSumInt) + var sum sql.NullFloat64 + err := row.Scan(&sum) + return sum, err +} + +const getSumText = `-- name: GetSumText :one +SELECT sum(text_val) FROM test +` + +func (q *Queries) GetSumText(ctx context.Context) (sql.NullFloat64, error) { + row := q.db.QueryRowContext(ctx, getSumText) + var sum sql.NullFloat64 + err := row.Scan(&sum) + return sum, err +} + +const getTotalInt = `-- name: GetTotalInt :one +SELECT total(int_val) FROM test +` + +func (q *Queries) GetTotalInt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getTotalInt) + var total float64 + err := row.Scan(&total) + return total, err +} diff --git a/internal/endtoend/testdata/builtins/sqlite/go/db.go b/internal/endtoend/testdata/builtins/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/builtins/sqlite/go/mathfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go new file mode 100644 index 0000000000..bc1532576b --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go @@ -0,0 +1,329 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: mathfunc.sql + +package querytest + +import ( + "context" +) + +const getAcos = `-- name: GetAcos :one +select acos(1.0) +` + +func (q *Queries) GetAcos(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAcos) + var acos float64 + err := row.Scan(&acos) + return acos, err +} + +const getAcosh = `-- name: GetAcosh :one +select acosh(1.0) +` + +func (q *Queries) GetAcosh(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAcosh) + var acosh float64 + err := row.Scan(&acosh) + return acosh, err +} + +const getAsin = `-- name: GetAsin :one +select asin(1.0) +` + +func (q *Queries) GetAsin(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAsin) + var asin float64 + err := row.Scan(&asin) + return asin, err +} + +const getAsinh = `-- name: GetAsinh :one +select asinh(1.0) +` + +func (q *Queries) GetAsinh(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAsinh) + var asinh float64 + err := row.Scan(&asinh) + return asinh, err +} + +const getAtan = `-- name: GetAtan :one +select atan(1.0) +` + +func (q *Queries) GetAtan(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAtan) + var atan float64 + err := row.Scan(&atan) + return atan, err +} + +const getAtan2 = `-- name: GetAtan2 :one +select atan2(1.0, 0.5) +` + +func (q *Queries) GetAtan2(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAtan2) + var atan2 float64 + err := row.Scan(&atan2) + return atan2, err +} + +const getAtanh = `-- name: GetAtanh :one +select atanh(1.0) +` + +func (q *Queries) GetAtanh(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAtanh) + var atanh float64 + err := row.Scan(&atanh) + return atanh, err +} + +const getCeil = `-- name: GetCeil :one +select ceil(1.0) +` + +func (q *Queries) GetCeil(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getCeil) + var ceil int64 + err := row.Scan(&ceil) + return ceil, err +} + +const getCeilin = `-- name: GetCeilin :one +select ceiling(1.0) +` + +func (q *Queries) GetCeilin(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getCeilin) + var ceiling int64 + err := row.Scan(&ceiling) + return ceiling, err +} + +const getCos = `-- name: GetCos :one +select cos(1.0) +` + +func (q *Queries) GetCos(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getCos) + var cos float64 + err := row.Scan(&cos) + return cos, err +} + +const getCosh = `-- name: GetCosh :one +select cosh(1.0) +` + +func (q *Queries) GetCosh(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getCosh) + var cosh float64 + err := row.Scan(&cosh) + return cosh, err +} + +const getDegrees = `-- name: GetDegrees :one +select degrees(1.0) +` + +func (q *Queries) GetDegrees(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getDegrees) + var degrees float64 + err := row.Scan(°rees) + return degrees, err +} + +const getExp = `-- name: GetExp :one +select exp(1.0) +` + +func (q *Queries) GetExp(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getExp) + var exp float64 + err := row.Scan(&exp) + return exp, err +} + +const getFloor = `-- name: GetFloor :one +select floor(1.0) +` + +func (q *Queries) GetFloor(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getFloor) + var floor int64 + err := row.Scan(&floor) + return floor, err +} + +const getLn = `-- name: GetLn :one +select ln(1.0) +` + +func (q *Queries) GetLn(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getLn) + var ln float64 + err := row.Scan(&ln) + return ln, err +} + +const getLog = `-- name: GetLog :one +select log(1.0) +` + +func (q *Queries) GetLog(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getLog) + var log float64 + err := row.Scan(&log) + return log, err +} + +const getLog10 = `-- name: GetLog10 :one +select log10(1.0) +` + +func (q *Queries) GetLog10(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getLog10) + var log10 float64 + err := row.Scan(&log10) + return log10, err +} + +const getLog2 = `-- name: GetLog2 :one +select log2(1.0) +` + +func (q *Queries) GetLog2(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getLog2) + var log2 float64 + err := row.Scan(&log2) + return log2, err +} + +const getLogBase = `-- name: GetLogBase :one +select log(1.0, 2.0) +` + +func (q *Queries) GetLogBase(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getLogBase) + var log float64 + err := row.Scan(&log) + return log, err +} + +const getMod = `-- name: GetMod :one +select mod(1, 2) +` + +func (q *Queries) GetMod(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getMod) + var mod float64 + err := row.Scan(&mod) + return mod, err +} + +const getPi = `-- name: GetPi :one +select pi() +` + +func (q *Queries) GetPi(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getPi) + var pi float64 + err := row.Scan(&pi) + return pi, err +} + +const getPow = `-- name: GetPow :one +select pow(1, 2) +` + +func (q *Queries) GetPow(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getPow) + var pow float64 + err := row.Scan(&pow) + return pow, err +} + +const getPower = `-- name: GetPower :one +select power(1, 2) +` + +func (q *Queries) GetPower(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getPower) + var power float64 + err := row.Scan(&power) + return power, err +} + +const getRadians = `-- name: GetRadians :one +select radians(1) +` + +func (q *Queries) GetRadians(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getRadians) + var radians float64 + err := row.Scan(&radians) + return radians, err +} + +const getSin = `-- name: GetSin :one +select sin(1.0) +` + +func (q *Queries) GetSin(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getSin) + var sin float64 + err := row.Scan(&sin) + return sin, err +} + +const getSinh = `-- name: GetSinh :one +select sinh(1.0) +` + +func (q *Queries) GetSinh(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getSinh) + var sinh float64 + err := row.Scan(&sinh) + return sinh, err +} + +const getSqrt = `-- name: GetSqrt :one +select sqrt(1.0) +` + +func (q *Queries) GetSqrt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getSqrt) + var sqrt float64 + err := row.Scan(&sqrt) + return sqrt, err +} + +const getTan = `-- name: GetTan :one +select tan(1.0) +` + +func (q *Queries) GetTan(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getTan) + var tan float64 + err := row.Scan(&tan) + return tan, err +} + +const getTrunc = `-- name: GetTrunc :one +select trunc(1.0) +` + +func (q *Queries) GetTrunc(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getTrunc) + var trunc int64 + 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 new file mode 100644 index 0000000000..ba96e73b83 --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Test struct { + ID int64 + IntVal int64 + TextVal string +} diff --git a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go new file mode 100644 index 0000000000..0e7d271c32 --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go @@ -0,0 +1,561 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: scalarfunc.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAbs = `-- name: GetAbs :one +SELECT abs(int_val) FROM test +` + +func (q *Queries) GetAbs(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getAbs) + var abs float64 + err := row.Scan(&abs) + return abs, err +} + +const getChanges = `-- name: GetChanges :one +SELECT changes() +` + +func (q *Queries) GetChanges(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getChanges) + var changes int64 + err := row.Scan(&changes) + return changes, err +} + +const getChar1 = `-- name: GetChar1 :one +SELECT char(65) +` + +func (q *Queries) GetChar1(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getChar1) + var char string + err := row.Scan(&char) + return char, err +} + +const getChar3 = `-- name: GetChar3 :one +SELECT char(65, 66, 67) +` + +func (q *Queries) GetChar3(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getChar3) + var char string + err := row.Scan(&char) + return char, err +} + +const getCoalesce = `-- name: GetCoalesce :one +SELECT coalesce(NULL, 1, 'test') +` + +func (q *Queries) GetCoalesce(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getCoalesce) + var coalesce interface{} + err := row.Scan(&coalesce) + return coalesce, err +} + +const getFormat = `-- name: GetFormat :one +SELECT format('Hello %s', 'world') +` + +func (q *Queries) GetFormat(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, getFormat) + var format sql.NullString + err := row.Scan(&format) + return format, err +} + +const getGlob = `-- name: GetGlob :one +SELECT glob('a*c', 'abc') +` + +func (q *Queries) GetGlob(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getGlob) + var glob int64 + err := row.Scan(&glob) + return glob, err +} + +const getHex = `-- name: GetHex :one +SELECT hex(123456) +` + +func (q *Queries) GetHex(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getHex) + var hex string + err := row.Scan(&hex) + return hex, err +} + +const getIfnull = `-- name: GetIfnull :one +SELECT ifnull(1, 2) +` + +func (q *Queries) GetIfnull(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getIfnull) + var ifnull interface{} + err := row.Scan(&ifnull) + return ifnull, err +} + +const getIif = `-- name: GetIif :one +SELECT iif(1, 2, 3) +` + +func (q *Queries) GetIif(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getIif) + var iif interface{} + err := row.Scan(&iif) + return iif, err +} + +const getInstr = `-- name: GetInstr :one +SELECT instr('hello', 'l') +` + +func (q *Queries) GetInstr(ctx context.Context) (sql.NullInt64, error) { + row := q.db.QueryRowContext(ctx, getInstr) + var instr sql.NullInt64 + err := row.Scan(&instr) + return instr, err +} + +const getLastInsertRowID = `-- name: GetLastInsertRowID :one +SELECT last_insert_rowid() +` + +func (q *Queries) GetLastInsertRowID(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getLastInsertRowID) + var last_insert_rowid int64 + err := row.Scan(&last_insert_rowid) + return last_insert_rowid, err +} + +const getLength = `-- name: GetLength :one +SELECT length('12345') +` + +func (q *Queries) GetLength(ctx context.Context) (sql.NullInt64, error) { + row := q.db.QueryRowContext(ctx, getLength) + var length sql.NullInt64 + err := row.Scan(&length) + return length, err +} + +const getLike2 = `-- name: GetLike2 :one +SELECT like('%bc%', 'abcd') +` + +func (q *Queries) GetLike2(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getLike2) + var like int64 + err := row.Scan(&like) + return like, err +} + +const getLike3 = `-- name: GetLike3 :one +SELECT like('$%1%', '%100', '$') +` + +func (q *Queries) GetLike3(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getLike3) + var like int64 + err := row.Scan(&like) + return like, err +} + +const getLikelihood = `-- name: GetLikelihood :one +SELECT likelihood('12345', 0.5) +` + +func (q *Queries) GetLikelihood(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getLikelihood) + var likelihood interface{} + err := row.Scan(&likelihood) + return likelihood, err +} + +const getLikely = `-- name: GetLikely :one +SELECT likely('12345') +` + +func (q *Queries) GetLikely(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getLikely) + var likely interface{} + err := row.Scan(&likely) + return likely, err +} + +const getLower = `-- name: GetLower :one +SELECT lower('ABCDE') +` + +func (q *Queries) GetLower(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getLower) + var lower string + err := row.Scan(&lower) + return lower, err +} + +const getLtrim = `-- name: GetLtrim :one +SELECT ltrim(' ABCDE') +` + +func (q *Queries) GetLtrim(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getLtrim) + var ltrim string + err := row.Scan(<rim) + return ltrim, err +} + +const getLtrim2 = `-- name: GetLtrim2 :one +SELECT ltrim(':ABCDE', ':') +` + +func (q *Queries) GetLtrim2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getLtrim2) + var ltrim string + err := row.Scan(<rim) + return ltrim, err +} + +const getMax3 = `-- name: GetMax3 :one +SELECT max(1, 3, 2) +` + +func (q *Queries) GetMax3(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMax3) + var max interface{} + err := row.Scan(&max) + return max, err +} + +const getMin3 = `-- name: GetMin3 :one +SELECT min(1, 3, 2) +` + +func (q *Queries) GetMin3(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getMin3) + var min interface{} + err := row.Scan(&min) + return min, err +} + +const getNullif = `-- name: GetNullif :one +SELECT nullif(1, 2) +` + +func (q *Queries) GetNullif(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getNullif) + var nullif interface{} + err := row.Scan(&nullif) + return nullif, err +} + +const getPrintf = `-- name: GetPrintf :one +SELECT printf('Hello %s', 'world') +` + +func (q *Queries) GetPrintf(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, getPrintf) + var printf sql.NullString + err := row.Scan(&printf) + return printf, err +} + +const getQuote = `-- name: GetQuote :one +SELECT quote(1) +` + +func (q *Queries) GetQuote(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getQuote) + var quote string + err := row.Scan("e) + return quote, err +} + +const getRandom = `-- name: GetRandom :one +SELECT random() +` + +func (q *Queries) GetRandom(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getRandom) + var random interface{} + err := row.Scan(&random) + return random, err +} + +const getRandomBlob = `-- name: GetRandomBlob :one +SELECT randomblob(16) +` + +func (q *Queries) GetRandomBlob(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getRandomBlob) + var randomblob interface{} + err := row.Scan(&randomblob) + return randomblob, err +} + +const getReplace = `-- name: GetReplace :one +SELECT replace('abc', 'bc', 'df') +` + +func (q *Queries) GetReplace(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getReplace) + var replace string + err := row.Scan(&replace) + return replace, err +} + +const getRound = `-- name: GetRound :one +SELECT round(1.1) +` + +func (q *Queries) GetRound(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getRound) + var round float64 + err := row.Scan(&round) + return round, err +} + +const getRound2 = `-- name: GetRound2 :one +SELECT round(1.1, 2) +` + +func (q *Queries) GetRound2(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, getRound2) + var round float64 + err := row.Scan(&round) + return round, err +} + +const getRtrim = `-- name: GetRtrim :one +SELECT rtrim('ABCDE ') +` + +func (q *Queries) GetRtrim(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getRtrim) + var rtrim string + err := row.Scan(&rtrim) + return rtrim, err +} + +const getRtrim2 = `-- name: GetRtrim2 :one +SELECT rtrim('ABCDE:', ':') +` + +func (q *Queries) GetRtrim2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getRtrim2) + var rtrim string + err := row.Scan(&rtrim) + return rtrim, err +} + +const getSQLiteCompileOptionGet = `-- name: GetSQLiteCompileOptionGet :one +SELECT sqlite_compileoption_get(1) +` + +func (q *Queries) GetSQLiteCompileOptionGet(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionGet) + var sqlite_compileoption_get sql.NullString + err := row.Scan(&sqlite_compileoption_get) + return sqlite_compileoption_get, err +} + +const getSQLiteCompileOptionUsed = `-- name: GetSQLiteCompileOptionUsed :one +SELECT sqlite_compileoption_used(1) +` + +func (q *Queries) GetSQLiteCompileOptionUsed(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionUsed) + var sqlite_compileoption_used int64 + err := row.Scan(&sqlite_compileoption_used) + return sqlite_compileoption_used, err +} + +const getSQLiteSourceID = `-- name: GetSQLiteSourceID :one +SELECT sqlite_source_id() +` + +func (q *Queries) GetSQLiteSourceID(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSQLiteSourceID) + var sqlite_source_id string + err := row.Scan(&sqlite_source_id) + return sqlite_source_id, err +} + +const getSQLiteVersion = `-- name: GetSQLiteVersion :one +SELECT sqlite_version() +` + +func (q *Queries) GetSQLiteVersion(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSQLiteVersion) + var sqlite_version string + err := row.Scan(&sqlite_version) + return sqlite_version, err +} + +const getSign = `-- name: GetSign :one +SELECT sign(1) +` + +func (q *Queries) GetSign(ctx context.Context) (sql.NullInt64, error) { + row := q.db.QueryRowContext(ctx, getSign) + var sign sql.NullInt64 + err := row.Scan(&sign) + return sign, err +} + +const getSoundex = `-- name: GetSoundex :one +SELECT soundex('abc') +` + +func (q *Queries) GetSoundex(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSoundex) + var soundex string + err := row.Scan(&soundex) + return soundex, err +} + +const getSubstr2 = `-- name: GetSubstr2 :one +SELECT substr('abcdef', 2) +` + +func (q *Queries) GetSubstr2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSubstr2) + var substr string + err := row.Scan(&substr) + return substr, err +} + +const getSubstr3 = `-- name: GetSubstr3 :one +SELECT substr('abcdef', 1, 2) +` + +func (q *Queries) GetSubstr3(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSubstr3) + var substr string + err := row.Scan(&substr) + return substr, err +} + +const getSubstring2 = `-- name: GetSubstring2 :one +SELECT substring('abcdef', 1) +` + +func (q *Queries) GetSubstring2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSubstring2) + var substring string + err := row.Scan(&substring) + return substring, err +} + +const getSusbstring3 = `-- name: GetSusbstring3 :one +SELECT substring('abcdef', 1, 2) +` + +func (q *Queries) GetSusbstring3(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getSusbstring3) + var substring string + err := row.Scan(&substring) + return substring, err +} + +const getTotalChanges = `-- name: GetTotalChanges :one +SELECT total_changes() +` + +func (q *Queries) GetTotalChanges(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getTotalChanges) + var total_changes int64 + err := row.Scan(&total_changes) + return total_changes, err +} + +const getTrim = `-- name: GetTrim :one +SELECT trim(' ABCDE ') +` + +func (q *Queries) GetTrim(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getTrim) + var trim string + err := row.Scan(&trim) + return trim, err +} + +const getTrim2 = `-- name: GetTrim2 :one +SELECT trim(':ABCDE:', ':') +` + +func (q *Queries) GetTrim2(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getTrim2) + var trim string + err := row.Scan(&trim) + return trim, err +} + +const getTypeof = `-- name: GetTypeof :one +SELECT typeof('ABCDE') +` + +func (q *Queries) GetTypeof(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getTypeof) + var typeof string + err := row.Scan(&typeof) + return typeof, err +} + +const getUnicode = `-- name: GetUnicode :one +SELECT unicode('A') +` + +func (q *Queries) GetUnicode(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, getUnicode) + var unicode int64 + err := row.Scan(&unicode) + return unicode, err +} + +const getUnlikely = `-- name: GetUnlikely :one +SELECT unlikely('12345') +` + +func (q *Queries) GetUnlikely(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, getUnlikely) + var unlikely interface{} + err := row.Scan(&unlikely) + return unlikely, err +} + +const getUpper = `-- name: GetUpper :one +SELECT upper('abcde') +` + +func (q *Queries) GetUpper(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, getUpper) + var upper string + err := row.Scan(&upper) + return upper, err +} + +const getZeroblob = `-- name: GetZeroblob :one +SELECT zeroblob(16) +` + +func (q *Queries) GetZeroblob(ctx context.Context) ([]byte, error) { + row := q.db.QueryRowContext(ctx, getZeroblob) + var zeroblob []byte + err := row.Scan(&zeroblob) + return zeroblob, err +} diff --git a/internal/endtoend/testdata/builtins/sqlite/queries/aggfunc.sql b/internal/endtoend/testdata/builtins/sqlite/queries/aggfunc.sql new file mode 100644 index 0000000000..5af32cdbcc --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/queries/aggfunc.sql @@ -0,0 +1,41 @@ +-- name: GetAvg :one +SELECT avg(int_val) FROM test; + +-- name: GetCount :one +SELECT count(*) FROM test; + +-- name: GetCountId :one +SELECT count(id) FROM test; + +-- name: GetGroupConcatInt :one +SELECT group_concat(int_val) FROM test; + +-- name: GetGroupConcatInt2 :one +SELECT group_concat(1, ':') FROM test; + +-- name: GetGroupConcatText :one +SELECT group_concat(text_val) FROM test; + +-- name: GetGroupConcatText2 :one +SELECT group_concat(text_val, ':') FROM test; + +-- name: GetMaxInt :one +SELECT max(int_val) FROM test; + +-- name: GetMaxText :one +SELECT max(text_val) FROM test; + +-- name: GetMinInt :one +SELECT min(int_val) FROM test; + +-- name: GetMinText :one +SELECT min(text_val) FROM test; + +-- name: GetSumInt :one +SELECT sum(int_val) FROM test; + +-- name: GetSumText :one +SELECT sum(text_val) FROM test; + +-- name: GetTotalInt :one +SELECT total(int_val) FROM test; diff --git a/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql b/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql new file mode 100644 index 0000000000..d62c2b6521 --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql @@ -0,0 +1,86 @@ +-- name: GetAcos :one +select acos(1.0); + +-- name: GetAcosh :one +select acosh(1.0); + +-- name: GetAsin :one +select asin(1.0); + +-- name: GetAsinh :one +select asinh(1.0); + +-- name: GetAtan :one +select atan(1.0); + +-- name: GetAtan2 :one +select atan2(1.0, 0.5); + +-- name: GetAtanh :one +select atanh(1.0); + +-- name: GetCeil :one +select ceil(1.0); + +-- name: GetCeilin :one +select ceiling(1.0); + +-- name: GetCos :one +select cos(1.0); + +-- name: GetCosh :one +select cosh(1.0); + +-- name: GetDegrees :one +select degrees(1.0); + +-- name: GetExp :one +select exp(1.0); + +-- name: GetFloor :one +select floor(1.0); + +-- name: GetLn :one +select ln(1.0); + +-- name: GetLog :one +select log(1.0); + +-- name: GetLog10 :one +select log10(1.0); + +-- name: GetLogBase :one +select log(1.0, 2.0); + +-- name: GetLog2 :one +select log2(1.0); + +-- name: GetMod :one +select mod(1, 2); + +-- name: GetPi :one +select pi(); + +-- name: GetPow :one +select pow(1, 2); + +-- name: GetPower :one +select power(1, 2); + +-- name: GetRadians :one +select radians(1); + +-- name: GetSin :one +select sin(1.0); + +-- name: GetSinh :one +select sinh(1.0); + +-- name: GetSqrt :one +select sqrt(1.0); + +-- name: GetTan :one +select tan(1.0); + +-- name: GetTrunc :one +select trunc(1.0); diff --git a/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql b/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql new file mode 100644 index 0000000000..571cdb958a --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql @@ -0,0 +1,149 @@ +-- name: GetAbs :one +SELECT abs(int_val) FROM test; + +-- name: GetChanges :one +SELECT changes(); + +-- name: GetChar1 :one +SELECT char(65); + +-- name: GetChar3 :one +SELECT char(65, 66, 67); + +-- name: GetCoalesce :one +SELECT coalesce(NULL, 1, 'test'); + +-- name: GetFormat :one +SELECT format('Hello %s', 'world'); + +-- name: GetGlob :one +SELECT glob('a*c', 'abc'); + +-- name: GetHex :one +SELECT hex(123456); + +-- name: GetIfnull :one +SELECT ifnull(1, 2); + +-- name: GetIif :one +SELECT iif(1, 2, 3); + +-- name: GetLastInsertRowID :one +SELECT last_insert_rowid(); + +-- name: GetInstr :one +SELECT instr('hello', 'l'); + +-- name: GetLength :one +SELECT length('12345'); + +-- name: GetLike2 :one +SELECT like('%bc%', 'abcd'); + +-- name: GetLike3 :one +SELECT like('$%1%', '%100', '$'); + +-- name: GetLikelihood :one +SELECT likelihood('12345', 0.5); + +-- name: GetLikely :one +SELECT likely('12345'); + +-- name: GetLower :one +SELECT lower('ABCDE'); + +-- name: GetLtrim :one +SELECT ltrim(' ABCDE'); + +-- name: GetLtrim2 :one +SELECT ltrim(':ABCDE', ':'); + +-- name: GetMax3 :one +SELECT max(1, 3, 2); + +-- name: GetMin3 :one +SELECT min(1, 3, 2); + +-- name: GetNullif :one +SELECT nullif(1, 2); + +-- name: GetPrintf :one +SELECT printf('Hello %s', 'world'); + +-- name: GetQuote :one +SELECT quote(1); + +-- name: GetRandom :one +SELECT random(); + +-- name: GetRandomBlob :one +SELECT randomblob(16); + +-- name: GetRound :one +SELECT round(1.1); + +-- name: GetRound2 :one +SELECT round(1.1, 2); + +-- name: GetReplace :one +SELECT replace('abc', 'bc', 'df'); + +-- name: GetRtrim :one +SELECT rtrim('ABCDE '); + +-- name: GetRtrim2 :one +SELECT rtrim('ABCDE:', ':'); + +-- name: GetSign :one +SELECT sign(1); + +-- name: GetSoundex :one +SELECT soundex('abc'); + +-- name: GetSQLiteCompileOptionGet :one +SELECT sqlite_compileoption_get(1); + +-- name: GetSQLiteCompileOptionUsed :one +SELECT sqlite_compileoption_used(1); + +-- name: GetSQLiteSourceID :one +SELECT sqlite_source_id(); + +-- name: GetSQLiteVersion :one +SELECT sqlite_version(); + +-- name: GetSubstr3 :one +SELECT substr('abcdef', 1, 2); + +-- name: GetSubstr2 :one +SELECT substr('abcdef', 2); + +-- name: GetSusbstring3 :one +SELECT substring('abcdef', 1, 2); + +-- name: GetSubstring2 :one +SELECT substring('abcdef', 1); + +-- name: GetTotalChanges :one +SELECT total_changes(); + +-- name: GetTrim :one +SELECT trim(' ABCDE '); + +-- name: GetTrim2 :one +SELECT trim(':ABCDE:', ':'); + +-- name: GetTypeof :one +SELECT typeof('ABCDE'); + +-- name: GetUnicode :one +SELECT unicode('A'); + +-- name: GetUnlikely :one +SELECT unlikely('12345'); + +-- name: GetUpper :one +SELECT upper('abcde'); + +-- name: GetZeroblob :one +SELECT zeroblob(16); diff --git a/internal/endtoend/testdata/builtins/sqlite/schema.sql b/internal/endtoend/testdata/builtins/sqlite/schema.sql new file mode 100644 index 0000000000..1c3d00e17b --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE test ( + id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + int_val integer NOT NULL, + text_val text NOT NULL +); + \ No newline at end of file diff --git a/internal/endtoend/testdata/builtins/sqlite/sqlc.json b/internal/endtoend/testdata/builtins/sqlite/sqlc.json new file mode 100644 index 0000000000..ca4644740d --- /dev/null +++ b/internal/endtoend/testdata/builtins/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "queries/", + "engine": "sqlite" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/db.go b/internal/endtoend/testdata/case_named_params/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mysql/go/models.go b/internal/endtoend/testdata/case_named_params/mysql/go/models.go new file mode 100644 index 0000000000..34088348d6 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +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/mysql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go new file mode 100644 index 0000000000..54d0542f78 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAuthors = `-- name: ListAuthors :one +SELECT id, username, email, name, bio +FROM authors +WHERE email = CASE WHEN ? = '' then NULL else ? END + OR username = CASE WHEN ? = '' then NULL else ? END +LIMIT 1 +` + +type ListAuthorsParams struct { + Email sql.NullString + Username sql.NullString +} + +func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { + row := q.db.QueryRowContext(ctx, listAuthors, + arg.Email, + arg.Email, + arg.Username, + 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/mysql/query.sql b/internal/endtoend/testdata/case_named_params/mysql/query.sql new file mode 100644 index 0000000000..523c946815 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/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/mysql/schema.sql b/internal/endtoend/testdata/case_named_params/mysql/schema.sql new file mode 100644 index 0000000000..5e2bcfacf0 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1195 + +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + username VARCHAR(10) NULL, + email VARCHAR(10) NULL, + name TEXT NOT NULL, + bio TEXT, + UNIQUE KEY idx_username (username), + UNIQUE KEY ids_email (email) +); + diff --git a/internal/endtoend/testdata/case_named_params/mysql/sqlc.json b/internal/endtoend/testdata/case_named_params/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/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/case_named_params/postgresql/go/db.go b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/go/models.go b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go new file mode 100644 index 0000000000..34088348d6 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +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/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go new file mode 100644 index 0000000000..fda09df343 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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::text = '' then NULL else $1::text END + OR username = CASE WHEN $2::text = '' then NULL else $2::text END +LIMIT 1 +` + +type ListAuthorsParams struct { + Email string + Username string +} + +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/postgresql/query.sql b/internal/endtoend/testdata/case_named_params/postgresql/query.sql new file mode 100644 index 0000000000..d677a6f7d8 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/query.sql @@ -0,0 +1,6 @@ +-- name: ListAuthors :one +SELECT * +FROM authors +WHERE email = CASE WHEN sqlc.arg(email)::text = '' then NULL else sqlc.arg(email)::text END + OR username = CASE WHEN sqlc.arg(username)::text = '' then NULL else sqlc.arg(username)::text END +LIMIT 1; diff --git a/internal/endtoend/testdata/case_named_params/postgresql/schema.sql b/internal/endtoend/testdata/case_named_params/postgresql/schema.sql new file mode 100644 index 0000000000..c9b66c8760 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/schema.sql @@ -0,0 +1,10 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1195 + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + username TEXT NULL, + email TEXT NULL, + name TEXT NOT NULL, + bio TEXT +); + diff --git a/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json b/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/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/case_named_params/sqlite/go/db.go b/internal/endtoend/testdata/case_named_params/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..72d21e0408 --- /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.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Username interface{} + Email interface{} + 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..296eef7593 --- /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.30.0 +// 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 interface{} + Username interface{} +} + +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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_sensitive/sqlite/go/models.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go new file mode 100644 index 0000000000..fe54e54809 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Contact struct { + Pid sql.NullString + Customername sql.NullString +} diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go new file mode 100644 index 0000000000..b6c08e7713 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertContact = `-- name: InsertContact :exec +INSERT INTO contacts ( + pid, + CustomerName +) +VALUES (?,?) +` + +type InsertContactParams struct { + Pid sql.NullString + Customername sql.NullString +} + +func (q *Queries) InsertContact(ctx context.Context, arg InsertContactParams) error { + _, err := q.db.ExecContext(ctx, insertContact, arg.Pid, arg.Customername) + return err +} diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/query.sql b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql new file mode 100644 index 0000000000..0c05277ef4 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql @@ -0,0 +1,7 @@ +-- name: InsertContact :exec +INSERT INTO contacts ( + pid, + CustomerName +) +VALUES (?,?) +; diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql b/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql new file mode 100644 index 0000000000..af6e1131c6 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE contacts ( + pid TEXT, + CustomerName TEXT +); + diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json b/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json new file mode 100644 index 0000000000..99b3b5f074 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json @@ -0,0 +1 @@ +{"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/case_stmt_bool/go/db.go b/internal/endtoend/testdata/case_stmt_bool/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/case_stmt_bool/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_stmt_bool/go/models.go b/internal/endtoend/testdata/case_stmt_bool/go/models.go deleted file mode 100644 index b443f16b28..0000000000 --- a/internal/endtoend/testdata/case_stmt_bool/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - ID string -} diff --git a/internal/endtoend/testdata/case_stmt_bool/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/go/query.sql.go deleted file mode 100644 index d9a36044fc..0000000000 --- a/internal/endtoend/testdata/case_stmt_bool/go/query.sql.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const caseStatementBoolean = `-- name: CaseStatementBoolean :many -SELECT CASE - WHEN id = $1 THEN true - ELSE false -END is_one -FROM foo -` - -func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, caseStatementBoolean, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var is_one bool - if err := rows.Scan(&is_one); err != nil { - return nil, err - } - items = append(items, is_one) - } - 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/case_stmt_bool/pgx/v4/go/db.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/case_stmt_bool/pgx/v4/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..48d37ec374 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementBoolean = `-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo +` + +func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { + rows, err := q.db.Query(ctx, caseStatementBoolean, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var is_one bool + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql new file mode 100644 index 0000000000..604393ba65 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/case_stmt_bool/pgx/v5/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..48d37ec374 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementBoolean = `-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo +` + +func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { + rows, err := q.db.Query(ctx, caseStatementBoolean, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var is_one bool + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql new file mode 100644 index 0000000000..604393ba65 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/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/case_stmt_bool/query.sql b/internal/endtoend/testdata/case_stmt_bool/query.sql deleted file mode 100644 index 822b1dd8f5..0000000000 --- a/internal/endtoend/testdata/case_stmt_bool/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE foo (id text not null); - --- name: CaseStatementBoolean :many -SELECT CASE - WHEN id = $1 THEN true - ELSE false -END is_one -FROM foo; diff --git a/internal/endtoend/testdata/case_stmt_bool/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/case_stmt_bool/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_stmt_bool/stdlib/go/models.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1bd6efb852 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementBoolean = `-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo +` + +func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, caseStatementBoolean, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var is_one bool + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + 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/case_stmt_bool/stdlib/query.sql b/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql new file mode 100644 index 0000000000..604393ba65 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementBoolean :many +SELECT CASE + WHEN id = $1 THEN true + ELSE false +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql b/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/db.go b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/case_text/pgx/v4/go/models.go b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fe8d84420e --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementText = `-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo +` + +func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { + rows, err := q.db.Query(ctx, caseStatementText, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var is_one string + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/case_text/pgx/v4/query.sql b/internal/endtoend/testdata/case_text/pgx/v4/query.sql new file mode 100644 index 0000000000..eff5ec28fb --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_text/pgx/v4/schema.sql b/internal/endtoend/testdata/case_text/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json b/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/db.go b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/case_text/pgx/v5/go/models.go b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fe8d84420e --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementText = `-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo +` + +func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { + rows, err := q.db.Query(ctx, caseStatementText, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var is_one string + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/case_text/pgx/v5/query.sql b/internal/endtoend/testdata/case_text/pgx/v5/query.sql new file mode 100644 index 0000000000..eff5ec28fb --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_text/pgx/v5/schema.sql b/internal/endtoend/testdata/case_text/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json b/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/case_text/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/case_text/stdlib/go/db.go b/internal/endtoend/testdata/case_text/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_text/stdlib/go/models.go b/internal/endtoend/testdata/case_text/stdlib/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5856ff2f69 --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const caseStatementText = `-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo +` + +func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, caseStatementText, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var is_one string + if err := rows.Scan(&is_one); err != nil { + return nil, err + } + items = append(items, is_one) + } + 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/case_text/stdlib/query.sql b/internal/endtoend/testdata/case_text/stdlib/query.sql new file mode 100644 index 0000000000..eff5ec28fb --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: CaseStatementText :many +SELECT CASE + WHEN id = $1 THEN 'foo' + ELSE 'bar' +END is_one +FROM foo; diff --git a/internal/endtoend/testdata/case_text/stdlib/schema.sql b/internal/endtoend/testdata/case_text/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/stdlib/sqlc.json b/internal/endtoend/testdata/case_text/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/case_value_param/issue.md b/internal/endtoend/testdata/case_value_param/issue.md new file mode 100644 index 0000000000..c8ac2fa390 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2847 diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/db.go b/internal/endtoend/testdata/case_value_param/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_value_param/mysql/go/models.go b/internal/endtoend/testdata/case_value_param/mysql/go/models.go new file mode 100644 index 0000000000..aa87e2f1af --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Testing struct { + ID int32 + Value sql.NullString +} 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 new file mode 100644 index 0000000000..97330eb75e --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const update = `-- name: Update :exec +UPDATE testing +SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END +` + +func (q *Queries) Update(ctx context.Context, value sql.NullString) error { + _, err := q.db.ExecContext(ctx, update, value) + return err +} diff --git a/internal/endtoend/testdata/case_value_param/mysql/query.sql b/internal/endtoend/testdata/case_value_param/mysql/query.sql new file mode 100644 index 0000000000..2c4e1f9889 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/query.sql @@ -0,0 +1,3 @@ +-- name: Update :exec +UPDATE testing +SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END; diff --git a/internal/endtoend/testdata/case_value_param/mysql/schema.sql b/internal/endtoend/testdata/case_value_param/mysql/schema.sql new file mode 100644 index 0000000000..556ca0b530 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE testing ( + id int PRIMARY KEY, + value text +); diff --git a/internal/endtoend/testdata/case_value_param/mysql/sqlc.yaml b/internal/endtoend/testdata/case_value_param/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/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/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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/case_value_param/postgresql/go/models.go b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go new file mode 100644 index 0000000000..9b6177de7b --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Testing struct { + ID int32 + Value pgtype.Text +} 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 new file mode 100644 index 0000000000..e0c352e43b --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const update = `-- name: Update :exec +UPDATE testing +SET value = CASE $1 WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END +` + +func (q *Queries) Update(ctx context.Context, value pgtype.Text) error { + _, err := q.db.Exec(ctx, update, value) + return err +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/query.sql b/internal/endtoend/testdata/case_value_param/postgresql/query.sql new file mode 100644 index 0000000000..106653b43f --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: Update :exec +UPDATE testing +SET value = CASE $1 WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END; diff --git a/internal/endtoend/testdata/case_value_param/postgresql/schema.sql b/internal/endtoend/testdata/case_value_param/postgresql/schema.sql new file mode 100644 index 0000000000..556ca0b530 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE testing ( + id int PRIMARY KEY, + value text +); diff --git a/internal/endtoend/testdata/case_value_param/postgresql/sqlc.yaml b/internal/endtoend/testdata/case_value_param/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/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/cast_coalesce/go/db.go b/internal/endtoend/testdata/cast_coalesce/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/cast_coalesce/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/cast_coalesce/go/models.go b/internal/endtoend/testdata/cast_coalesce/go/models.go deleted file mode 100644 index 8170fc4b5c..0000000000 --- a/internal/endtoend/testdata/cast_coalesce/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullString -} diff --git a/internal/endtoend/testdata/cast_coalesce/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/go/query.sql.go deleted file mode 100644 index 1c5d0730ce..0000000000 --- a/internal/endtoend/testdata/cast_coalesce/go/query.sql.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const castCoalesce = `-- name: CastCoalesce :many -SELECT coalesce(bar, '')::text as login -FROM foo -` - -func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, castCoalesce) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var login string - if err := rows.Scan(&login); err != nil { - return nil, err - } - items = append(items, login) - } - 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/cast_coalesce/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/cast_coalesce/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..9d1e88143a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const castCoalesce = `-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo +` + +func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, castCoalesce) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql new file mode 100644 index 0000000000..db193da18a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json b/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/cast_coalesce/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go new file mode 100644 index 0000000000..f2fbf9abf3 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text +} 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 new file mode 100644 index 0000000000..9d1e88143a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const castCoalesce = `-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo +` + +func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, castCoalesce) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql new file mode 100644 index 0000000000..db193da18a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json b/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/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/cast_coalesce/query.sql b/internal/endtoend/testdata/cast_coalesce/query.sql deleted file mode 100644 index b3ca73e3ec..0000000000 --- a/internal/endtoend/testdata/cast_coalesce/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE foo (bar text); - --- name: CastCoalesce :many -SELECT coalesce(bar, '')::text as login -FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/sqlc.json b/internal/endtoend/testdata/cast_coalesce/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/cast_coalesce/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cast_coalesce/stdlib/go/models.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go new file mode 100644 index 0000000000..a155d78efe --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const castCoalesce = `-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo +` + +func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, castCoalesce) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + 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/cast_coalesce/stdlib/query.sql b/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql new file mode 100644 index 0000000000..db193da18a --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: CastCoalesce :many +SELECT coalesce(bar, '')::text as login +FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql b/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json b/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/cast_null/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..112ea86167 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listNullable = `-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo +` + +type ListNullableRow struct { + A sql.NullString + B sql.NullInt32 + C sql.NullInt64 + D sql.NullTime +} + +func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { + rows, err := q.db.Query(ctx, listNullable) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListNullableRow + for rows.Next() { + var i ListNullableRow + if err := rows.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + ); 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/cast_null/pgx/v4/query.sql b/internal/endtoend/testdata/cast_null/pgx/v4/query.sql new file mode 100644 index 0000000000..ca3a9491bd --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/query.sql @@ -0,0 +1,7 @@ +-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo; diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql b/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json b/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/cast_null/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go new file mode 100644 index 0000000000..f2fbf9abf3 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text +} 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 new file mode 100644 index 0000000000..65118d0419 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const listNullable = `-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo +` + +type ListNullableRow struct { + A pgtype.Text + B pgtype.Int4 + C pgtype.Int8 + D pgtype.Time +} + +func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { + rows, err := q.db.Query(ctx, listNullable) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListNullableRow + for rows.Next() { + var i ListNullableRow + if err := rows.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + ); 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/cast_null/pgx/v5/query.sql b/internal/endtoend/testdata/cast_null/pgx/v5/query.sql new file mode 100644 index 0000000000..ca3a9491bd --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/query.sql @@ -0,0 +1,7 @@ +-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo; diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql b/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json b/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/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/cast_null/stdlib/go/db.go b/internal/endtoend/testdata/cast_null/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cast_null/stdlib/go/models.go b/internal/endtoend/testdata/cast_null/stdlib/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go new file mode 100644 index 0000000000..627477f66f --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listNullable = `-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo +` + +type ListNullableRow struct { + A sql.NullString + B sql.NullInt32 + C sql.NullInt64 + D sql.NullTime +} + +func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { + rows, err := q.db.QueryContext(ctx, listNullable) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListNullableRow + for rows.Next() { + var i ListNullableRow + if err := rows.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + ); 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/cast_null/stdlib/query.sql b/internal/endtoend/testdata/cast_null/stdlib/query.sql new file mode 100644 index 0000000000..ca3a9491bd --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/query.sql @@ -0,0 +1,7 @@ +-- name: ListNullable :many +SELECT + NULL::text as a, + NULL::integer as b, + NULL::bigint as c, + NULL::time as d +FROM foo; diff --git a/internal/endtoend/testdata/cast_null/stdlib/schema.sql b/internal/endtoend/testdata/cast_null/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/stdlib/sqlc.json b/internal/endtoend/testdata/cast_null/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/db.go b/internal/endtoend/testdata/cast_param/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cast_param/sqlite/go/models.go b/internal/endtoend/testdata/cast_param/sqlite/go/models.go new file mode 100644 index 0000000000..c20d34bc5f --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type MyTable struct { + Invalid sql.NullBool + Foo sql.NullString +} diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go new file mode 100644 index 0000000000..3fad3fbb46 --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getData = `-- name: GetData :many +select invalid, foo +from my_table +where (cast(?1 as boolean) or not invalid) +` + +func (q *Queries) GetData(ctx context.Context, allowInvalid bool) ([]MyTable, error) { + rows, err := q.db.QueryContext(ctx, getData, allowInvalid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []MyTable + for rows.Next() { + var i MyTable + if err := rows.Scan(&i.Invalid, &i.Foo); 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/cast_param/sqlite/query.sql b/internal/endtoend/testdata/cast_param/sqlite/query.sql new file mode 100644 index 0000000000..53f8c0391c --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: GetData :many +select * +from my_table +where (cast(sqlc.arg(allow_invalid) as boolean) or not invalid); \ No newline at end of file diff --git a/internal/endtoend/testdata/cast_param/sqlite/schema.sql b/internal/endtoend/testdata/cast_param/sqlite/schema.sql new file mode 100644 index 0000000000..831af7c2bd --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/schema.sql @@ -0,0 +1,6 @@ +create table my_table +( + invalid boolean, + foo varchar +); + diff --git a/internal/endtoend/testdata/cast_param/sqlite/sqlc.json b/internal/endtoend/testdata/cast_param/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/cast_param/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/cid_oid_tid_xid/pgx/v4/go/db.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/cid_oid_tid_xid/pgx/v4/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go new file mode 100644 index 0000000000..42b69e9729 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VCidNull pgtype.CID + VOidNull pgtype.OID + VTidNull pgtype.TID + VXidNull pgtype.XID + VCid pgtype.CID + VOid pgtype.OID + VTid pgtype.TID + VXid pgtype.XID +} 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 new file mode 100644 index 0000000000..3e37867bec --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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 +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VCidNull, + &i.VOidNull, + &i.VTidNull, + &i.VXidNull, + &i.VCid, + &i.VOid, + &i.VTid, + &i.VXid, + ); 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/cid_oid_tid_xid/pgx/v4/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql new file mode 100644 index 0000000000..ecd09ac882 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE test_table +( + v_cid_null cid, + v_oid_null oid, + v_tid_null tid, + v_xid_null xid, + v_cid cid not null, + v_oid oid not null, + v_tid tid not null, + v_xid xid not null +); + diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/cid_oid_tid_xid/pgx/v5/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go new file mode 100644 index 0000000000..a8133f8ace --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +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 +} 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 new file mode 100644 index 0000000000..3e37867bec --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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 +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VCidNull, + &i.VOidNull, + &i.VTidNull, + &i.VXidNull, + &i.VCid, + &i.VOid, + &i.VTid, + &i.VXid, + ); 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/cid_oid_tid_xid/pgx/v5/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; 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 new file mode 100644 index 0000000000..ecd09ac882 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE test_table +( + v_cid_null cid, + v_oid_null oid, + v_tid_null tid, + v_xid_null xid, + v_cid cid not null, + v_oid oid not null, + v_tid tid not null, + v_xid xid not null +); + diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/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/citext/pgx/go/db.go b/internal/endtoend/testdata/citext/pgx/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/citext/pgx/go/models.go b/internal/endtoend/testdata/citext/pgx/go/models.go new file mode 100644 index 0000000000..ca947ee379 --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Bat string +} diff --git a/internal/endtoend/testdata/citext/pgx/go/query.sql.go b/internal/endtoend/testdata/citext/pgx/go/query.sql.go new file mode 100644 index 0000000000..6e5d9e9855 --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getCitexts = `-- name: GetCitexts :many +SELECT bar, bat +FROM foo +` + +func (q *Queries) GetCitexts(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, getCitexts) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Bat); 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/citext/pgx/query.sql b/internal/endtoend/testdata/citext/pgx/query.sql new file mode 100644 index 0000000000..0c151ef5f6 --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/query.sql @@ -0,0 +1,3 @@ +-- name: GetCitexts :many +SELECT bar, bat +FROM foo; diff --git a/internal/endtoend/testdata/citext/pgx/schema.sql b/internal/endtoend/testdata/citext/pgx/schema.sql new file mode 100644 index 0000000000..60c067822a --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE EXTENSION IF NOT EXISTS citext; + +CREATE TABLE foo ( + bar citext, + bat citext not null +); + diff --git a/internal/endtoend/testdata/citext/pgx/sqlc.json b/internal/endtoend/testdata/citext/pgx/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/citext/stdlib/go/db.go b/internal/endtoend/testdata/citext/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/citext/stdlib/go/models.go b/internal/endtoend/testdata/citext/stdlib/go/models.go new file mode 100644 index 0000000000..ca947ee379 --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Bat string +} diff --git a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go new file mode 100644 index 0000000000..10f3e1fb7b --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getCitexts = `-- name: GetCitexts :many +SELECT bar, bat +FROM foo +` + +func (q *Queries) GetCitexts(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, getCitexts) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Bat); 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/citext/stdlib/query.sql b/internal/endtoend/testdata/citext/stdlib/query.sql new file mode 100644 index 0000000000..b6b08d2144 --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetCitexts :many +SELECT bar, bat +FROM foo; + + diff --git a/internal/endtoend/testdata/citext/stdlib/schema.sql b/internal/endtoend/testdata/citext/stdlib/schema.sql new file mode 100644 index 0000000000..60c067822a --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE EXTENSION IF NOT EXISTS citext; + +CREATE TABLE foo ( + bar citext, + bat citext not null +); + diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/sqlc.json b/internal/endtoend/testdata/citext/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/sqlc.json rename to internal/endtoend/testdata/citext/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/coalesce/mysql/go/db.go b/internal/endtoend/testdata/coalesce/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/go/models.go b/internal/endtoend/testdata/coalesce/mysql/go/models.go index 1ee813a39b..ca947ee379 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 3f69c6b692..d3676747e9 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/query.sql b/internal/endtoend/testdata/coalesce/mysql/query.sql index 022c1fb653..4cc0de9e29 100644 --- a/internal/endtoend/testdata/coalesce/mysql/query.sql +++ b/internal/endtoend/testdata/coalesce/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text, bat text not null); - -- name: Coalesce :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/mysql/schema.sql b/internal/endtoend/testdata/coalesce/mysql/schema.sql new file mode 100644 index 0000000000..c5002ec257 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, bat text not null); + diff --git a/internal/endtoend/testdata/coalesce/mysql/sqlc.json b/internal/endtoend/testdata/coalesce/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/coalesce/mysql/sqlc.json +++ b/internal/endtoend/testdata/coalesce/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/coalesce/postgresql/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/coalesce/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/coalesce/postgresql/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/go/models.go deleted file mode 100644 index 1ee813a39b..0000000000 --- a/internal/endtoend/testdata/coalesce/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullString - Bat string -} diff --git a/internal/endtoend/testdata/coalesce/postgresql/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/go/query.sql.go deleted file mode 100644 index 3f69c6b692..0000000000 --- a/internal/endtoend/testdata/coalesce/postgresql/go/query.sql.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const coalesce = `-- name: Coalesce :many -SELECT coalesce(bar, '') as login -FROM foo -` - -func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coalesce) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var login string - if err := rows.Scan(&login); err != nil { - return nil, err - } - items = append(items, login) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const coalesceColumns = `-- name: CoalesceColumns :many -SELECT bar, bat, coalesce(bar, bat) -FROM foo -` - -type CoalesceColumnsRow struct { - Bar sql.NullString - Bat string - Bar_2 string -} - -func (q *Queries) CoalesceColumns(ctx context.Context) ([]CoalesceColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceColumns) - if err != nil { - return nil, err - } - defer rows.Close() - var items []CoalesceColumnsRow - for rows.Next() { - var i CoalesceColumnsRow - if err := rows.Scan(&i.Bar, &i.Bat, &i.Bar_2); 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/coalesce/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/coalesce/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..9ba63f911e --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Bat string + Baz sql.NullInt64 + Qux int64 +} 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 new file mode 100644 index 0000000000..4d4c47b82f --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,183 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const coalesceNumeric = `-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo +` + +func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, coalesceNumeric) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var login int64 + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo +` + +type CoalesceNumericColumnsRow struct { + Baz sql.NullInt64 + Qux int64 + Baz_2 int64 +} + +func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { + rows, err := q.db.Query(ctx, coalesceNumericColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericColumnsRow + for rows.Next() { + var i CoalesceNumericColumnsRow + if err := rows.Scan(&i.Baz, &i.Qux, &i.Baz_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceNumericNull = `-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo +` + +type CoalesceNumericNullRow struct { + Baz sql.NullInt64 + Baz_2 sql.NullInt64 +} + +func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { + rows, err := q.db.Query(ctx, coalesceNumericNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericNullRow + for rows.Next() { + var i CoalesceNumericNullRow + if err := rows.Scan(&i.Baz, &i.Baz_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceString = `-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo +` + +func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, coalesceString) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceStringColumns = `-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo +` + +type CoalesceStringColumnsRow struct { + Bar sql.NullString + Bat string + Bar_2 string +} + +func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { + rows, err := q.db.Query(ctx, coalesceStringColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringColumnsRow + for rows.Next() { + var i CoalesceStringColumnsRow + if err := rows.Scan(&i.Bar, &i.Bat, &i.Bar_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceStringNull = `-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo +` + +type CoalesceStringNullRow struct { + Bar sql.NullString + Bar_2 sql.NullString +} + +func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { + rows, err := q.db.Query(ctx, coalesceStringNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringNullRow + for rows.Next() { + var i CoalesceStringNullRow + if err := rows.Scan(&i.Bar, &i.Bar_2); 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/coalesce/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..73d0693ca0 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql @@ -0,0 +1,23 @@ +-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo; + +-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo; + +-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo; + +-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo; + +-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo; + +-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/coalesce/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4bad9f8d4d --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Bat string + Baz pgtype.Int8 + Qux int64 +} 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 new file mode 100644 index 0000000000..cd31d38719 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,184 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const coalesceNumeric = `-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo +` + +func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, coalesceNumeric) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var login int64 + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo +` + +type CoalesceNumericColumnsRow struct { + Baz pgtype.Int8 + Qux int64 + Baz_2 int64 +} + +func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { + rows, err := q.db.Query(ctx, coalesceNumericColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericColumnsRow + for rows.Next() { + var i CoalesceNumericColumnsRow + if err := rows.Scan(&i.Baz, &i.Qux, &i.Baz_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceNumericNull = `-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo +` + +type CoalesceNumericNullRow struct { + Baz pgtype.Int8 + Baz_2 pgtype.Int8 +} + +func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { + rows, err := q.db.Query(ctx, coalesceNumericNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericNullRow + for rows.Next() { + var i CoalesceNumericNullRow + if err := rows.Scan(&i.Baz, &i.Baz_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceString = `-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo +` + +func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, coalesceString) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceStringColumns = `-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo +` + +type CoalesceStringColumnsRow struct { + Bar pgtype.Text + Bat string + Bar_2 string +} + +func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { + rows, err := q.db.Query(ctx, coalesceStringColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringColumnsRow + for rows.Next() { + var i CoalesceStringColumnsRow + if err := rows.Scan(&i.Bar, &i.Bat, &i.Bar_2); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceStringNull = `-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo +` + +type CoalesceStringNullRow struct { + Bar pgtype.Text + Bar_2 pgtype.Text +} + +func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { + rows, err := q.db.Query(ctx, coalesceStringNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringNullRow + for rows.Next() { + var i CoalesceStringNullRow + if err := rows.Scan(&i.Bar, &i.Bar_2); 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/coalesce/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..73d0693ca0 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql @@ -0,0 +1,23 @@ +-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo; + +-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo; + +-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo; + +-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo; + +-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo; + +-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/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/coalesce/postgresql/query.sql b/internal/endtoend/testdata/coalesce/postgresql/query.sql deleted file mode 100644 index 022c1fb653..0000000000 --- a/internal/endtoend/testdata/coalesce/postgresql/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE foo (bar text, bat text not null); - --- name: Coalesce :many -SELECT coalesce(bar, '') as login -FROM foo; - --- name: CoalesceColumns :many -SELECT bar, bat, coalesce(bar, bat) -FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/coalesce/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..9ba63f911e --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Bat string + Baz sql.NullInt64 + Qux int64 +} diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..5b1398ea52 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,201 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const coalesceNumeric = `-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo +` + +func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, coalesceNumeric) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var login int64 + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo +` + +type CoalesceNumericColumnsRow struct { + Baz sql.NullInt64 + Qux int64 + Baz_2 int64 +} + +func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, coalesceNumericColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericColumnsRow + for rows.Next() { + var i CoalesceNumericColumnsRow + if err := rows.Scan(&i.Baz, &i.Qux, &i.Baz_2); 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 coalesceNumericNull = `-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo +` + +type CoalesceNumericNullRow struct { + Baz sql.NullInt64 + Baz_2 sql.NullInt64 +} + +func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { + rows, err := q.db.QueryContext(ctx, coalesceNumericNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceNumericNullRow + for rows.Next() { + var i CoalesceNumericNullRow + if err := rows.Scan(&i.Baz, &i.Baz_2); 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 coalesceString = `-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo +` + +func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, coalesceString) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceStringColumns = `-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo +` + +type CoalesceStringColumnsRow struct { + Bar sql.NullString + Bat string + Bar_2 string +} + +func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, coalesceStringColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringColumnsRow + for rows.Next() { + var i CoalesceStringColumnsRow + if err := rows.Scan(&i.Bar, &i.Bat, &i.Bar_2); 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 coalesceStringNull = `-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo +` + +type CoalesceStringNullRow struct { + Bar sql.NullString + Bar_2 sql.NullString +} + +func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { + rows, err := q.db.QueryContext(ctx, coalesceStringNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceStringNullRow + for rows.Next() { + var i CoalesceStringNullRow + if err := rows.Scan(&i.Bar, &i.Bar_2); 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/coalesce/postgresql/stdlib/query.sql b/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..73d0693ca0 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql @@ -0,0 +1,23 @@ +-- name: CoalesceString :many +SELECT coalesce(bar, '') as login +FROM foo; + +-- name: CoalesceNumeric :many +SELECT coalesce(baz, 0) as login +FROM foo; + +-- name: CoalesceStringColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo; + +-- name: CoalesceNumericColumns :many +SELECT baz, qux, coalesce(baz, qux) +FROM foo; + +-- name: CoalesceStringNull :many +SELECT bar, coalesce(bar) +FROM foo; + +-- name: CoalesceNumericNull :many +SELECT baz, coalesce(baz) +FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/sqlc.json rename to internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/db.go b/internal/endtoend/testdata/coalesce/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce/sqlite/go/models.go b/internal/endtoend/testdata/coalesce/sqlite/go/models.go new file mode 100644 index 0000000000..ca947ee379 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Bat string +} diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go new file mode 100644 index 0000000000..d3676747e9 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go @@ -0,0 +1,73 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const coalesce = `-- name: Coalesce :many +SELECT coalesce(bar, '') as login +FROM foo +` + +func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, coalesce) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var login string + if err := rows.Scan(&login); err != nil { + return nil, err + } + items = append(items, login) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const coalesceColumns = `-- name: CoalesceColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo +` + +type CoalesceColumnsRow struct { + Bar sql.NullString + Bat string + Bar_2 string +} + +func (q *Queries) CoalesceColumns(ctx context.Context) ([]CoalesceColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, coalesceColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CoalesceColumnsRow + for rows.Next() { + var i CoalesceColumnsRow + if err := rows.Scan(&i.Bar, &i.Bat, &i.Bar_2); 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/coalesce/sqlite/query.sql b/internal/endtoend/testdata/coalesce/sqlite/query.sql new file mode 100644 index 0000000000..4cc0de9e29 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/query.sql @@ -0,0 +1,7 @@ +-- name: Coalesce :many +SELECT coalesce(bar, '') as login +FROM foo; + +-- name: CoalesceColumns :many +SELECT bar, bat, coalesce(bar, bat) +FROM foo; diff --git a/internal/endtoend/testdata/coalesce/sqlite/schema.sql b/internal/endtoend/testdata/coalesce/sqlite/schema.sql new file mode 100644 index 0000000000..c5002ec257 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, bat text not null); + diff --git a/internal/endtoend/testdata/coalesce/sqlite/sqlc.json b/internal/endtoend/testdata/coalesce/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/db.go b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce_as/mysql/go/models.go b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go new file mode 100644 index 0000000000..1d0ec38f48 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullInt32 +} diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go new file mode 100644 index 0000000000..b695d58d52 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar sql.NullString + Quantity interface{} +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.QueryContext(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/mysql/query.sql b/internal/endtoend/testdata/coalesce_as/mysql/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/mysql/schema.sql b/internal/endtoend/testdata/coalesce_as/mysql/schema.sql new file mode 100644 index 0000000000..eb1099a145 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz integer +); + diff --git a/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json b/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/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/coalesce_as/postgresql/pganalyze/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/coalesce_as/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..fec76da088 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Baz pgtype.Int8 +} 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 new file mode 100644 index 0000000000..c78eee2cb8 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar pgtype.Text + Quantity pgtype.Numeric +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.Query(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..f5e265377f --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "database": { + "managed": true + }, + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/coalesce_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..d03557129d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullInt64 +} 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 new file mode 100644 index 0000000000..ca18c2b954 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar sql.NullString + Quantity interface{} +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.Query(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/coalesce_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..fec76da088 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Baz pgtype.Int8 +} 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 new file mode 100644 index 0000000000..5dc871d4ca --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar pgtype.Text + Quantity interface{} +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.Query(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/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/coalesce_as/postgresql/stdlib/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..d03557129d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullInt64 +} 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 new file mode 100644 index 0000000000..b695d58d52 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar sql.NullString + Quantity interface{} +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.QueryContext(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/postgresql/stdlib/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/sqlc.json rename to internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce_as/sqlite/go/models.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go new file mode 100644 index 0000000000..d03557129d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullInt64 +} diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go new file mode 100644 index 0000000000..b695d58d52 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar sql.NullString + Quantity interface{} +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.QueryContext(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); 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/coalesce_as/sqlite/query.sql b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql b/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql new file mode 100644 index 0000000000..eb1099a145 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz integer +); + diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json b/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce_join/postgresql/go/models.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go new file mode 100644 index 0000000000..d093635683 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int64 +} + +type Foo 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 new file mode 100644 index 0000000000..4d0489e792 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBar = `-- name: GetBar :many +SELECT foo.id, COALESCE(bar.id, 0) AS bar_id +FROM foo +LEFT JOIN bar ON foo.id = bar.id +` + +type GetBarRow struct { + ID int64 + BarID int64 +} + +func (q *Queries) GetBar(ctx context.Context) ([]GetBarRow, error) { + rows, err := q.db.QueryContext(ctx, getBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetBarRow + for rows.Next() { + var i GetBarRow + if err := rows.Scan(&i.ID, &i.BarID); 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/coalesce_join/postgresql/query.sql b/internal/endtoend/testdata/coalesce_join/postgresql/query.sql new file mode 100644 index 0000000000..d91add88e6 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/query.sql @@ -0,0 +1,4 @@ +-- name: GetBar :many +SELECT foo.*, COALESCE(bar.id, 0) AS bar_id +FROM foo +LEFT JOIN bar ON foo.id = bar.id; diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql b/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql new file mode 100644 index 0000000000..ed9393c16f --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo(id bigserial primary key); +CREATE TABLE bar(id bigserial primary key); + diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/sqlc.json b/internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/sqlc.json rename to internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json diff --git a/internal/endtoend/testdata/coalesce_params/issue.md b/internal/endtoend/testdata/coalesce_params/issue.md new file mode 100644 index 0000000000..ad6db4167a --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/issue.md @@ -0,0 +1,2 @@ +https://github.com/sqlc-dev/sqlc/issues/2748 +https://github.com/sqlc-dev/sqlc/issues/2786 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/coalesce_params/mysql/go/models.go b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go new file mode 100644 index 0000000000..39606e4aaf --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" + "time" +) + +type CalendarMaincalendar string + +const ( + CalendarMaincalendarTrue CalendarMaincalendar = "true" + CalendarMaincalendarFalse CalendarMaincalendar = "false" +) + +func (e *CalendarMaincalendar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = CalendarMaincalendar(s) + case string: + *e = CalendarMaincalendar(s) + default: + return fmt.Errorf("unsupported scan type for CalendarMaincalendar: %T", src) + } + return nil +} + +type NullCalendarMaincalendar struct { + CalendarMaincalendar CalendarMaincalendar + Valid bool // Valid is true if CalendarMaincalendar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullCalendarMaincalendar) Scan(value interface{}) error { + if value == nil { + ns.CalendarMaincalendar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.CalendarMaincalendar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullCalendarMaincalendar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.CalendarMaincalendar), nil +} + +type Author struct { + ID int64 + Address string + Name string + Bio string +} + +type Calendar struct { + ID uint64 + Relation uint64 + Calendarname []byte + Title []byte + Description []byte + Timezone string + Uniquekey string + Idkey string + Maincalendar CalendarMaincalendar + Createdate time.Time + Modifydate time.Time +} + +type Event struct { + ID uint64 + Relation uint64 + Calendarreference uint64 + Uniquekey string + Eventname []byte + Description []byte + Location string + Timezone string + Idkey sql.NullString +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go new file mode 100644 index 0000000000..7bb5de9694 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const addAuthor = `-- name: AddAuthor :execlastid +INSERT INTO authors ( + address, + name, + bio +) VALUES ( + ?, + COALESCE(?, ""), + COALESCE(?, "") +) +` + +type AddAuthorParams struct { + Address string + CalName interface{} + CalDescription interface{} +} + +func (q *Queries) AddAuthor(ctx context.Context, arg AddAuthorParams) (int64, error) { + result, err := q.db.ExecContext(ctx, addAuthor, arg.Address, arg.CalName, arg.CalDescription) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const addEvent = `-- name: AddEvent :execlastid +INSERT INTO ` + "`" + `Event` + "`" + ` ( + Timezone +) VALUES ( + (CASE WHEN ? = "calendar" THEN (SELECT cal.Timezone FROM Calendar cal WHERE cal.IdKey = ?) ELSE ? END) +) +` + +type AddEventParams struct { + Timezone interface{} + CalendarIdKey string +} + +func (q *Queries) AddEvent(ctx context.Context, arg AddEventParams) (int64, error) { + result, err := q.db.ExecContext(ctx, addEvent, arg.Timezone, arg.CalendarIdKey, arg.Timezone) + if err != nil { + return 0, err + } + return result.LastInsertId() +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/query.sql b/internal/endtoend/testdata/coalesce_params/mysql/query.sql new file mode 100644 index 0000000000..f6df77d55d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/query.sql @@ -0,0 +1,17 @@ +-- name: AddEvent :execlastid +INSERT INTO `Event` ( + Timezone +) VALUES ( + (CASE WHEN sqlc.arg("Timezone") = "calendar" THEN (SELECT cal.Timezone FROM Calendar cal WHERE cal.IdKey = sqlc.arg("calendarIdKey")) ELSE sqlc.arg("Timezone") END) +); + +-- name: AddAuthor :execlastid +INSERT INTO authors ( + address, + name, + bio +) VALUES ( + ?, + COALESCE(sqlc.narg("calName"), ""), + COALESCE(sqlc.narg("calDescription"), "") +); diff --git a/internal/endtoend/testdata/coalesce_params/mysql/schema.sql b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql new file mode 100644 index 0000000000..0b1b34685c --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql @@ -0,0 +1,43 @@ +CREATE TABLE `Calendar` ( + `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `Relation` bigint(20) unsigned NOT NULL, + `CalendarName` longblob NOT NULL, + `Title` longblob NOT NULL, + `Description` longblob NOT NULL, + `Timezone` varchar(50) NOT NULL, + `UniqueKey` varchar(50) NOT NULL, + `IdKey` varchar(50) NOT NULL, + `MainCalendar` enum('true','false') NOT NULL DEFAULT 'false', + `CreateDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ModifyDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Id`), + KEY `Relation` (`Relation`), + KEY `UniqueKey` (`UniqueKey`), + KEY `IdKey` (`IdKey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE `Event` ( + `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `Relation` bigint(20) unsigned NOT NULL, + `CalendarReference` bigint(20) unsigned NOT NULL, + `UniqueKey` varchar(50) NOT NULL, + `EventName` longblob NOT NULL, + `Description` longblob NOT NULL, + `Location` varchar(500) NOT NULL, + `Timezone` varchar(50) NOT NULL, + `IdKey` varchar(48) DEFAULT NULL, + PRIMARY KEY (`Id`), + KEY `Relation` (`Relation`), + KEY `CalendarReference` (`CalendarReference`), + KEY `UniqueKey` (`UniqueKey`), + KEY `IdKey` (`IdKey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE authors ( + id BIGINT AUTO_INCREMENT NOT NULL, + address VARCHAR(200) NOT NULL, + name VARCHAR(20) NOT NULL, + bio LONGTEXT NOT NULL +); diff --git a/internal/endtoend/testdata/coalesce_params/mysql/sqlc.yaml b/internal/endtoend/testdata/coalesce_params/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/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/codegen_json/exec.json b/internal/endtoend/testdata/codegen_json/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json new file mode 100644 index 0000000000..754d2af289 --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -0,0 +1,65369 @@ +{ + "settings": { + "version": "2", + "engine": "postgresql", + "schema": [ + "postgresql/schema.sql" + ], + "queries": [ + "postgresql/query.sql" + ], + "codegen": { + "out": "", + "plugin": "", + "options": "", + "env": [], + "process": null, + "wasm": null + } + }, + "catalog": { + "comment": "", + "default_schema": "public", + "name": "", + "schemas": [ + { + "comment": "", + "name": "public", + "tables": [ + { + "rel": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_temp", + "tables": [], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_catalog", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "columns": [ + { + "name": "tableoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfnoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggkind", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggnumdirectargs", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggcombinefn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggdeserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminvtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggsortop", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "agginitval", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminitval", + "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_aggregate" + }, + "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_am" + }, + "columns": [ + { + "name": "tableoid", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amhandler", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amtype", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "columns": [ + { + "name": "tableoid", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoplefttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoprighttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopstrategy", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoppurpose", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopopr", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopmethod", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopsortfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "columns": [ + { + "name": "tableoid", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocfamily", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproclefttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocrighttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocnum", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproc", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "columns": [ + { + "name": "tableoid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adrelid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adnum", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adbin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attribute" + }, + "columns": [ + { + "name": "tableoid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attrelid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atttypid", + "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": "oid" + }, + "is_sqlc_slice": false, + "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 + }, + { + "name": "attlen", + "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 + }, + { + "name": "attnum", + "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 + }, + { + "name": "attndims", + "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 + }, + { + "name": "attcacheoff", + "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 + }, + { + "name": "atttypmod", + "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 + }, + { + "name": "attbyval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attalign", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attstorage", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attcompression", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnotnull", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasdef", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasmissing", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attidentity", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attgenerated", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attisdropped", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attislocal", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attinhcount", + "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 + }, + { + "name": "attcollation", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attacl", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attmissingval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "columns": [ + { + "name": "tableoid", + "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 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roleid", + "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 + }, + { + "name": "member", + "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 + }, + { + "name": "grantor", + "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 + }, + { + "name": "admin_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "columns": [ + { + "name": "tableoid", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "superuser", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trusted", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relocatable", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "requires", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extension_versions" + }, + "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_available_extensions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extensions" + }, + "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_backend_memory_contexts" + }, + "columns": [ + { + "name": "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ident", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parent", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "level", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_nblocks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_chunks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "used_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "columns": [ + { + "name": "tableoid", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castsource", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "casttarget", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castfunc", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castcontext", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castmethod", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "columns": [ + { + "name": "tableoid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnamespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloftype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relowner", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relam", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfilenode", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltablespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpages", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltuples", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relallvisible", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltoastrelid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasindex", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relisshared", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpersistence", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relkind", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnatts", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relchecks", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasrules", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhastriggers", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhassubclass", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relforcerowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispopulated", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relreplident", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispartition", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrewrite", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfrozenxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relminmxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relacl", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloptions", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpartbound", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_collation" + }, + "columns": [ + { + "name": "tableoid", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collnamespace", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collowner", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collprovider", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collisdeterministic", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collencoding", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collcollate", + "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 + }, + { + "name": "collctype", + "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 + }, + { + "name": "colliculocale", + "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 + }, + { + "name": "collversion", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_config" + }, + "columns": [ + { + "name": "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_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_config" + }, + "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_constraint" + }, + "columns": [ + { + "name": "tableoid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferrable", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferred", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "convalidated", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contypid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conindid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conparentid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confupdtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdeltype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confmatchtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conislocal", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "coninhcount", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connoinherit", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conpfeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conppeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conffeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdelsetcols", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conexclop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conbin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "columns": [ + { + "name": "tableoid", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conowner", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conforencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contoencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conproc", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condefault", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cursors" + }, + "columns": [ + { + "name": "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_holdable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_binary", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_scrollable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "creation_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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_database" + }, + "columns": [ + { + "name": "tableoid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datdba", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encoding", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datlocprovider", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datistemplate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datallowconn", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datconnlimit", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datfrozenxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datminmxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dattablespace", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datcollate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datctype", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "daticulocale", + "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 + }, + { + "name": "datcollversion", + "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 + }, + { + "name": "datacl", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "columns": [ + { + "name": "tableoid", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setdatabase", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setrole", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setconfig", + "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_db_role_setting" + }, + "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_default_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclrole", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclnamespace", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclobjtype", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclacl", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "columns": [ + { + "name": "tableoid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "columns": [ + { + "name": "tableoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_description" + }, + "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_enum" + }, + "columns": [ + { + "name": "tableoid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumtypid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumsortorder", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumlabel", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtevent", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtowner", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtfoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtenabled", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evttags", + "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_event_trigger" + }, + "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_extension" + }, + "columns": [ + { + "name": "tableoid", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extowner", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extnamespace", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extrelocatable", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extversion", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extconfig", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extcondition", + "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_extension" + }, + "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_file_settings" + }, + "columns": [ + { + "name": "sourcefile", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqno", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "applied", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "error", + "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_file_settings" + }, + "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_foreign_data_wrapper" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwhandler", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwvalidator", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwacl", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "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_foreign_data_wrapper" + }, + "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_foreign_server" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvfdw", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvtype", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvversion", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvacl", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "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_foreign_server" + }, + "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_foreign_table" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftrelid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftserver", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "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_foreign_table" + }, + "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_group" + }, + "columns": [ + { + "name": "groname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grosysid", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grolist", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "columns": [ + { + "name": "line_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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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": 0 + }, + { + "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": 0 + }, + { + "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 + }, + { + "name": "netmask", + "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 + }, + { + "name": "auth_method", + "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 + }, + { + "name": "options", + "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": 0 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "columns": [ + { + "name": "line_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 + }, + { + "name": "map_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 + }, + { + "name": "sys_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 + }, + { + "name": "pg_username", + "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 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "columns": [ + { + "name": "tableoid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnkeyatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisunique", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnullsnotdistinct", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisprimary", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisexclusion", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indimmediate", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisclustered", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisvalid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcheckxmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisready", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indislive", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisreplident", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indkey", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indoption", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexprs", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indpred", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexdef", + "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_indexes" + }, + "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_inherits" + }, + "columns": [ + { + "name": "tableoid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhrelid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhparent", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhseqno", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhdetachpending", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "columns": [ + { + "name": "tableoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privtype", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initprivs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "columns": [ + { + "name": "tableoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanowner", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanispl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanpltrusted", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanplcallfoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "laninline", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanvalidator", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanacl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "loid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pageno", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomowner", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomacl", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "columns": [ + { + "name": "locktype", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relation", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "page", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuple", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualxid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transactionid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualtransaction", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mode", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "granted", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fastpath", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "waitstart", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ispopulated", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_matviews" + }, + "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_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspowner", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspacl", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "columns": [ + { + "name": "tableoid", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcmethod", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcnamespace", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcowner", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcfamily", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcintype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcdefault", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opckeytype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "columns": [ + { + "name": "tableoid", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnamespace", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprowner", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprkind", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanmerge", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanhash", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprleft", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprright", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprresult", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcom", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnegate", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcode", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprrest", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprjoin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "columns": [ + { + "name": "tableoid", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfmethod", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfnamespace", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfowner", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parname", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "paracl", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "columns": [ + { + "name": "tableoid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partrelid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partstrat", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partnatts", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partdefid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partattrs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partexprs", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "policyname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "permissive", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roles", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmd", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "qual", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_check", + "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_policies" + }, + "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_policy" + }, + "columns": [ + { + "name": "tableoid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polrelid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polcmd", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polpermissive", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polroles", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polqual", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polwithcheck", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_statements" + }, + "columns": [ + { + "name": "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepare_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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_types", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "from_sql", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generic_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "custom_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "columns": [ + { + "name": "transaction", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gid", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepared", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "columns": [ + { + "name": "tableoid", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronamespace", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proowner", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prolang", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "procost", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorows", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provariadic", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosupport", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prokind", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosecdef", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proleakproof", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proisstrict", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proretset", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provolatile", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proparallel", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargs", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorettype", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargtypes", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proallargtypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargmodes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargnames", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "protrftypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosrc", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "probin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosqlbody", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proconfig", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proacl", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "columns": [ + { + "name": "tableoid", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubowner", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "puballtables", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubinsert", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubupdate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubdelete", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubtruncate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubviaroot", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnpubid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnnspid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prpubid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prrelid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prqual", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prattrs", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "columns": [ + { + "name": "pubname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowfilter", + "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_publication_tables" + }, + "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_range" + }, + "columns": [ + { + "name": "tableoid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngtypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubtype", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngmultitypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcollation", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubopc", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcanonical", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubdiff", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "columns": [ + { + "name": "tableoid", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roident", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roname", + "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_replication_origin" + }, + "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_replication_origin_status" + }, + "columns": [ + { + "name": "local_id", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_id", + "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_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "remote_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "local_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_slots" + }, + "columns": [ + { + "name": "slot_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "plugin", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datoid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temporary", + "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 + }, + { + "name": "active", + "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 + }, + { + "name": "active_pid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "catalog_xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "restart_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confirmed_flush_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_status", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "safe_wal_size", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "two_phase", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "columns": [ + { + "name": "tableoid", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_class", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_type", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_enabled", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instead", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_qual", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_action", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "columns": [ + { + "name": "rolname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconfig", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oid", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_rules" + }, + "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_seclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabel" + }, + "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_seclabels" + }, + "columns": [ + { + "name": "objoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objtype", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objnamespace", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objname", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabels" + }, + "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_sequence" + }, + "columns": [ + { + "name": "tableoid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqrelid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqtypid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqstart", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqincrement", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcache", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcycle", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequencename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequenceowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment_by", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cache_size", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_settings" + }, + "columns": [ + { + "name": "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unit", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "category", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "short_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extra_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "vartype", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumvals", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "boot_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reset_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourcefile", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pending_restart", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_shadow" + }, + "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_shdepend" + }, + "columns": [ + { + "name": "tableoid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dbid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "columns": [ + { + "name": "tableoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_shdescription" + }, + "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_shmem_allocations" + }, + "columns": [ + { + "name": "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "off", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "allocated_size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_shseclabel" + }, + "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_activity" + }, + "columns": [ + { + "name": "datid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "leader_pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state_change", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event_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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_id", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_activity" + }, + "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_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_archiver" + }, + "columns": [ + { + "name": "archived_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "failed_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_bgwriter" + }, + "columns": [ + { + "name": "checkpoints_timed", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoints_req", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_sync_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_checkpoint", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maxwritten_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend_fsync", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_alloc", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database" + }, + "columns": [ + { + "name": "datid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numbackends", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_commit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_rollback", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_returned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_fetched", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_inserted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_updated", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_deleted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conflicts", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_files", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deadlocks", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_failures", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_last_failure", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "session_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "active_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idle_in_transaction_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_abandoned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_fatal", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_killed", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database_conflicts" + }, + "columns": [ + { + "name": "datid", + "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_database_conflicts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confl_tablespace", + "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 + }, + { + "name": "confl_lock", + "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 + }, + { + "name": "confl_snapshot", + "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 + }, + { + "name": "confl_bufferpin", + "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 + }, + { + "name": "confl_deadlock", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_gssapi" + }, + "columns": [ + { + "name": "pid", + "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_gssapi" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gss_authenticated", + "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 + }, + { + "name": "principal", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encrypted", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "columns": [ + { + "name": "pid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_scanned", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_computed", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_done", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_child_table_relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "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_progress_basebackup" + }, + "columns": [ + { + "name": "pid", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_cluster" + }, + "columns": [ + { + "name": "pid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cluster_index_relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_written", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_rebuild_count", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_copy" + }, + "columns": [ + { + "name": "pid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_total", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_excluded", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_create_index" + }, + "columns": [ + { + "name": "pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_locker_pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_vacuum" + }, + "columns": [ + { + "name": "pid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_vacuumed", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_vacuum_count", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "num_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_recovery_prefetch" + }, + "columns": [ + { + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prefetch", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hit", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_init", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_new", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_fpw", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_rep", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "block_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "io_depth", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "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_replication" + }, + "columns": [ + { + "name": "pid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sent_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_priority", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reply_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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_replication_slots" + }, + "columns": [ + { + "name": "slot_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_stat_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_slru" + }, + "columns": [ + { + "name": "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_stat_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_zeroed", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_written", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_exists", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushes", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "truncates", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_ssl" + }, + "columns": [ + { + "name": "pid", + "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 + }, + { + "name": "ssl", + "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": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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": "cipher", + "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": "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 + }, + { + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_stats" + }, + "columns": [ + { + "name": "subid", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "apply_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_wal" + }, + "columns": [ + { + "name": "wal_records", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_fpi", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_bytes", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_buffers_full", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_write", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_wal_receiver" + }, + "columns": [ + { + "name": "pid", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "status", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "written_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushed_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_stat_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_host", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_port", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conninfo", + "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_wal_receiver" + }, + "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_xact_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_xact_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "starelid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staattnum", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stainherit", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanullfrac", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stawidth", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stadistinct", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxrelid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxnamespace", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxowner", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxstattarget", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkeys", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkind", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxexprs", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdinherit", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdndistinct", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxddependencies", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdmcv", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_mcv_list" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdexpr", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_pg_statistic" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "exprs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "kinds", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependencies", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_val_nulls", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_base_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "expr", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdbid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subskiplsn", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "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": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subowner", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subenabled", + "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 + }, + { + "name": "subbinary", + "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 + }, + { + "name": "substream", + "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 + }, + { + "name": "subtwophasestate", + "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": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdisableonerr", + "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 + }, + { + "name": "subconninfo", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subslotname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subsynccommit", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subpublications", + "not_null": true, + "is_array": true, + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srrelid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubstate", + "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_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsublsn", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tableowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasrules", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hastriggers", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowsecurity", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "columns": [ + { + "name": "tableoid", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcowner", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcacl", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcoptions", + "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_tablespace" + }, + "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_timezone_abbrevs" + }, + "columns": [ + { + "name": "abbrev", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "columns": [ + { + "name": "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "abbrev", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "columns": [ + { + "name": "tableoid", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftype", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trflang", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trffromsql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftosql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgparentid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgfoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgtype", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgenabled", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgisinternal", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrindid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstraint", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgdeferrable", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tginitdeferred", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgattr", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgqual", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgoldtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnewtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgnamespace", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgowner", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgparser", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapcfg", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maptokentype", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapseqno", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapdict", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictnamespace", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictowner", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dicttemplate", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictinitoption", + "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_ts_dict" + }, + "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_ts_parser" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsnamespace", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsstart", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prstoken", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsend", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsheadline", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prslextype", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplnamespace", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplinit", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmpllexize", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "columns": [ + { + "name": "tableoid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnamespace", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typowner", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typlen", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbyval", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcategory", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typispreferred", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typisdefined", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdelim", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typrelid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsubscript", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typelem", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typarray", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typinput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typoutput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typreceive", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsend", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodout", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typanalyze", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typalign", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typstorage", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnotnull", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbasetype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtypmod", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typndims", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcollation", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefaultbin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefault", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typacl", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_user" + }, + "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_user_mapping" + }, + "columns": [ + { + "name": "tableoid", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umserver", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mapping" + }, + "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_user_mappings" + }, + "columns": [ + { + "name": "umid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mappings" + }, + "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_views" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "information_schema", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "columns": [ + { + "name": "nspname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "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": "information_schema", + "name": "_pg_foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_derived_reference_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "columns": [ + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_repertoire", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "form_of_use", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_clause", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pad_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependent_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_self_referencing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_identity", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_start", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_maximum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_minimum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_cycle", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_generated", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generation_expression", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collection_type_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "columns": [ + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "library_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "position_in_unique_constraint", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_mode", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_result", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "match_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "update_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "delete_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_body", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_style", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deterministic", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_data_access", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_null_call", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_level_routine", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dynamic_result_sets", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_user_defined_cast", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_implicitly_invocable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "security_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_altered", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "new_savepoint_level", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_udt_dependent", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_from_data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_max_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "columns": [ + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "minimum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "integer_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "supported_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enforced", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nulls_distinct", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_referencing_column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_typed", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "commit_action", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "group_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transform_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_manipulation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_order", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_condition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_statement", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_orientation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_timing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "columns": [ + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instantiable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_final", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_form", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ref_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_deletable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + } + ] + }, + "queries": [ + { + "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", + "name": "GetAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "SELECT id, name, bio FROM authors\nORDER BY name", + "name": "ListAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", + "name": "CreateAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + } + }, + { + "number": 2, + "column": { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": { + "catalog": "", + "schema": "", + "name": "authors" + } + }, + { + "text": "DELETE FROM authors\nWHERE id = $1", + "name": "DeleteAuthor", + "cmd": ":exec", + "columns": [], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + } + ], + "sqlc_version": "v1.30.0", + "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=", + "global_options": "" +} diff --git a/internal/endtoend/testdata/codegen_json/postgresql/query.sql b/internal/endtoend/testdata/codegen_json/postgresql/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/postgresql/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/codegen_json/postgresql/schema.sql b/internal/endtoend/testdata/codegen_json/postgresql/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/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/codegen_json/sqlc.json b/internal/endtoend/testdata/codegen_json/sqlc.json new file mode 100644 index 0000000000..cbbf97440c --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/sqlc.json @@ -0,0 +1,17 @@ +{ + "version": "2", + "sql": [ + { + "schema": "postgresql/schema.sql", + "queries": "postgresql/query.sql", + "engine": "postgresql", + "gen": { + "json": { + "out": "gen", + "indent": " ", + "filename": "codegen.json" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/README.md b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/README.md new file mode 100644 index 0000000000..910e4f711f --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/README.md @@ -0,0 +1 @@ +This tests that Go struct field names are proper Go identifiers. \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/codegen_struct_field_names/stdlib/go/models.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go new file mode 100644 index 0000000000..3dff0f3bae --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + NobodyWouldBelieveThis sql.NullInt32 + ParentID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..4d63368825 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const test = `-- name: test :one +SELECT id, "!!!nobody,_,-would-believe---this-...?!", "parent id" from bar limit 1 +` + +func (q *Queries) test(ctx context.Context) (Bar, error) { + row := q.db.QueryRowContext(ctx, test) + var i Bar + err := row.Scan(&i.ID, &i.NobodyWouldBelieveThis, &i.ParentID) + return i, err +} diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql new file mode 100644 index 0000000000..252d207821 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: test :one +SELECT * from bar limit 1; diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql new file mode 100644 index 0000000000..68a6c9bf04 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id INT NOT NULL, + "!!!nobody,_,-would-believe---this-...?!" INT, + "parent id" INT); + diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json new file mode 100644 index 0000000000..4f08376b42 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..05352919de --- /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.30.0 + +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..9de0be747c --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/db.go +++ b/internal/endtoend/testdata/column_as/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/mysql/go/models.go b/internal/endtoend/testdata/column_as/mysql/go/models.go index c2291cf4ec..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/models.go +++ b/internal/endtoend/testdata/column_as/mysql/go/models.go @@ -1,9 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest - -import () - -type Foo struct { - Email string -} 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 88dd4a379b..bb26fb91ca 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -7,29 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAs) - 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 +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/mysql/query.sql b/internal/endtoend/testdata/column_as/mysql/query.sql index 4b055cc896..35014456bb 100644 --- a/internal/endtoend/testdata/column_as/mysql/query.sql +++ b/internal/endtoend/testdata/column_as/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; -/* name: ColumnAs :many */ -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file diff --git a/internal/endtoend/testdata/column_as/mysql/schema.sql b/internal/endtoend/testdata/column_as/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/column_as/mysql/sqlc.json b/internal/endtoend/testdata/column_as/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/column_as/mysql/sqlc.json +++ b/internal/endtoend/testdata/column_as/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/column_as/postgresql/go/db.go b/internal/endtoend/testdata/column_as/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/column_as/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_as/postgresql/go/models.go b/internal/endtoend/testdata/column_as/postgresql/go/models.go deleted file mode 100644 index c2291cf4ec..0000000000 --- a/internal/endtoend/testdata/column_as/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Email string -} diff --git a/internal/endtoend/testdata/column_as/postgresql/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/go/query.sql.go deleted file mode 100644 index 88dd4a379b..0000000000 --- a/internal/endtoend/testdata/column_as/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo -` - -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAs) - 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/column_as/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/column_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..dd8604891b --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y +` + +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRow(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRow(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..35014456bb --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; + +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..4c0b2785b8 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "engine": "postgresql", + "sql_package": "pgx/v4", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/column_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..dd8604891b --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y +` + +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRow(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRow(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..35014456bb --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; + +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..d12b82a6c6 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "engine": "postgresql", + "sql_package": "pgx/v5", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/column_as/postgresql/query.sql b/internal/endtoend/testdata/column_as/postgresql/query.sql deleted file mode 100644 index 339627fd50..0000000000 --- a/internal/endtoend/testdata/column_as/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (email text not null); - --- name: ColumnAs :many -SELECT email AS id FROM foo; diff --git a/internal/endtoend/testdata/column_as/postgresql/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/column_as/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..bb26fb91ca --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y +` + +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql b/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..35014456bb --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; + +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/column_as/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/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/column_as/sqlite/go/db.go b/internal/endtoend/testdata/column_as/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/column_as/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_as/sqlite/go/models.go b/internal/endtoend/testdata/column_as/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/column_as/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go new file mode 100644 index 0000000000..4c77f808c1 --- /dev/null +++ b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y +` + +type WithAsRow struct { + X int64 + Y int64 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int64 + Y int64 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} diff --git a/internal/endtoend/testdata/column_as/sqlite/query.sql b/internal/endtoend/testdata/column_as/sqlite/query.sql new file mode 100644 index 0000000000..c7282d88ef --- /dev/null +++ b/internal/endtoend/testdata/column_as/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; + +-- name: WithoutAs :one +SELECT 1 x, 2 y; diff --git a/internal/endtoend/testdata/column_as/sqlite/schema.sql b/internal/endtoend/testdata/column_as/sqlite/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/column_as/sqlite/sqlc.json b/internal/endtoend/testdata/column_as/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/column_as/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/comment_godoc/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/comment_godoc/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..a31a016362 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/jackc/pgconn" +) + +const execFoo = `-- name: ExecFoo :exec +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :exec +func (q *Queries) ExecFoo(ctx context.Context) error { + _, err := q.db.Exec(ctx, execFoo) + return err +} + +const execResultFoo = `-- name: ExecResultFoo :execresult +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execresult +func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, execResultFoo) +} + +const execRowFoo = `-- name: ExecRowFoo :execrows +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execrows +func (q *Queries) ExecRowFoo(ctx context.Context) (int64, error) { + result, err := q.db.Exec(ctx, execRowFoo) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const manyFoo = `-- name: ManyFoo :many +SELECT bar FROM foo +` + +// This function returns a list of Foos +func (q *Queries) ManyFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, manyFoo) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const oneFoo = `-- name: OneFoo :one +SELECT bar FROM foo +` + +// This function returns one Foo +func (q *Queries) OneFoo(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRow(ctx, oneFoo) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b5fab38de7 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql @@ -0,0 +1,19 @@ +-- name: ManyFoo :many +-- This function returns a list of Foos +SELECT * FROM foo; + +-- name: OneFoo :one +-- This function returns one Foo +SELECT * FROM foo; + +-- name: ExecFoo :exec +-- This function creates a Foo via :exec +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecRowFoo :execrows +-- This function creates a Foo via :execrows +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecResultFoo :execresult +-- This function creates a Foo via :execresult +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..5ffafefc61 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v4" + } + ] +} + 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/comment_godoc/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f2fbf9abf3 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text +} 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 new file mode 100644 index 0000000000..1bd9065b43 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" +) + +const execFoo = `-- name: ExecFoo :exec +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :exec +func (q *Queries) ExecFoo(ctx context.Context) error { + _, err := q.db.Exec(ctx, execFoo) + return err +} + +const execResultFoo = `-- name: ExecResultFoo :execresult +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execresult +func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, execResultFoo) +} + +const execRowFoo = `-- name: ExecRowFoo :execrows +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execrows +func (q *Queries) ExecRowFoo(ctx context.Context) (int64, error) { + result, err := q.db.Exec(ctx, execRowFoo) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const manyFoo = `-- name: ManyFoo :many +SELECT bar FROM foo +` + +// This function returns a list of Foos +func (q *Queries) ManyFoo(ctx context.Context) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, manyFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var bar pgtype.Text + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const oneFoo = `-- name: OneFoo :one +SELECT bar FROM foo +` + +// This function returns one Foo +func (q *Queries) OneFoo(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, oneFoo) + var bar pgtype.Text + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b5fab38de7 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql @@ -0,0 +1,19 @@ +-- name: ManyFoo :many +-- This function returns a list of Foos +SELECT * FROM foo; + +-- name: OneFoo :one +-- This function returns one Foo +SELECT * FROM foo; + +-- name: ExecFoo :exec +-- This function creates a Foo via :exec +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecRowFoo :execrows +-- This function creates a Foo via :execrows +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecResultFoo :execresult +-- This function creates a Foo via :execresult +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..4905a64003 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5" + } + ] +} + 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 new file mode 100644 index 0000000000..7599fccb42 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..a0358ab4ed --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/jackc/pgconn" +) + +const execFoo = `-- name: ExecFoo :exec +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :exec +func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { + _, err := db.Exec(ctx, execFoo) + return err +} + +const execResultFoo = `-- name: ExecResultFoo :execresult +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execresult +func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag, error) { + return db.Exec(ctx, execResultFoo) +} + +const execRowFoo = `-- name: ExecRowFoo :execrows +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execrows +func (q *Queries) ExecRowFoo(ctx context.Context, db DBTX) (int64, error) { + result, err := db.Exec(ctx, execRowFoo) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const manyFoo = `-- name: ManyFoo :many +SELECT bar FROM foo +` + +// This function returns a list of Foos +func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]sql.NullString, error) { + rows, err := db.Query(ctx, manyFoo) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const oneFoo = `-- name: OneFoo :one +SELECT bar FROM foo +` + +// This function returns one Foo +func (q *Queries) OneFoo(ctx context.Context, db DBTX) (sql.NullString, error) { + row := db.QueryRow(ctx, oneFoo) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b5fab38de7 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql @@ -0,0 +1,19 @@ +-- name: ManyFoo :many +-- This function returns a list of Foos +SELECT * FROM foo; + +-- name: OneFoo :one +-- This function returns one Foo +SELECT * FROM foo; + +-- name: ExecFoo :exec +-- This function creates a Foo via :exec +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecRowFoo :execrows +-- This function creates a Foo via :execrows +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecResultFoo :execresult +-- This function creates a Foo via :execresult +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..6b0b6cd07e --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v4", + "emit_methods_with_db_argument": true + } + ] +} 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 new file mode 100644 index 0000000000..166695c170 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..f2fbf9abf3 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text +} 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 new file mode 100644 index 0000000000..533edb506b --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" +) + +const execFoo = `-- name: ExecFoo :exec +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :exec +func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { + _, err := db.Exec(ctx, execFoo) + return err +} + +const execResultFoo = `-- name: ExecResultFoo :execresult +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execresult +func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag, error) { + return db.Exec(ctx, execResultFoo) +} + +const execRowFoo = `-- name: ExecRowFoo :execrows +INSERT INTO foo (bar) VALUES ('bar') +` + +// This function creates a Foo via :execrows +func (q *Queries) ExecRowFoo(ctx context.Context, db DBTX) (int64, error) { + result, err := db.Exec(ctx, execRowFoo) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const manyFoo = `-- name: ManyFoo :many +SELECT bar FROM foo +` + +// This function returns a list of Foos +func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]pgtype.Text, error) { + rows, err := db.Query(ctx, manyFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var bar pgtype.Text + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const oneFoo = `-- name: OneFoo :one +SELECT bar FROM foo +` + +// This function returns one Foo +func (q *Queries) OneFoo(ctx context.Context, db DBTX) (pgtype.Text, error) { + row := db.QueryRow(ctx, oneFoo) + var bar pgtype.Text + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b5fab38de7 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql @@ -0,0 +1,19 @@ +-- name: ManyFoo :many +-- This function returns a list of Foos +SELECT * FROM foo; + +-- name: OneFoo :one +-- This function returns one Foo +SELECT * FROM foo; + +-- name: ExecFoo :exec +-- This function creates a Foo via :exec +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecRowFoo :execrows +-- This function creates a Foo via :execrows +INSERT INTO foo (bar) VALUES ('bar'); + +-- name: ExecResultFoo :execresult +-- This function creates a Foo via :execresult +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..0e07b3a0de --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5", + "emit_methods_with_db_argument": true + } + ] +} diff --git a/internal/endtoend/testdata/comment_on/go/db.go b/internal/endtoend/testdata/comment_on/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/comment_on/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/comment_on/go/models.go b/internal/endtoend/testdata/comment_on/go/models.go deleted file mode 100644 index 074858130f..0000000000 --- a/internal/endtoend/testdata/comment_on/go/models.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -// this is the mood type -type FooMood string - -const ( - FooMoodSad FooMood = "sad" - FooMoodOk FooMood = "ok" - FooMoodHappy FooMood = "happy" -) - -func (e *FooMood) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = FooMood(s) - case string: - *e = FooMood(s) - default: - return fmt.Errorf("unsupported scan type for FooMood: %T", src) - } - return nil -} - -// this is the bar table -type FooBar struct { - // this is the baz column - Baz string -} diff --git a/internal/endtoend/testdata/comment_on/go/query.sql.go b/internal/endtoend/testdata/comment_on/go/query.sql.go deleted file mode 100644 index 498d9fc030..0000000000 --- a/internal/endtoend/testdata/comment_on/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listBar = `-- name: ListBar :many -SELECT baz FROM foo.bar -` - -func (q *Queries) ListBar(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listBar) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var baz string - if err := rows.Scan(&baz); err != nil { - return nil, err - } - items = append(items, baz) - } - 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/comment_on/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/comment_on/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..33105da087 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +// this is the mood type +type FooMood string + +const ( + FooMoodSad FooMood = "sad" + FooMoodOk FooMood = "ok" + FooMoodHappy FooMood = "happy" +) + +func (e *FooMood) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooMood(s) + case string: + *e = FooMood(s) + default: + return fmt.Errorf("unsupported scan type for FooMood: %T", src) + } + return nil +} + +type NullFooMood struct { + FooMood FooMood + Valid bool // Valid is true if FooMood is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooMood) Scan(value interface{}) error { + if value == nil { + ns.FooMood, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooMood.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooMood) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooMood), nil +} + +// this is the bar table +type FooBar struct { + // this is the baz column + Baz string +} + +// this is the bat view +type FooBat struct { + Baz string +} 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 new file mode 100644 index 0000000000..33c4edd32e --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT baz FROM foo.bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBat = `-- name: ListBat :many +SELECT baz FROM foo.bat +` + +func (q *Queries) ListBat(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listBat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..cda102c5a2 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: ListBar :many +SELECT * FROM foo.bar; + +-- name: ListBat :many +SELECT * FROM foo.bat; diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/comment_on/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..33105da087 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +// this is the mood type +type FooMood string + +const ( + FooMoodSad FooMood = "sad" + FooMoodOk FooMood = "ok" + FooMoodHappy FooMood = "happy" +) + +func (e *FooMood) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooMood(s) + case string: + *e = FooMood(s) + default: + return fmt.Errorf("unsupported scan type for FooMood: %T", src) + } + return nil +} + +type NullFooMood struct { + FooMood FooMood + Valid bool // Valid is true if FooMood is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooMood) Scan(value interface{}) error { + if value == nil { + ns.FooMood, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooMood.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooMood) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooMood), nil +} + +// this is the bar table +type FooBar struct { + // this is the baz column + Baz string +} + +// this is the bat view +type FooBat struct { + Baz string +} 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 new file mode 100644 index 0000000000..33c4edd32e --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT baz FROM foo.bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBat = `-- name: ListBat :many +SELECT baz FROM foo.bat +` + +func (q *Queries) ListBat(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listBat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..cda102c5a2 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: ListBar :many +SELECT * FROM foo.bar; + +-- name: ListBat :many +SELECT * FROM foo.bat; diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/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/comment_on/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/comment_on/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..33105da087 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +// this is the mood type +type FooMood string + +const ( + FooMoodSad FooMood = "sad" + FooMoodOk FooMood = "ok" + FooMoodHappy FooMood = "happy" +) + +func (e *FooMood) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooMood(s) + case string: + *e = FooMood(s) + default: + return fmt.Errorf("unsupported scan type for FooMood: %T", src) + } + return nil +} + +type NullFooMood struct { + FooMood FooMood + Valid bool // Valid is true if FooMood is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooMood) Scan(value interface{}) error { + if value == nil { + ns.FooMood, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooMood.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooMood) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooMood), nil +} + +// this is the bar table +type FooBar struct { + // this is the baz column + Baz string +} + +// this is the bat view +type FooBat struct { + Baz string +} 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 new file mode 100644 index 0000000000..8a65a0cb31 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT baz FROM foo.bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBat = `-- name: ListBat :many +SELECT baz FROM foo.bat +` + +func (q *Queries) ListBat(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listBat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var baz string + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + 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/comment_on/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..cda102c5a2 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: ListBar :many +SELECT * FROM foo.bar; + +-- name: ListBat :many +SELECT * FROM foo.bat; diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..3a3e2e510a --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/comment_on/query.sql b/internal/endtoend/testdata/comment_on/query.sql deleted file mode 100644 index d2f15b3726..0000000000 --- a/internal/endtoend/testdata/comment_on/query.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE SCHEMA foo; - -CREATE TABLE foo.bar ( - baz text NOT NULL -); - -CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); - -COMMENT ON SCHEMA foo IS 'this is the foo schema'; -COMMENT ON TYPE foo.mood IS 'this is the mood type'; -COMMENT ON TABLE foo.bar IS 'this is the bar table'; -COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; - --- name: ListBar :many -SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/comment_on/sqlc.json b/internal/endtoend/testdata/comment_on/sqlc.json deleted file mode 100644 index ba0ecf07f3..0000000000 --- a/internal/endtoend/testdata/comment_on/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "engine": "postgresql", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go index 8170fc4b5c..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 3626b6a78f..2e94b32488 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -20,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/mysql/query.sql b/internal/endtoend/testdata/comment_syntax/mysql/query.sql index 1add2d737c..148327534c 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/query.sql +++ b/internal/endtoend/testdata/comment_syntax/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/mysql/schema.sql b/internal/endtoend/testdata/comment_syntax/mysql/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json b/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/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/comment_syntax/postgresql/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/comment_syntax/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/comment_syntax/postgresql/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/go/models.go deleted file mode 100644 index 8170fc4b5c..0000000000 --- a/internal/endtoend/testdata/comment_syntax/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullString -} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/go/query.sql.go deleted file mode 100644 index 6271efbfe7..0000000000 --- a/internal/endtoend/testdata/comment_syntax/postgresql/go/query.sql.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const doubleDash = `-- name: DoubleDash :one -SELECT bar FROM foo LIMIT 1 -` - -func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, doubleDash) - var bar sql.NullString - err := row.Scan(&bar) - return bar, err -} - -const slashStar = `-- name: SlashStar :one -SELECT bar FROM foo LIMIT 1 -` - -func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, slashStar) - var bar sql.NullString - err := row.Scan(&bar) - return bar, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/comment_syntax/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..ac5869164a --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const doubleDash = `-- name: DoubleDash :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRow(ctx, doubleDash) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} + +const slashStar = `-- name: SlashStar :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRow(ctx, slashStar) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ddf6f4b70c --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: DoubleDash :one +SELECT * FROM foo LIMIT 1; + +/* name: SlashStar :one */ +SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..afdff35e59 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v4", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/comment_syntax/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f2fbf9abf3 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text +} 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 new file mode 100644 index 0000000000..752470ce02 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const doubleDash = `-- name: DoubleDash :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) DoubleDash(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, doubleDash) + var bar pgtype.Text + err := row.Scan(&bar) + return bar, err +} + +const slashStar = `-- name: SlashStar :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) SlashStar(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, slashStar) + var bar pgtype.Text + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ddf6f4b70c --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: DoubleDash :one +SELECT * FROM foo LIMIT 1; + +/* name: SlashStar :one */ +SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..a690d83cb5 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/query.sql deleted file mode 100644 index 2efd5e5a1c..0000000000 --- a/internal/endtoend/testdata/comment_syntax/postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE foo (bar text); - --- name: DoubleDash :one -SELECT * FROM foo LIMIT 1; - -/* name: SlashStar :one */ -SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/comment_syntax/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/comment_syntax/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..6e2a2003ab --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const doubleDash = `-- name: DoubleDash :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, doubleDash) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} + +const slashStar = `-- name: SlashStar :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, slashStar) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ddf6f4b70c --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: DoubleDash :one +SELECT * FROM foo LIMIT 1; + +/* name: SlashStar :one */ +SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename/postgresql/sqlc.json rename to internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/comment_syntax/sqlite/go/models.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go new file mode 100644 index 0000000000..92ddc7826f --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6e2a2003ab --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const doubleDash = `-- name: DoubleDash :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, doubleDash) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} + +const slashStar = `-- name: SlashStar :one +SELECT bar FROM foo LIMIT 1 +` + +func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, slashStar) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/query.sql b/internal/endtoend/testdata/comment_syntax/sqlite/query.sql new file mode 100644 index 0000000000..ddf6f4b70c --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: DoubleDash :one +SELECT * FROM foo LIMIT 1; + +/* name: SlashStar :one */ +SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql b/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json b/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/comparisons/mysql/go/db.go b/internal/endtoend/testdata/comparisons/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/db.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/mysql/go/models.go b/internal/endtoend/testdata/comparisons/mysql/go/models.go index 18039acde9..65820844a6 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/models.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + 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 dc904be208..4289448bd8 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -115,6 +117,60 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } +const isNotNull = `-- name: IsNotNull :many +SELECT id IS NOT NULL FROM bar +` + +func (q *Queries) IsNotNull(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, isNotNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const isNull = `-- name: IsNull :many +SELECT id IS NULL FROM bar +` + +func (q *Queries) IsNull(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, isNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const lessThan = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` diff --git a/internal/endtoend/testdata/comparisons/mysql/query.sql b/internal/endtoend/testdata/comparisons/mysql/query.sql index 3c609f4660..468a74fdd9 100644 --- a/internal/endtoend/testdata/comparisons/mysql/query.sql +++ b/internal/endtoend/testdata/comparisons/mysql/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; @@ -24,8 +19,8 @@ SELECT count(*) <> 0 FROM bar; -- name: Equal :many SELECT count(*) = 0 FROM bar; +-- name: IsNull :many +SELECT id IS NULL FROM bar; - - - - +-- name: IsNotNull :many +SELECT id IS NOT NULL FROM bar; diff --git a/internal/endtoend/testdata/comparisons/mysql/schema.sql b/internal/endtoend/testdata/comparisons/mysql/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/mysql/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/mysql/sqlc.json b/internal/endtoend/testdata/comparisons/mysql/sqlc.json index c02fc9b4cb..b45b90329b 100644 --- a/internal/endtoend/testdata/comparisons/mysql/sqlc.json +++ b/internal/endtoend/testdata/comparisons/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/postgresql/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/comparisons/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/comparisons/postgresql/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/comparisons/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/comparisons/postgresql/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/go/query.sql.go deleted file mode 100644 index dc904be208..0000000000 --- a/internal/endtoend/testdata/comparisons/postgresql/go/query.sql.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const alsoNotEqual = `-- name: AlsoNotEqual :many -SELECT count(*) <> 0 FROM bar -` - -func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, alsoNotEqual) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const equal = `-- name: Equal :many -SELECT count(*) = 0 FROM bar -` - -func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, equal) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const greaterThan = `-- name: GreaterThan :many -SELECT count(*) > 0 FROM bar -` - -func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThan) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many -SELECT count(*) >= 0 FROM bar -` - -func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const lessThan = `-- name: LessThan :many -SELECT count(*) < 0 FROM bar -` - -func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThan) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const lessThanOrEqual = `-- name: LessThanOrEqual :many -SELECT count(*) <= 0 FROM bar -` - -func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThanOrEqual) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const notEqual = `-- name: NotEqual :many -SELECT count(*) != 0 FROM bar -` - -func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, notEqual) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var column_1 bool - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - 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/comparisons/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/comparisons/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2f19b196be --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,178 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const alsoNotEqual = `-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar +` + +func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, alsoNotEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const equal = `-- name: Equal :many +SELECT count(*) = 0 FROM bar +` + +func (q *Queries) Equal(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, equal) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThan = `-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar +` + +func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, greaterThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar +` + +func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, greaterThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThan = `-- name: LessThan :many +SELECT count(*) < 0 FROM bar +` + +func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, lessThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThanOrEqual = `-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar +` + +func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, lessThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const notEqual = `-- name: NotEqual :many +SELECT count(*) != 0 FROM bar +` + +func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, notEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..8763edaa62 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql @@ -0,0 +1,26 @@ +-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar; + +-- name: LessThan :many +SELECT count(*) < 0 FROM bar; + +-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar; + +-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar; + +-- name: NotEqual :many +SELECT count(*) != 0 FROM bar; + +-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar; + +-- name: Equal :many +SELECT count(*) = 0 FROM bar; + + + + + + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..afdff35e59 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v4", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/comparisons/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2f19b196be --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,178 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const alsoNotEqual = `-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar +` + +func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, alsoNotEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const equal = `-- name: Equal :many +SELECT count(*) = 0 FROM bar +` + +func (q *Queries) Equal(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, equal) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThan = `-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar +` + +func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, greaterThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar +` + +func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, greaterThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThan = `-- name: LessThan :many +SELECT count(*) < 0 FROM bar +` + +func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, lessThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThanOrEqual = `-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar +` + +func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, lessThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const notEqual = `-- name: NotEqual :many +SELECT count(*) != 0 FROM bar +` + +func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.Query(ctx, notEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..8763edaa62 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql @@ -0,0 +1,26 @@ +-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar; + +-- name: LessThan :many +SELECT count(*) < 0 FROM bar; + +-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar; + +-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar; + +-- name: NotEqual :many +SELECT count(*) != 0 FROM bar; + +-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar; + +-- name: Equal :many +SELECT count(*) = 0 FROM bar; + + + + + + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..a690d83cb5 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/comparisons/postgresql/query.sql b/internal/endtoend/testdata/comparisons/postgresql/query.sql deleted file mode 100644 index 3c609f4660..0000000000 --- a/internal/endtoend/testdata/comparisons/postgresql/query.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - --- name: GreaterThan :many -SELECT count(*) > 0 FROM bar; - --- name: LessThan :many -SELECT count(*) < 0 FROM bar; - --- name: GreaterThanOrEqual :many -SELECT count(*) >= 0 FROM bar; - --- name: LessThanOrEqual :many -SELECT count(*) <= 0 FROM bar; - --- name: NotEqual :many -SELECT count(*) != 0 FROM bar; - --- name: AlsoNotEqual :many -SELECT count(*) <> 0 FROM bar; - --- name: Equal :many -SELECT count(*) = 0 FROM bar; - - - - - - diff --git a/internal/endtoend/testdata/comparisons/postgresql/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/sqlc.json deleted file mode 100644 index ba0ecf07f3..0000000000 --- a/internal/endtoend/testdata/comparisons/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "engine": "postgresql", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/comparisons/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..039e8ac630 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,199 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const alsoNotEqual = `-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar +` + +func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, alsoNotEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const equal = `-- name: Equal :many +SELECT count(*) = 0 FROM bar +` + +func (q *Queries) Equal(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, equal) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThan = `-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar +` + +func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, greaterThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar +` + +func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThan = `-- name: LessThan :many +SELECT count(*) < 0 FROM bar +` + +func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, lessThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThanOrEqual = `-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar +` + +func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, lessThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const notEqual = `-- name: NotEqual :many +SELECT count(*) != 0 FROM bar +` + +func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, notEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + 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/comparisons/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..8763edaa62 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql @@ -0,0 +1,26 @@ +-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar; + +-- name: LessThan :many +SELECT count(*) < 0 FROM bar; + +-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar; + +-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar; + +-- name: NotEqual :many +SELECT count(*) != 0 FROM bar; + +-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar; + +-- name: Equal :many +SELECT count(*) = 0 FROM bar; + + + + + + diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..3a3e2e510a --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/db.go b/internal/endtoend/testdata/comparisons/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/comparisons/sqlite/go/models.go b/internal/endtoend/testdata/comparisons/sqlite/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..039e8ac630 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go @@ -0,0 +1,199 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const alsoNotEqual = `-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar +` + +func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, alsoNotEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const equal = `-- name: Equal :many +SELECT count(*) = 0 FROM bar +` + +func (q *Queries) Equal(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, equal) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThan = `-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar +` + +func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, greaterThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar +` + +func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThan = `-- name: LessThan :many +SELECT count(*) < 0 FROM bar +` + +func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, lessThan) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lessThanOrEqual = `-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar +` + +func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, lessThanOrEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const notEqual = `-- name: NotEqual :many +SELECT count(*) != 0 FROM bar +` + +func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, notEqual) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + 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/comparisons/sqlite/query.sql b/internal/endtoend/testdata/comparisons/sqlite/query.sql new file mode 100644 index 0000000000..8763edaa62 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/query.sql @@ -0,0 +1,26 @@ +-- name: GreaterThan :many +SELECT count(*) > 0 FROM bar; + +-- name: LessThan :many +SELECT count(*) < 0 FROM bar; + +-- name: GreaterThanOrEqual :many +SELECT count(*) >= 0 FROM bar; + +-- name: LessThanOrEqual :many +SELECT count(*) <= 0 FROM bar; + +-- name: NotEqual :many +SELECT count(*) != 0 FROM bar; + +-- name: AlsoNotEqual :many +SELECT count(*) <> 0 FROM bar; + +-- name: Equal :many +SELECT count(*) = 0 FROM bar; + + + + + + diff --git a/internal/endtoend/testdata/comparisons/sqlite/schema.sql b/internal/endtoend/testdata/comparisons/sqlite/schema.sql new file mode 100644 index 0000000000..d45d58f0e0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id integer not null primary key autoincrement); + diff --git a/internal/endtoend/testdata/comparisons/sqlite/sqlc.json b/internal/endtoend/testdata/comparisons/sqlite/sqlc.json new file mode 100644 index 0000000000..2c041d7765 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/composite_type/go/db.go b/internal/endtoend/testdata/composite_type/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/composite_type/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/composite_type/go/models.go b/internal/endtoend/testdata/composite_type/go/models.go deleted file mode 100644 index f2ebcd2576..0000000000 --- a/internal/endtoend/testdata/composite_type/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type FooPath struct { - PointOne sql.NullString - PointTwo sql.NullString -} diff --git a/internal/endtoend/testdata/composite_type/go/query.sql.go b/internal/endtoend/testdata/composite_type/go/query.sql.go deleted file mode 100644 index fdc5cf1771..0000000000 --- a/internal/endtoend/testdata/composite_type/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listPaths = `-- name: ListPaths :many -SELECT point_one, point_two FROM foo.paths -` - -func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { - rows, err := q.db.QueryContext(ctx, listPaths) - if err != nil { - return nil, err - } - defer rows.Close() - var items []FooPath - for rows.Next() { - var i FooPath - if err := rows.Scan(&i.PointOne, &i.PointTwo); 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/composite_type/pgx/v4/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/composite_type/pgx/v4/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go new file mode 100644 index 0000000000..6ed24d1fa0 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FooPath struct { + PointOne sql.NullString + PointTwo sql.NullString +} 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 new file mode 100644 index 0000000000..1c12c60296 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listPaths = `-- name: ListPaths :many +SELECT point_one, point_two FROM foo.paths +` + +func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { + rows, err := q.db.Query(ctx, listPaths) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FooPath + for rows.Next() { + var i FooPath + if err := rows.Scan(&i.PointOne, &i.PointTwo); 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/composite_type/pgx/v4/query.sql b/internal/endtoend/testdata/composite_type/pgx/v4/query.sql new file mode 100644 index 0000000000..dc1cf9ed54 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListPaths :many +SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql b/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json b/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/composite_type/pgx/v5/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go new file mode 100644 index 0000000000..6ed24d1fa0 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FooPath struct { + PointOne sql.NullString + PointTwo sql.NullString +} 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 new file mode 100644 index 0000000000..1c12c60296 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listPaths = `-- name: ListPaths :many +SELECT point_one, point_two FROM foo.paths +` + +func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { + rows, err := q.db.Query(ctx, listPaths) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FooPath + for rows.Next() { + var i FooPath + if err := rows.Scan(&i.PointOne, &i.PointTwo); 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/composite_type/pgx/v5/query.sql b/internal/endtoend/testdata/composite_type/pgx/v5/query.sql new file mode 100644 index 0000000000..dc1cf9ed54 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListPaths :many +SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql b/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json b/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/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/composite_type/query.sql b/internal/endtoend/testdata/composite_type/query.sql deleted file mode 100644 index 8e053a61a2..0000000000 --- a/internal/endtoend/testdata/composite_type/query.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE SCHEMA foo; - -CREATE TYPE point_type AS ( - x integer, - y integer -); - -CREATE TYPE foo.point_type AS ( - x integer, - y integer -); - -CREATE TABLE foo.paths ( - point_one point_type, - point_two foo.point_type -); - --- name: ListPaths :many -SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/sqlc.json b/internal/endtoend/testdata/composite_type/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/composite_type/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/db.go b/internal/endtoend/testdata/composite_type/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/composite_type/stdlib/go/models.go b/internal/endtoend/testdata/composite_type/stdlib/go/models.go new file mode 100644 index 0000000000..6ed24d1fa0 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FooPath struct { + PointOne sql.NullString + PointTwo sql.NullString +} diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go new file mode 100644 index 0000000000..a21cb4bfdb --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listPaths = `-- name: ListPaths :many +SELECT point_one, point_two FROM foo.paths +` + +func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { + rows, err := q.db.QueryContext(ctx, listPaths) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FooPath + for rows.Next() { + var i FooPath + if err := rows.Scan(&i.PointOne, &i.PointTwo); 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/composite_type/stdlib/query.sql b/internal/endtoend/testdata/composite_type/stdlib/query.sql new file mode 100644 index 0000000000..dc1cf9ed54 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListPaths :many +SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/stdlib/schema.sql b/internal/endtoend/testdata/composite_type/stdlib/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/stdlib/sqlc.json b/internal/endtoend/testdata/composite_type/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/conflicted_arg_name/postgresql/db/models.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go new file mode 100644 index 0000000000..5b44f5b1ae --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "time" + + "github.com/google/uuid" +) + +type Foo struct { + Time time.Time + Time2 time.Time + Uuid uuid.UUID + Uuid2 uuid.UUID +} 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 new file mode 100644 index 0000000000..85ba941f35 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const time2ByTime = `-- name: Time2ByTime :one +SELECT time2 FROM foo WHERE time=$1 +` + +func (q *Queries) Time2ByTime(ctx context.Context, argTime time.Time) (time.Time, error) { + row := q.db.QueryRowContext(ctx, time2ByTime, argTime) + var time2 time.Time + err := row.Scan(&time2) + return time2, err +} + +const uuid2ByUuid = `-- name: Uuid2ByUuid :one +SELECT uuid2 FROM foo WHERE uuid=$1 +` + +func (q *Queries) Uuid2ByUuid(ctx context.Context, argUuid uuid.UUID) (uuid.UUID, error) { + row := q.db.QueryRowContext(ctx, uuid2ByUuid, argUuid) + var uuid2 uuid.UUID + err := row.Scan(&uuid2) + return uuid2, err +} diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql b/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql new file mode 100644 index 0000000000..d9e4446876 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: Time2ByTime :one +SELECT time2 FROM foo WHERE time=$1; + +-- name: Uuid2ByUuid :one +SELECT uuid2 FROM foo WHERE uuid=$1; diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql b/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql new file mode 100644 index 0000000000..2d3521f784 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + time date NOT NULL, + time2 date NOT NULL, + uuid uuid NOT NULL, + uuid2 uuid NOT NULL +); + diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json b/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json new file mode 100644 index 0000000000..2a46100899 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go new file mode 100644 index 0000000000..7011f902d0 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go @@ -0,0 +1,88 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + "database/sql" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForInsertSingleValue uint32 = 1 + +func convertRowsForInsertSingleValue(w *io.PipeWriter, a []sql.NullString) { + e := mysqltsv.NewEncoder(w, 1, nil) + for _, row := range a { + e.AppendValue(row) + } + 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, a []sql.NullString) (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, a) + // 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() +} + +var readerHandlerSequenceForInsertValues uint32 = 1 + +func convertRowsForInsertValues(w *io.PipeWriter, arg []InsertValuesParams) { + e := mysqltsv.NewEncoder(w, 4, nil) + for _, row := range arg { + e.AppendValue(row.A) + e.AppendValue(row.B) + e.AppendValue(row.C) + e.AppendValue(row.D) + } + w.CloseWithError(e.Close()) +} + +// InsertValues 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) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("InsertValues_%d", atomic.AddUint32(&readerHandlerSequenceForInsertValues, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForInsertValues(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, c, d)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/db.go b/internal/endtoend/testdata/copyfrom/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mysql/go/models.go b/internal/endtoend/testdata/copyfrom/mysql/go/models.go new file mode 100644 index 0000000000..f8aabf5067 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 + C sql.NullTime + D sql.NullTime +} diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go new file mode 100644 index 0000000000..730ffecd49 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +const insertSingleValue = `-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?) +` + +const insertValues = `-- name: InsertValues :copyfrom +INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 + C sql.NullTime + D sql.NullTime +} diff --git a/internal/endtoend/testdata/copyfrom/mysql/query.sql b/internal/endtoend/testdata/copyfrom/mysql/query.sql new file mode 100644 index 0000000000..4c5fd5f54c --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: InsertValues :copyfrom +INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?); + +-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?); diff --git a/internal/endtoend/testdata/copyfrom/mysql/schema.sql b/internal/endtoend/testdata/copyfrom/mysql/schema.sql new file mode 100644 index 0000000000..e447086c56 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer, c DATETIME, d DATE); + diff --git a/internal/endtoend/testdata/copyfrom/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/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/copyfrom/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go new file mode 100644 index 0000000000..62f36b2dd4 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go @@ -0,0 +1,78 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + "database/sql" +) + +// iteratorForInsertSingleValue implements pgx.CopyFromSource. +type iteratorForInsertSingleValue struct { + rows []sql.NullString + skippedFirstNextCall bool +} + +func (r *iteratorForInsertSingleValue) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertSingleValue) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForInsertSingleValue) Err() error { + return nil +} + +// InsertSingleValue inserts a single value using copy. +func (q *Queries) InsertSingleValue(ctx context.Context, a []sql.NullString) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a"}, &iteratorForInsertSingleValue{rows: a}) +} + +// iteratorForInsertValues implements pgx.CopyFromSource. +type iteratorForInsertValues struct { + rows []InsertValuesParams + skippedFirstNextCall bool +} + +func (r *iteratorForInsertValues) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertValues) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].A, + r.rows[0].B, + }, nil +} + +func (r iteratorForInsertValues) Err() error { + return nil +} + +// InsertValues inserts multiple values using copy. +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a", "b"}, &iteratorForInsertValues{rows: arg}) +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..060bdb6aa5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f0e5a24373 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type MyschemaFoo struct { + A sql.NullString + B sql.NullInt32 +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go new file mode 100644 index 0000000000..bd6afe1e9f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type Querier interface { + // InsertSingleValue inserts a single value using copy. + InsertSingleValue(ctx context.Context, a []sql.NullString) (int64, error) + // InsertValues inserts multiple values using copy. + InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..b48a3b26eb --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..8c9aa00ee8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql @@ -0,0 +1,7 @@ +-- name: InsertValues :copyfrom +-- InsertValues inserts multiple values using copy. +INSERT INTO myschema.foo (a, b) VALUES ($1, $2); + +-- name: InsertSingleValue :copyfrom +-- InsertSingleValue inserts a single value using copy. +INSERT INTO myschema.foo (a) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/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_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go new file mode 100644 index 0000000000..d013e204cf --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go @@ -0,0 +1,79 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +// iteratorForInsertSingleValue implements pgx.CopyFromSource. +type iteratorForInsertSingleValue struct { + rows []pgtype.Text + skippedFirstNextCall bool +} + +func (r *iteratorForInsertSingleValue) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertSingleValue) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForInsertSingleValue) Err() error { + return nil +} + +// InsertSingleValue inserts a single value using copy. +func (q *Queries) InsertSingleValue(ctx context.Context, a []pgtype.Text) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a"}, &iteratorForInsertSingleValue{rows: a}) +} + +// iteratorForInsertValues implements pgx.CopyFromSource. +type iteratorForInsertValues struct { + rows []InsertValuesParams + skippedFirstNextCall bool +} + +func (r *iteratorForInsertValues) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertValues) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].A, + r.rows[0].B, + }, nil +} + +func (r iteratorForInsertValues) Err() error { + return nil +} + +// InsertValues inserts multiple values using copy. +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a", "b"}, &iteratorForInsertValues{rows: arg}) +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..9243b4b89a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7226216da5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type MyschemaFoo struct { + A pgtype.Text + B pgtype.Int4 +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go new file mode 100644 index 0000000000..e64286494d --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +type Querier interface { + // InsertSingleValue inserts a single value using copy. + InsertSingleValue(ctx context.Context, a []pgtype.Text) (int64, error) + // InsertValues inserts multiple values using copy. + InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..9f474061dd --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..8c9aa00ee8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql @@ -0,0 +1,7 @@ +-- name: InsertValues :copyfrom +-- InsertValues inserts multiple values using copy. +INSERT INTO myschema.foo (a, b) VALUES ($1, $2); + +-- name: InsertSingleValue :copyfrom +-- InsertSingleValue inserts a single value using copy. +INSERT INTO myschema.foo (a) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..3d0ea89eb3 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForInsertValues implements pgx.CopyFromSource. +type iteratorForInsertValues struct { + rows []InsertValuesParams + skippedFirstNextCall bool +} + +func (r *iteratorForInsertValues) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertValues) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].A, + r.rows[0].B, + }, nil +} + +func (r iteratorForInsertValues) Err() error { + return nil +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a", "b"}, &iteratorForInsertValues{rows: arg}) +} 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 new file mode 100644 index 0000000000..060bdb6aa5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f0e5a24373 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type MyschemaFoo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..69714fb64d --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/jackc/pgconn" +) + +const deleteValues = `-- name: DeleteValues :execresult +DELETE +FROM myschema.foo +` + +func (q *Queries) DeleteValues(ctx context.Context) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, deleteValues) +} + +const insertSingleValue = `-- name: InsertSingleValue :exec +INSERT INTO myschema.foo (a) VALUES ($1) +` + +func (q *Queries) InsertSingleValue(ctx context.Context, a sql.NullString) error { + _, err := q.db.Exec(ctx, insertSingleValue, a) + return err +} + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..7b7f2bbe90 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql @@ -0,0 +1,9 @@ +-- name: InsertValues :copyfrom +INSERT INTO myschema.foo (a, b) VALUES ($1, $2); + +-- name: InsertSingleValue :exec +INSERT INTO myschema.foo (a) VALUES ($1); + +-- name: DeleteValues :execresult +DELETE +FROM myschema.foo; diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..3d0ea89eb3 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForInsertValues implements pgx.CopyFromSource. +type iteratorForInsertValues struct { + rows []InsertValuesParams + skippedFirstNextCall bool +} + +func (r *iteratorForInsertValues) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForInsertValues) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].A, + r.rows[0].B, + }, nil +} + +func (r iteratorForInsertValues) Err() error { + return nil +} + +func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"myschema", "foo"}, []string{"a", "b"}, &iteratorForInsertValues{rows: arg}) +} 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 new file mode 100644 index 0000000000..9243b4b89a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7226216da5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type MyschemaFoo struct { + A pgtype.Text + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..33ce4a1458 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" +) + +const deleteValues = `-- name: DeleteValues :execresult +DELETE +FROM myschema.foo +` + +func (q *Queries) DeleteValues(ctx context.Context) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, deleteValues) +} + +const insertSingleValue = `-- name: InsertSingleValue :exec +INSERT INTO myschema.foo (a) VALUES ($1) +` + +func (q *Queries) InsertSingleValue(ctx context.Context, a pgtype.Text) error { + _, err := q.db.Exec(ctx, insertSingleValue, a) + return err +} + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..7b7f2bbe90 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql @@ -0,0 +1,9 @@ +-- name: InsertValues :copyfrom +INSERT INTO myschema.foo (a, b) VALUES ($1, $2); + +-- name: InsertSingleValue :exec +INSERT INTO myschema.foo (a) VALUES ($1); + +-- name: DeleteValues :execresult +DELETE +FROM myschema.foo; diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/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/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..7baf05c8ab --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..de35bade9f --- /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.30.0 + +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..987547dff5 --- /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.30.0 +// 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/issue.md b/internal/endtoend/testdata/copyfrom_named_params/issue.md new file mode 100644 index 0000000000..6d030f18f9 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2833 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 new file mode 100644 index 0000000000..99466c2d2e --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForStageUserData implements pgx.CopyFromSource. +type iteratorForStageUserData struct { + rows []StageUserDataParams + skippedFirstNextCall bool +} + +func (r *iteratorForStageUserData) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForStageUserData) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].IDParam, + r.rows[0].UserParam, + }, nil +} + +func (r iteratorForStageUserData) Err() error { + return nil +} + +func (q *Queries) StageUserData(ctx context.Context, arg []StageUserDataParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user_data"}, []string{"id", "user"}, &iteratorForStageUserData{rows: arg}) +} 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 new file mode 100644 index 0000000000..9243b4b89a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom_named_params/postgresql/pgx/go/models.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f19c58e317 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..94994f8fe9 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +type StageUserDataParams struct { + IDParam string + UserParam string +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql new file mode 100644 index 0000000000..0a2c750845 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: StageUserData :copyfrom +insert into "user_data" ("id", "user") +values ( + sqlc.arg('id_param'), + sqlc.arg('user_param') +); diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..87d16b404b --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +create table "user_data" ( + "id" varchar not null, + "user" varchar not null, + primary key ("id") +); diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/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/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go new file mode 100644 index 0000000000..76754b4c2f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForCreateAuthors implements pgx.CopyFromSource. +type iteratorForCreateAuthors struct { + rows []int32 + skippedFirstNextCall bool +} + +func (r *iteratorForCreateAuthors) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForCreateAuthors) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForCreateAuthors) Err() error { + return nil +} + +func (q *Queries) CreateAuthors(ctx context.Context, authorID []int32) (int64, error) { + return q.db.CopyFrom(ctx, []string{"authors"}, []string{"author_id"}, &iteratorForCreateAuthors{rows: authorID}) +} 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 new file mode 100644 index 0000000000..060bdb6aa5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..188bf74be1 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c7d4e8c0f8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + CreateAuthors(ctx context.Context, authorID []int32) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..77f99802ec --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: CreateAuthors :copyfrom +INSERT INTO authors (author_id) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..634d49230f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + author_id SERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..76754b4c2f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForCreateAuthors implements pgx.CopyFromSource. +type iteratorForCreateAuthors struct { + rows []int32 + skippedFirstNextCall bool +} + +func (r *iteratorForCreateAuthors) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForCreateAuthors) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForCreateAuthors) Err() error { + return nil +} + +func (q *Queries) CreateAuthors(ctx context.Context, authorID []int32) (int64, error) { + return q.db.CopyFrom(ctx, []string{"authors"}, []string{"author_id"}, &iteratorForCreateAuthors{rows: authorID}) +} 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 new file mode 100644 index 0000000000..9243b4b89a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +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/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..188bf74be1 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c7d4e8c0f8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + CreateAuthors(ctx context.Context, authorID []int32) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..77f99802ec --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: CreateAuthors :copyfrom +INSERT INTO authors (author_id) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..634d49230f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + author_id SERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/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_interface": true + } + ] +} 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..7b5e8e4a32 --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..ef22c3818c --- /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.30.0 + +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..133d1b64ed --- /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.30.0 +// 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/count_star/mysql/go/db.go b/internal/endtoend/testdata/count_star/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/db.go +++ b/internal/endtoend/testdata/count_star/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/mysql/go/models.go b/internal/endtoend/testdata/count_star/mysql/go/models.go index 18039acde9..65820844a6 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/models.go +++ b/internal/endtoend/testdata/count_star/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + 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 575b4913f9..de91b29d08 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/mysql/query.sql b/internal/endtoend/testdata/count_star/mysql/query.sql index 5f608a69b5..6cba4363c5 100644 --- a/internal/endtoend/testdata/count_star/mysql/query.sql +++ b/internal/endtoend/testdata/count_star/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: CountStarLower :one SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/mysql/schema.sql b/internal/endtoend/testdata/count_star/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/mysql/sqlc.json b/internal/endtoend/testdata/count_star/mysql/sqlc.json index c02fc9b4cb..b45b90329b 100644 --- a/internal/endtoend/testdata/count_star/mysql/sqlc.json +++ b/internal/endtoend/testdata/count_star/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/count_star/postgresql/go/db.go b/internal/endtoend/testdata/count_star/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/count_star/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/count_star/postgresql/go/models.go b/internal/endtoend/testdata/count_star/postgresql/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/count_star/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/count_star/postgresql/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/go/query.sql.go deleted file mode 100644 index 575b4913f9..0000000000 --- a/internal/endtoend/testdata/count_star/postgresql/go/query.sql.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const countStarLower = `-- name: CountStarLower :one -SELECT count(*) FROM bar -` - -func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarLower) - var count int64 - err := row.Scan(&count) - return count, err -} - -const countStarUpper = `-- name: CountStarUpper :one -SELECT COUNT(*) FROM bar -` - -func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarUpper) - var count int64 - err := row.Scan(&count) - return count, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/count_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2f3daa3ac0 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const countStarLower = `-- name: CountStarLower :one +SELECT count(*) FROM bar +` + +func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, countStarLower) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countStarUpper = `-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar +` + +func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, countStarUpper) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6cba4363c5 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: CountStarLower :one +SELECT count(*) FROM bar; + +-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..afdff35e59 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v4", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/count_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2f3daa3ac0 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const countStarLower = `-- name: CountStarLower :one +SELECT count(*) FROM bar +` + +func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, countStarLower) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countStarUpper = `-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar +` + +func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, countStarUpper) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6cba4363c5 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: CountStarLower :one +SELECT count(*) FROM bar; + +-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..a690d83cb5 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/count_star/postgresql/query.sql b/internal/endtoend/testdata/count_star/postgresql/query.sql deleted file mode 100644 index 5f608a69b5..0000000000 --- a/internal/endtoend/testdata/count_star/postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: CountStarLower :one -SELECT count(*) FROM bar; - --- name: CountStarUpper :one -SELECT COUNT(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/sqlc.json deleted file mode 100644 index ba0ecf07f3..0000000000 --- a/internal/endtoend/testdata/count_star/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "engine": "postgresql", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/count_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..de91b29d08 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const countStarLower = `-- name: CountStarLower :one +SELECT count(*) FROM bar +` + +func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, countStarLower) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countStarUpper = `-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar +` + +func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, countStarUpper) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql b/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6cba4363c5 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: CountStarLower :one +SELECT count(*) FROM bar; + +-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..3a3e2e510a --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/count_star/sqlite/go/db.go b/internal/endtoend/testdata/count_star/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/count_star/sqlite/go/models.go b/internal/endtoend/testdata/count_star/sqlite/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..de91b29d08 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const countStarLower = `-- name: CountStarLower :one +SELECT count(*) FROM bar +` + +func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, countStarLower) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countStarUpper = `-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar +` + +func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, countStarUpper) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/count_star/sqlite/query.sql b/internal/endtoend/testdata/count_star/sqlite/query.sql new file mode 100644 index 0000000000..6cba4363c5 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: CountStarLower :one +SELECT count(*) FROM bar; + +-- name: CountStarUpper :one +SELECT COUNT(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/sqlite/schema.sql b/internal/endtoend/testdata/count_star/sqlite/schema.sql new file mode 100644 index 0000000000..0fe4a93639 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id BIGINT not null); diff --git a/internal/endtoend/testdata/count_star/sqlite/sqlc.json b/internal/endtoend/testdata/count_star/sqlite/sqlc.json new file mode 100644 index 0000000000..9655954bd4 --- /dev/null +++ b/internal/endtoend/testdata/count_star/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_materialized_view/postgresql/go/models.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go new file mode 100644 index 0000000000..ef71ea2fe9 --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Foo struct { + Val string +} + +type MatFirstView 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 new file mode 100644 index 0000000000..4e81626c20 --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getFirst = `-- name: GetFirst :many +SELECT val FROM mat_first_view +` + +func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getFirst) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var val string + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + 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_materialized_view/postgresql/query.sql b/internal/endtoend/testdata/create_materialized_view/postgresql/query.sql new file mode 100644 index 0000000000..0c86bfde56 --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: GetFirst :many +SELECT * FROM mat_first_view; + diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/schema.sql b/internal/endtoend/testdata/create_materialized_view/postgresql/schema.sql new file mode 100644 index 0000000000..fc0c213b6b --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (val text not null); + +CREATE MATERIALIZED VIEW mat_first_view AS SELECT * FROM foo; diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/sqlc.json b/internal/endtoend/testdata/create_materialized_view/postgresql/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/create_materialized_view/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/create_table_as/postgresql/go/db.go b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_table_as/postgresql/go/models.go b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go new file mode 100644 index 0000000000..342b0365d1 --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Foo struct { + Val string +} + +type SecondTable 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 new file mode 100644 index 0000000000..e5b7ce3617 --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getFirst = `-- name: GetFirst :many +SELECT val FROM second_table +` + +func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getFirst) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var val string + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + 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_table_as/postgresql/query.sql b/internal/endtoend/testdata/create_table_as/postgresql/query.sql new file mode 100644 index 0000000000..c2861a6151 --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: GetFirst :many +SELECT * FROM second_table; + diff --git a/internal/endtoend/testdata/create_table_as/postgresql/schema.sql b/internal/endtoend/testdata/create_table_as/postgresql/schema.sql new file mode 100644 index 0000000000..deace97a86 --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (val text not null); + +CREATE TABLE second_table AS SELECT * FROM foo; diff --git a/internal/endtoend/testdata/create_table_as/postgresql/sqlc.json b/internal/endtoend/testdata/create_table_as/postgresql/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/create_table_as/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/create_table_like/mysql/go/db.go b/internal/endtoend/testdata/create_table_like/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/db.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 bf3dc0328a..6bf0efbef0 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/models.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 b362444841..850a585294 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_table_like/postgresql/go/models.go b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go new file mode 100644 index 0000000000..6bf0efbef0 --- /dev/null +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type SuperUser struct { + ID int32 + FirstName string + LastName sql.NullString + DateOfBirth sql.NullTime +} + +type User struct { + ID int32 + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..850a585294 --- /dev/null +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, date_of_birth FROM super_users +` + +func (q *Queries) GetAll(ctx context.Context) ([]SuperUser, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SuperUser + for rows.Next() { + var i SuperUser + if err := rows.Scan( + &i.ID, + &i.FirstName, + &i.LastName, + &i.DateOfBirth, + ); 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_table_like/postgresql/query.sql b/internal/endtoend/testdata/create_table_like/postgresql/query.sql new file mode 100644 index 0000000000..c503d7816f --- /dev/null +++ b/internal/endtoend/testdata/create_table_like/postgresql/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM super_users; diff --git a/internal/endtoend/testdata/create_table_like/postgresql/schema.sql b/internal/endtoend/testdata/create_table_like/postgresql/schema.sql new file mode 100644 index 0000000000..131a309cb1 --- /dev/null +++ b/internal/endtoend/testdata/create_table_like/postgresql/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE users ( + id serial NOT NULL PRIMARY KEY, + first_name varchar(255) NOT NULL +); + +ALTER TABLE users + ADD COLUMN last_name varchar(255); + +CREATE TABLE super_users ( LIKE users ); + +ALTER TABLE users + ADD COLUMN age integer NOT NULL; + +ALTER TABLE users + DROP COLUMN first_name; + +ALTER TABLE super_users + ADD COLUMN date_of_birth TIMESTAMP; diff --git a/internal/endtoend/testdata/select_star/postgresql/sqlc.json b/internal/endtoend/testdata/create_table_like/postgresql/sqlc.json similarity index 100% rename from internal/endtoend/testdata/select_star/postgresql/sqlc.json rename to internal/endtoend/testdata/create_table_like/postgresql/sqlc.json diff --git a/internal/endtoend/testdata/create_view/mysql/go/db.go b/internal/endtoend/testdata/create_view/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_view/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mysql/go/models.go b/internal/endtoend/testdata/create_view/mysql/go/models.go new file mode 100644 index 0000000000..ff7893834a --- /dev/null +++ b/internal/endtoend/testdata/create_view/mysql/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FirstView struct { + Val string +} + +type Foo struct { + Val string + Val2 sql.NullInt32 +} + +type SecondView struct { + Val string + Val2 sql.NullInt32 +} diff --git a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go new file mode 100644 index 0000000000..8f9c3c7c1a --- /dev/null +++ b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getFirst = `-- name: GetFirst :many +SELECT val FROM first_view +` + +func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getFirst) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var val string + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getSecond = `-- name: GetSecond :many +SELECT val, val2 FROM second_view WHERE val2 = $1 +` + +func (q *Queries) GetSecond(ctx context.Context) ([]SecondView, error) { + rows, err := q.db.QueryContext(ctx, getSecond) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SecondView + for rows.Next() { + var i SecondView + if err := rows.Scan(&i.Val, &i.Val2); 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/mysql/query.sql b/internal/endtoend/testdata/create_view/mysql/query.sql new file mode 100644 index 0000000000..1063db8740 --- /dev/null +++ b/internal/endtoend/testdata/create_view/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: GetFirst :many +SELECT * FROM first_view; + +-- name: GetSecond :many +SELECT * FROM second_view WHERE val2 = $1; diff --git a/internal/endtoend/testdata/create_view/mysql/schema.sql b/internal/endtoend/testdata/create_view/mysql/schema.sql new file mode 100644 index 0000000000..3f94440dec --- /dev/null +++ b/internal/endtoend/testdata/create_view/mysql/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE foo (val text not null); + +CREATE VIEW first_view AS SELECT * FROM foo; +CREATE VIEW second_view AS SELECT * FROM foo; +CREATE VIEW third_view AS SELECT * FROM foo; + +ALTER TABLE foo ADD COLUMN val2 integer; +CREATE OR REPLACE VIEW second_view AS SELECT * FROM foo; + +DROP VIEW third_view; diff --git a/internal/endtoend/testdata/create_view/mysql/sqlc.json b/internal/endtoend/testdata/create_view/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/create_view/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/create_view/postgresql/go/db.go b/internal/endtoend/testdata/create_view/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_view/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/go/models.go b/internal/endtoend/testdata/create_view/postgresql/go/models.go new file mode 100644 index 0000000000..ff7893834a --- /dev/null +++ b/internal/endtoend/testdata/create_view/postgresql/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FirstView struct { + Val string +} + +type Foo struct { + Val string + Val2 sql.NullInt32 +} + +type SecondView struct { + Val string + Val2 sql.NullInt32 +} diff --git a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go new file mode 100644 index 0000000000..65aa0b1479 --- /dev/null +++ b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getFirst = `-- name: GetFirst :many +SELECT val FROM first_view +` + +func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getFirst) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var val string + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getSecond = `-- name: GetSecond :many +SELECT val, val2 FROM second_view WHERE val2 = $1 +` + +func (q *Queries) GetSecond(ctx context.Context, val2 sql.NullInt32) ([]SecondView, error) { + rows, err := q.db.QueryContext(ctx, getSecond, val2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SecondView + for rows.Next() { + var i SecondView + if err := rows.Scan(&i.Val, &i.Val2); 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/postgresql/query.sql b/internal/endtoend/testdata/create_view/postgresql/query.sql new file mode 100644 index 0000000000..1063db8740 --- /dev/null +++ b/internal/endtoend/testdata/create_view/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: GetFirst :many +SELECT * FROM first_view; + +-- name: GetSecond :many +SELECT * FROM second_view WHERE val2 = $1; diff --git a/internal/endtoend/testdata/create_view/postgresql/schema.sql b/internal/endtoend/testdata/create_view/postgresql/schema.sql new file mode 100644 index 0000000000..3f94440dec --- /dev/null +++ b/internal/endtoend/testdata/create_view/postgresql/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE foo (val text not null); + +CREATE VIEW first_view AS SELECT * FROM foo; +CREATE VIEW second_view AS SELECT * FROM foo; +CREATE VIEW third_view AS SELECT * FROM foo; + +ALTER TABLE foo ADD COLUMN val2 integer; +CREATE OR REPLACE VIEW second_view AS SELECT * FROM foo; + +DROP VIEW third_view; diff --git a/internal/endtoend/testdata/create_view/postgresql/sqlc.json b/internal/endtoend/testdata/create_view/postgresql/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/create_view/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/create_view/sqlite/go/db.go b/internal/endtoend/testdata/create_view/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/create_view/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/create_view/sqlite/go/models.go new file mode 100644 index 0000000000..681d1840a6 --- /dev/null +++ b/internal/endtoend/testdata/create_view/sqlite/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FirstView struct { + Val string +} + +type Foo struct { + Val string + Val2 sql.NullInt64 +} + +type SecondView struct { + Val string + Val2 sql.NullInt64 +} diff --git a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go new file mode 100644 index 0000000000..f7b6baa8db --- /dev/null +++ b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getFirst = `-- name: GetFirst :many +SELECT val FROM first_view +` + +func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getFirst) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var val string + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getSecond = `-- name: GetSecond :many +SELECT val, val2 FROM second_view WHERE val2 = ? +` + +func (q *Queries) GetSecond(ctx context.Context, val2 sql.NullInt64) ([]SecondView, error) { + rows, err := q.db.QueryContext(ctx, getSecond, val2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SecondView + for rows.Next() { + var i SecondView + if err := rows.Scan(&i.Val, &i.Val2); 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/sqlite/query.sql b/internal/endtoend/testdata/create_view/sqlite/query.sql new file mode 100644 index 0000000000..c94fc58556 --- /dev/null +++ b/internal/endtoend/testdata/create_view/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: GetFirst :many +SELECT * FROM first_view; + +-- name: GetSecond :many +SELECT * FROM second_view WHERE val2 = ?; diff --git a/internal/endtoend/testdata/create_view/sqlite/schema.sql b/internal/endtoend/testdata/create_view/sqlite/schema.sql new file mode 100644 index 0000000000..246f73e0b7 --- /dev/null +++ b/internal/endtoend/testdata/create_view/sqlite/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo (val text not null); + +CREATE VIEW first_view AS SELECT * FROM foo; +CREATE VIEW second_view AS SELECT * FROM foo; +CREATE VIEW third_view AS SELECT * FROM foo; + +ALTER TABLE foo ADD COLUMN val2 integer; +DROP VIEW second_view; +CREATE VIEW second_view AS SELECT * FROM foo; + +DROP VIEW third_view; diff --git a/internal/endtoend/testdata/create_view/sqlite/sqlc.json b/internal/endtoend/testdata/create_view/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/create_view/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/cte_count/go/db.go b/internal/endtoend/testdata/cte_count/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/cte_count/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/cte_count/go/models.go b/internal/endtoend/testdata/cte_count/go/models.go deleted file mode 100644 index be78cdc955..0000000000 --- a/internal/endtoend/testdata/cte_count/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - Ready bool -} diff --git a/internal/endtoend/testdata/cte_count/go/query.sql.go b/internal/endtoend/testdata/cte_count/go/query.sql.go deleted file mode 100644 index ac42df8584..0000000000 --- a/internal/endtoend/testdata/cte_count/go/query.sql.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const cTECount = `-- name: CTECount :many -WITH all_count AS ( - SELECT count(*) FROM bar -), ready_count AS ( - SELECT count(*) FROM bar WHERE ready = true -) -SELECT all_count.count, ready_count.count -FROM all_count, ready_count -` - -type CTECountRow struct { - Count int64 - Count_2 int64 -} - -func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { - rows, err := q.db.QueryContext(ctx, cTECount) - if err != nil { - return nil, err - } - defer rows.Close() - var items []CTECountRow - for rows.Next() { - var i CTECountRow - if err := rows.Scan(&i.Count, &i.Count_2); 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/cte_count/mysql/go/db.go b/internal/endtoend/testdata/cte_count/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_count/mysql/go/models.go b/internal/endtoend/testdata/cte_count/mysql/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..02370c4c8f --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTECount = `-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count +` + +type CTECountRow struct { + Count int64 + Count_2 int64 +} + +func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { + rows, err := q.db.QueryContext(ctx, cTECount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTECountRow + for rows.Next() { + var i CTECountRow + if err := rows.Scan(&i.Count, &i.Count_2); 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/cte_count/mysql/query.sql b/internal/endtoend/testdata/cte_count/mysql/query.sql new file mode 100644 index 0000000000..9afd2e4935 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/query.sql @@ -0,0 +1,8 @@ +-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count; diff --git a/internal/endtoend/testdata/cte_count/mysql/schema.sql b/internal/endtoend/testdata/cte_count/mysql/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/mysql/sqlc.json b/internal/endtoend/testdata/cte_count/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/cte_count/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/cte_count/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_count/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e8af35fbd1 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTECount = `-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count +` + +type CTECountRow struct { + Count int64 + Count_2 int64 +} + +func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { + rows, err := q.db.Query(ctx, cTECount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTECountRow + for rows.Next() { + var i CTECountRow + if err := rows.Scan(&i.Count, &i.Count_2); 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_count/pgx/v4/query.sql b/internal/endtoend/testdata/cte_count/pgx/v4/query.sql new file mode 100644 index 0000000000..9afd2e4935 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count; diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_count/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e8af35fbd1 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTECount = `-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count +` + +type CTECountRow struct { + Count int64 + Count_2 int64 +} + +func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { + rows, err := q.db.Query(ctx, cTECount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTECountRow + for rows.Next() { + var i CTECountRow + if err := rows.Scan(&i.Count, &i.Count_2); 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_count/pgx/v5/query.sql b/internal/endtoend/testdata/cte_count/pgx/v5/query.sql new file mode 100644 index 0000000000..9afd2e4935 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count; diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/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/cte_count/query.sql b/internal/endtoend/testdata/cte_count/query.sql deleted file mode 100644 index 677f2ed559..0000000000 --- a/internal/endtoend/testdata/cte_count/query.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE bar (ready bool not null); - --- name: CTECount :many -WITH all_count AS ( - SELECT count(*) FROM bar -), ready_count AS ( - SELECT count(*) FROM bar WHERE ready = true -) -SELECT all_count.count, ready_count.count -FROM all_count, ready_count; diff --git a/internal/endtoend/testdata/cte_count/sqlc.json b/internal/endtoend/testdata/cte_count/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/cte_count/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/db.go b/internal/endtoend/testdata/cte_count/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_count/stdlib/go/models.go b/internal/endtoend/testdata/cte_count/stdlib/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..02370c4c8f --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTECount = `-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count +` + +type CTECountRow struct { + Count int64 + Count_2 int64 +} + +func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { + rows, err := q.db.QueryContext(ctx, cTECount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTECountRow + for rows.Next() { + var i CTECountRow + if err := rows.Scan(&i.Count, &i.Count_2); 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/cte_count/stdlib/query.sql b/internal/endtoend/testdata/cte_count/stdlib/query.sql new file mode 100644 index 0000000000..9afd2e4935 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: CTECount :many +WITH all_count AS ( + SELECT count(*) FROM bar +), ready_count AS ( + SELECT count(*) FROM bar WHERE ready = true +) +SELECT all_count.count, ready_count.count +FROM all_count, ready_count; diff --git a/internal/endtoend/testdata/cte_count/stdlib/schema.sql b/internal/endtoend/testdata/cte_count/stdlib/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/stdlib/sqlc.json b/internal/endtoend/testdata/cte_count/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_filter/go/db.go b/internal/endtoend/testdata/cte_filter/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/cte_filter/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/cte_filter/go/models.go b/internal/endtoend/testdata/cte_filter/go/models.go deleted file mode 100644 index be78cdc955..0000000000 --- a/internal/endtoend/testdata/cte_filter/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - Ready bool -} diff --git a/internal/endtoend/testdata/cte_filter/go/query.sql.go b/internal/endtoend/testdata/cte_filter/go/query.sql.go deleted file mode 100644 index 63df7378dc..0000000000 --- a/internal/endtoend/testdata/cte_filter/go/query.sql.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const cTEFilter = `-- name: CTEFilter :many -WITH filter_count AS ( - SELECT count(*) FROM bar WHERE ready = $1 -) -SELECT filter_count.count -FROM filter_count -` - -func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, cTEFilter, ready) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int64 - for rows.Next() { - var count int64 - if err := rows.Scan(&count); err != nil { - return nil, err - } - items = append(items, count) - } - 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/cte_filter/mysql/go/db.go b/internal/endtoend/testdata/cte_filter/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_filter/mysql/go/models.go b/internal/endtoend/testdata/cte_filter/mysql/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fd0e7ce6b2 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTEFilter = `-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = ? +) +SELECT filter_count.count +FROM filter_count +` + +func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, cTEFilter, ready) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var count int64 + if err := rows.Scan(&count); err != nil { + return nil, err + } + items = append(items, count) + } + 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/cte_filter/mysql/query.sql b/internal/endtoend/testdata/cte_filter/mysql/query.sql new file mode 100644 index 0000000000..6fdc7006f9 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/query.sql @@ -0,0 +1,6 @@ +-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = ? +) +SELECT filter_count.count +FROM filter_count; diff --git a/internal/endtoend/testdata/cte_filter/mysql/schema.sql b/internal/endtoend/testdata/cte_filter/mysql/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/mysql/sqlc.json b/internal/endtoend/testdata/cte_filter/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/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/cte_filter/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_filter/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e4c0e1929f --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTEFilter = `-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count +` + +func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { + rows, err := q.db.Query(ctx, cTEFilter, ready) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var count int64 + if err := rows.Scan(&count); err != nil { + return nil, err + } + items = append(items, count) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql b/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql new file mode 100644 index 0000000000..3965e432d7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql @@ -0,0 +1,6 @@ +-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count; diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_filter/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e4c0e1929f --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTEFilter = `-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count +` + +func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { + rows, err := q.db.Query(ctx, cTEFilter, ready) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var count int64 + if err := rows.Scan(&count); err != nil { + return nil, err + } + items = append(items, count) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql b/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql new file mode 100644 index 0000000000..3965e432d7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql @@ -0,0 +1,6 @@ +-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count; diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/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/cte_filter/query.sql b/internal/endtoend/testdata/cte_filter/query.sql deleted file mode 100644 index b2ad9c3c0b..0000000000 --- a/internal/endtoend/testdata/cte_filter/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE bar (ready bool not null); - --- name: CTEFilter :many -WITH filter_count AS ( - SELECT count(*) FROM bar WHERE ready = $1 -) -SELECT filter_count.count -FROM filter_count; diff --git a/internal/endtoend/testdata/cte_filter/sqlc.json b/internal/endtoend/testdata/cte_filter/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/cte_filter/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/db.go b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_filter/stdlib/go/models.go b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go new file mode 100644 index 0000000000..4dc79596a7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..9901a70cda --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTEFilter = `-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count +` + +func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, cTEFilter, ready) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var count int64 + if err := rows.Scan(&count); err != nil { + return nil, err + } + items = append(items, count) + } + 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/cte_filter/stdlib/query.sql b/internal/endtoend/testdata/cte_filter/stdlib/query.sql new file mode 100644 index 0000000000..3965e432d7 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: CTEFilter :many +WITH filter_count AS ( + SELECT count(*) FROM bar WHERE ready = $1 +) +SELECT filter_count.count +FROM filter_count; diff --git a/internal/endtoend/testdata/cte_filter/stdlib/schema.sql b/internal/endtoend/testdata/cte_filter/stdlib/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json b/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_in_delete/mysql/go/models.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go new file mode 100644 index 0000000000..6561330c86 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2c4020efb7 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :exec +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT id FROM ready_ids) +` + +func (q *Queries) DeleteReadyWithCTE(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, deleteReadyWithCTE) + return err +} diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/query.sql b/internal/endtoend/testdata/cte_in_delete/mysql/query.sql new file mode 100644 index 0000000000..fd3db485a5 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: DeleteReadyWithCTE :exec +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT * FROM ready_ids); diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql b/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql new file mode 100644 index 0000000000..ba1fd0f1ae --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json b/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/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/cte_in_delete/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_in_delete/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go new file mode 100644 index 0000000000..6561330c86 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..9a208d5a93 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT id FROM ready_ids) +RETURNING id +` + +func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, deleteReadyWithCTE) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql new file mode 100644 index 0000000000..6a7a16dbfb --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql @@ -0,0 +1,6 @@ +-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT * FROM ready_ids) +RETURNING id; diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_in_delete/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go new file mode 100644 index 0000000000..6561330c86 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..9a208d5a93 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT id FROM ready_ids) +RETURNING id +` + +func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, deleteReadyWithCTE) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql new file mode 100644 index 0000000000..6a7a16dbfb --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql @@ -0,0 +1,6 @@ +-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT * FROM ready_ids) +RETURNING id; diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/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/cte_in_delete/stdlib/go/db.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_in_delete/stdlib/go/models.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go new file mode 100644 index 0000000000..6561330c86 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..80518dd3f6 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT id FROM ready_ids) +RETURNING id +` + +func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, deleteReadyWithCTE) + 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/cte_in_delete/stdlib/query.sql b/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql new file mode 100644 index 0000000000..6a7a16dbfb --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: DeleteReadyWithCTE :many +WITH ready_ids AS ( + SELECT id FROM bar WHERE ready +) +DELETE FROM bar WHERE id IN (SELECT * FROM ready_ids) +RETURNING id; diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql b/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json b/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..333ea43ea3 --- /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.30.0 + +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..5af8af896a --- /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.30.0 +// 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/issue.md b/internal/endtoend/testdata/cte_left_join/issue.md new file mode 100644 index 0000000000..6027f3c6a8 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1236 \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_left_join/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c419896180 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type Fake struct { + ID int64 + Name string + Bio pgtype.Text +} 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 new file mode 100644 index 0000000000..564b33b190 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const badQuery = `-- name: BadQuery :exec +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + name, bio +FROM + q AS c1 +WHERE c1.name = $1 +` + +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_left_join/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/query.sql new file mode 100644 index 0000000000..d201807360 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: BadQuery :exec +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + * +FROM + q AS c1 +WHERE c1.name = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3d2f5be610 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE fake ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/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" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/issue.md b/internal/endtoend/testdata/cte_multiple_alias/issue.md new file mode 100644 index 0000000000..5e4ec565bb --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1237 \ No newline at end of file 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_multiple_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c419896180 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type Fake struct { + ID int64 + Name string + Bio pgtype.Text +} 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 new file mode 100644 index 0000000000..58da3af00e --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const badQuery = `-- name: BadQuery :one +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + c1.name, c1.bio, c2.name, c2.bio +FROM + q AS c1, + q as c2 +` + +type BadQueryRow struct { + Name string + Bio pgtype.Text + Name_2 string + Bio_2 pgtype.Text +} + +func (q *Queries) BadQuery(ctx context.Context) (BadQueryRow, error) { + row := q.db.QueryRow(ctx, badQuery) + var i BadQueryRow + err := row.Scan( + &i.Name, + &i.Bio, + &i.Name_2, + &i.Bio_2, + ) + return i, err +} diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..75d770582f --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: BadQuery :one +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + * +FROM + q AS c1, + q as c2; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3d2f5be610 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE fake ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_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" \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..e4cf9d17ae --- /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.30.0 + +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..638f195915 --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/cte_recursive/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/cte_recursive/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/cte_recursive/go/models.go b/internal/endtoend/testdata/cte_recursive/go/models.go deleted file mode 100644 index 60e84261f5..0000000000 --- a/internal/endtoend/testdata/cte_recursive/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - ID int32 - ParentID sql.NullInt32 -} diff --git a/internal/endtoend/testdata/cte_recursive/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/go/query.sql.go deleted file mode 100644 index 95147c251b..0000000000 --- a/internal/endtoend/testdata/cte_recursive/go/query.sql.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const cTERecursive = `-- name: CTERecursive :many -WITH RECURSIVE cte AS ( - SELECT b.id, b.parent_id FROM bar AS b - WHERE b.id = $1 - UNION ALL - SELECT b.id, b.parent_id - FROM bar AS b, cte AS c - WHERE b.parent_id = c.id -) SELECT id, parent_id FROM cte -` - -type CTERecursiveRow struct { - ID int32 - ParentID sql.NullInt32 -} - -func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { - rows, err := q.db.QueryContext(ctx, cTERecursive, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []CTERecursiveRow - for rows.Next() { - var i CTERecursiveRow - if err := rows.Scan(&i.ID, &i.ParentID); 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/cte_recursive/mysql/go/db.go b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_recursive/mysql/go/models.go b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go new file mode 100644 index 0000000000..66712f9d55 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + ParentID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go new file mode 100644 index 0000000000..ffbdb1c99e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const cTERecursive = `-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.id, b.parent_id FROM bar AS b + WHERE b.id = ? + UNION ALL + SELECT b.id, b.parent_id + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT id, parent_id FROM cte +` + +type CTERecursiveRow struct { + ID int32 + ParentID sql.NullInt32 +} + +func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { + rows, err := q.db.QueryContext(ctx, cTERecursive, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTERecursiveRow + for rows.Next() { + var i CTERecursiveRow + if err := rows.Scan(&i.ID, &i.ParentID); 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/cte_recursive/mysql/query.sql b/internal/endtoend/testdata/cte_recursive/mysql/query.sql new file mode 100644 index 0000000000..a2fa30663c --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/query.sql @@ -0,0 +1,9 @@ +-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.* FROM bar AS b + WHERE b.id = ? + UNION ALL + SELECT b.* + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/cte_recursive/mysql/schema.sql b/internal/endtoend/testdata/cte_recursive/mysql/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json b/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/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/cte_recursive/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go new file mode 100644 index 0000000000..66712f9d55 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + ParentID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..39bff8ef3c --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const cTERecursive = `-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.id, b.parent_id FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.id, b.parent_id + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT id, parent_id FROM cte +` + +type CTERecursiveRow struct { + ID int32 + ParentID sql.NullInt32 +} + +func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { + rows, err := q.db.Query(ctx, cTERecursive, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTERecursiveRow + for rows.Next() { + var i CTERecursiveRow + if err := rows.Scan(&i.ID, &i.ParentID); 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/pgx/v4/query.sql b/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql new file mode 100644 index 0000000000..c18d216d0e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql @@ -0,0 +1,9 @@ +-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.* FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.* + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go new file mode 100644 index 0000000000..e9542cf1ee --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 + ParentID pgtype.Int4 +} 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 new file mode 100644 index 0000000000..84d8605338 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const cTERecursive = `-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.id, b.parent_id FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.id, b.parent_id + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT id, parent_id FROM cte +` + +type CTERecursiveRow struct { + ID int32 + ParentID pgtype.Int4 +} + +func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { + rows, err := q.db.Query(ctx, cTERecursive, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTERecursiveRow + for rows.Next() { + var i CTERecursiveRow + if err := rows.Scan(&i.ID, &i.ParentID); 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/pgx/v5/query.sql b/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql new file mode 100644 index 0000000000..c18d216d0e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql @@ -0,0 +1,9 @@ +-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.* FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.* + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/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/cte_recursive/query.sql b/internal/endtoend/testdata/cte_recursive/query.sql deleted file mode 100644 index 2b1acde317..0000000000 --- a/internal/endtoend/testdata/cte_recursive/query.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE bar (id INT NOT NULL, parent_id INT); - --- name: CTERecursive :many -WITH RECURSIVE cte AS ( - SELECT b.* FROM bar AS b - WHERE b.id = $1 - UNION ALL - SELECT b.* - FROM bar AS b, cte AS c - WHERE b.parent_id = c.id -) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/cte_recursive/sqlc.json b/internal/endtoend/testdata/cte_recursive/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/cte_recursive/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/cte_recursive/stdlib/go/models.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go new file mode 100644 index 0000000000..66712f9d55 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + ParentID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go new file mode 100644 index 0000000000..696ebde8f8 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const cTERecursive = `-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.id, b.parent_id FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.id, b.parent_id + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT id, parent_id FROM cte +` + +type CTERecursiveRow struct { + ID int32 + ParentID sql.NullInt32 +} + +func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { + rows, err := q.db.QueryContext(ctx, cTERecursive, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CTERecursiveRow + for rows.Next() { + var i CTERecursiveRow + if err := rows.Scan(&i.ID, &i.ParentID); 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/cte_recursive/stdlib/query.sql b/internal/endtoend/testdata/cte_recursive/stdlib/query.sql new file mode 100644 index 0000000000..c18d216d0e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/query.sql @@ -0,0 +1,9 @@ +-- name: CTERecursive :many +WITH RECURSIVE cte AS ( + SELECT b.* FROM bar AS b + WHERE b.id = $1 + UNION ALL + SELECT b.* + FROM bar AS b, cte AS c + WHERE b.parent_id = c.id +) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql b/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json b/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/issue.md b/internal/endtoend/testdata/cte_recursive_employees/issue.md new file mode 100644 index 0000000000..11f5771fd8 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/issue.md @@ -0,0 +1,2 @@ +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/exec.json b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_employees/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..eae1c96e75 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Employee struct { + ID int64 + Name string + Manager pgtype.Text +} 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 new file mode 100644 index 0000000000..50ffa78909 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSubordinates = `-- name: GetSubordinates :many +WITH RECURSIVE subordinates(name, manager) AS ( + SELECT + NULL, $1::TEXT + UNION + SELECT + s.manager, e.name + FROM + subordinates AS s + LEFT OUTER JOIN + employees AS e + ON + e.manager = s.manager + WHERE + s.manager IS NOT NULL +) +SELECT + s.name +FROM + subordinates AS s +WHERE + s.name != $1 +` + +func (q *Queries) GetSubordinates(ctx context.Context, name pgtype.Text) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, getSubordinates, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var name pgtype.Text + if err := rows.Scan(&name); err != nil { + return nil, err + } + items = append(items, name) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql new file mode 100644 index 0000000000..00d490a4b9 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql @@ -0,0 +1,22 @@ +-- name: GetSubordinates :many +WITH RECURSIVE subordinates(name, manager) AS ( + SELECT + NULL, sqlc.arg(name)::TEXT + UNION + SELECT + s.manager, e.name + FROM + subordinates AS s + LEFT OUTER JOIN + employees AS e + ON + e.manager = s.manager + WHERE + s.manager IS NOT NULL +) +SELECT + s.name +FROM + subordinates AS s +WHERE + s.name != sqlc.arg(name); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b95effb369 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE employees ( + id BIGSERIAL PRIMARY KEY, + name text UNIQUE NOT NULL, + manager text REFERENCES employees(name) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/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" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/issue.md b/internal/endtoend/testdata/cte_recursive_star/issue.md new file mode 100644 index 0000000000..2bc033582e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1219 \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..cfa14619bf --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Dict struct { + ID string + AppID string + Code pgtype.Text + ParentCode string + Label string + Value pgtype.Text + Weight int32 + IsDefault bool + IsVirtual bool + Status int16 + CreateAt pgtype.Timestamptz + CreateBy string + UpdateAt pgtype.Timestamptz + UpdateBy pgtype.Text + IsDelete bool +} 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 new file mode 100644 index 0000000000..871349d074 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getDictTree = `-- name: GetDictTree :many +with recursive dictTree(id, code, parent_code, label, value, path, depth) AS ( + select id, code, parent_code, label, value, ARRAY[COALESCE((select id from dict where code=''),'virtual_root'), id], 1 as depth from dict where app_id = '1' and parent_code = '' and is_delete=false + union + select d.id, d.code, d.parent_code, d.label, d.value, t.path || ARRAY[d.id], t.depth+1 as depth from dict d join dictTree t on d.parent_code = t.code and not d.id = ANY(t.path) and d.is_delete=false +) +select id, code, parent_code, label, value, path, depth from dictTree d order by depth, parent_code +` + +type GetDictTreeRow struct { + ID string + Code pgtype.Text + ParentCode string + Label string + Value pgtype.Text + Path []string + Depth int32 +} + +func (q *Queries) GetDictTree(ctx context.Context) ([]GetDictTreeRow, error) { + rows, err := q.db.Query(ctx, getDictTree) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetDictTreeRow + for rows.Next() { + var i GetDictTreeRow + if err := rows.Scan( + &i.ID, + &i.Code, + &i.ParentCode, + &i.Label, + &i.Value, + &i.Path, + &i.Depth, + ); 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_star/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/query.sql new file mode 100644 index 0000000000..a48253d0ab --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: GetDictTree :many +with recursive dictTree(id, code, parent_code, label, value, path, depth) AS ( + select id, code, parent_code, label, value, ARRAY[COALESCE((select id from dict where code=''),'virtual_root'), id], 1 as depth from dict where app_id = '1' and parent_code = '' and is_delete=false + union + select d.id, d.code, d.parent_code, d.label, d.value, t.path || ARRAY[d.id], t.depth+1 as depth from dict d join dictTree t on d.parent_code = t.code and not d.id = ANY(t.path) and d.is_delete=false +) +select * from dictTree d order by depth, parent_code; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c4257ab8bb --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql @@ -0,0 +1,17 @@ +create table dict( + id VARCHAR(36) PRIMARY KEY DEFAULT gen_random_uuid(), + app_id VARCHAR(36) NOT NULL, + code VARCHAR(64), + parent_code VARCHAR(64) NOT NULL, + label TEXT NOT NULL DEFAULT '', + value TEXT NULL, + weight INT NOT NULL DEFAULT 0, + is_default BOOLEAN NOT NULL DEFAULT false, + is_virtual BOOLEAN NOT NULL DEFAULT false, + status SMALLINT NOT NULL DEFAULT 1, + create_at TIMESTAMPTZ(0) NOT NULL DEFAULT now(), + create_by VARCHAR(36) NOT NULL DEFAULT '', + update_at TIMESTAMPTZ(0), + update_by VARCHAR(36), + is_delete BOOLEAN NOT NULL DEFAULT false +); diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/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" \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..53c5c498a6 --- /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.30.0 + +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..e6b4cbafa5 --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..09908991ae --- /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.30.0 + +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..690a024aed --- /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.30.0 +// 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/issue.md b/internal/endtoend/testdata/cte_select_one/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_select_one/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..867481daf8 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testRecursive = `-- name: TestRecursive :one +WITH t1 AS ( + select 1 as foo +) +SELECT foo FROM t1 +` + +func (q *Queries) TestRecursive(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, testRecursive) + var foo int32 + err := row.Scan(&foo) + return foo, err +} diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql new file mode 100644 index 0000000000..9f4fdf08de --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: TestRecursive :one +WITH t1 AS ( + select 1 as foo +) +SELECT * FROM t1; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..af3b9497d9 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql @@ -0,0 +1 @@ +-- TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/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" \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..f5d93f6f97 --- /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.30.0 + +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..61ba601b90 --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..b82677933d --- /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.30.0 + +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..15890aef3f --- /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.30.0 +// 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/exec.json b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_with_in/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..e95830d5ab --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type L struct { + ID int64 + ParentID pgtype.Int4 +} + +type T struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} 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 new file mode 100644 index 0000000000..a743dd6e3b --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,164 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAll = `-- name: GetAll :many +SELECT id, parent_id FROM L +` + +func (q *Queries) GetAll(ctx context.Context) ([]L, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []L + for rows.Next() { + var i L + if err := rows.Scan(&i.ID, &i.ParentID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll1 = `-- name: GetAll1 :many +with recursive cte as ( + select id, L_ID, F from T + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte +` + +type GetAll1Row struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} + +func (q *Queries) GetAll1(ctx context.Context, lID pgtype.Int4) ([]GetAll1Row, error) { + rows, err := q.db.Query(ctx, getAll1, lID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAll1Row + for rows.Next() { + var i GetAll1Row + if err := rows.Scan(&i.ID, &i.LID, &i.F); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll2 = `-- name: GetAll2 :many +with recursive cte as ( + select id, L_ID, F from T where T.ID=2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte +` + +type GetAll2Row struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} + +func (q *Queries) GetAll2(ctx context.Context, lID pgtype.Int4) ([]GetAll2Row, error) { + rows, err := q.db.Query(ctx, getAll2, lID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAll2Row + for rows.Next() { + var i GetAll2Row + if err := rows.Scan(&i.ID, &i.LID, &i.F); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll3 = `-- name: GetAll3 :many +select id from T where L_ID in( + with recursive cte as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from cte +) +` + +func (q *Queries) GetAll3(ctx context.Context, dollar_1 pgtype.Int4) ([]int64, error) { + rows, err := q.db.Query(ctx, getAll3, dollar_1) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll4 = `-- name: GetAll4 :many +select id from T where L_ID in( + with recursive L as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from L +) +` + +func (q *Queries) GetAll4(ctx context.Context, lID pgtype.Int4) ([]int64, error) { + rows, err := q.db.Query(ctx, getAll4, lID) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..4a27713beb --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql @@ -0,0 +1,34 @@ +-- name: GetAll :many +SELECT * FROM L; + +-- name: GetAll1 :many +with recursive cte as ( + select id, L_ID, F from T + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte; + +-- name: GetAll2 :many +with recursive cte as ( + select id, L_ID, F from T where T.ID=2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte; + +-- name: GetAll4 :many +select id from T where L_ID in( + with recursive L as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from L +); + +-- name: GetAll3 :many +select id from T where L_ID in( + with recursive cte as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from cte +); diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..cf970e3331 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/2153 + +CREATE TABLE L ( + id BIGSERIAL PRIMARY KEY, + parent_id int null +); + +CREATE TABLE T ( + id BIGSERIAL PRIMARY KEY, + L_ID int, + F varchar(256) +); diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..4905a64003 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5" + } + ] +} + 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 c3c034ae37..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package db 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 84236c7d59..2b50ab0e55 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 e1a4be881c..d591b51676 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,32 +1,27 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package db import ( "context" - "database/sql" ) const listBar = `-- name: ListBar :many SELECT col_a, col_b, col_c FROM bar ` -type ListBarRow struct { - ColA sql.NullInt32 - ColB sql.NullInt32 - ColC sql.NullInt32 -} - -func (q *Queries) ListBar(ctx context.Context) ([]ListBarRow, error) { +func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { rows, err := q.db.QueryContext(ctx, listBar) if err != nil { return nil, err } defer rows.Close() - var items []ListBarRow + var items []Bar for rows.Next() { - var i ListBarRow + var i Bar if err := rows.Scan(&i.ColA, &i.ColB, &i.ColC); err != nil { return nil, err } @@ -45,21 +40,15 @@ const listFoo = `-- name: ListFoo :many SELECT col_a, col_b, col_c FROM foo ` -type ListFooRow struct { - ColA int32 - ColB int32 - ColC int32 -} - -func (q *Queries) ListFoo(ctx context.Context) ([]ListFooRow, error) { +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { rows, err := q.db.QueryContext(ctx, listFoo) if err != nil { return nil, err } defer rows.Close() - var items []ListFooRow + var items []Foo for rows.Next() { - var i ListFooRow + var i Foo if err := rows.Scan(&i.ColA, &i.ColB, &i.ColC); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/query.sql b/internal/endtoend/testdata/data_type_boolean/mysql/query.sql index 210488ceac..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/mysql/query.sql @@ -1,19 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL, - col_c TINYINT(1) NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN, - col_c TINYINT(1) -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql b/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql new file mode 100644 index 0000000000..8289125b96 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL, + col_c TINYINT(1) NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN, + col_c TINYINT(1) +); diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json b/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json index a279d21f99..d98ee6f1a2 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/db/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/db/models.go deleted file mode 100644 index 49607fd39f..0000000000 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/db/models.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package db - -import ( - "database/sql" -) - -type Bar struct { - ColA sql.NullBool - ColB sql.NullBool -} - -type Foo struct { - ColA bool - ColB bool -} diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/db/query.sql.go deleted file mode 100644 index 61aa8aab72..0000000000 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/db/query.sql.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package db - -import ( - "context" -) - -const listBar = `-- name: ListBar :many -SELECT col_a, col_b FROM bar -` - -func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, listBar) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Bar - for rows.Next() { - var i Bar - if err := rows.Scan(&i.ColA, &i.ColB); 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 listFoo = `-- name: ListFoo :many -SELECT col_a, col_b FROM foo -` - -func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.ColA, &i.ColB); 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/data_type_boolean/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/data_type_boolean/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..dfbf6aeb32 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ColA sql.NullBool + ColB sql.NullBool +} + +type Foo struct { + ColA bool + ColB bool +} 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 new file mode 100644 index 0000000000..9d705cd685 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT col_a, col_b FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.ColA, &i.ColB); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT col_a, col_b FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ColA, &i.ColB); 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/data_type_boolean/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c0adc5c5c5 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d5697fa2bf --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/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" + } + ] +} + 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/data_type_boolean/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..8473f52a9e --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ColA pgtype.Bool + ColB pgtype.Bool +} + +type Foo struct { + ColA bool + ColB bool +} 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 new file mode 100644 index 0000000000..9d705cd685 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT col_a, col_b FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.ColA, &i.ColB); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT col_a, col_b FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ColA, &i.ColB); 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/data_type_boolean/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c0adc5c5c5 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..59a4822f0b --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/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" + } + ] +} + diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/query.sql deleted file mode 100644 index 53ad078373..0000000000 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/query.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL -); - --- name: ListFoo :many -SELECT * FROM foo; - -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN -); - --- name: ListBar :many -SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/sqlc.json deleted file mode 100644 index 5fb2f8b6de..0000000000 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "db", - "engine": "postgresql", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} - 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/data_type_boolean/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..dfbf6aeb32 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ColA sql.NullBool + ColB sql.NullBool +} + +type Foo struct { + ColA bool + ColB bool +} 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 new file mode 100644 index 0000000000..9527500b60 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT col_a, col_b FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.ColA, &i.ColB); 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 listFoo = `-- name: ListFoo :many +SELECT col_a, col_b FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ColA, &i.ColB); 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/data_type_boolean/postgresql/stdlib/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c0adc5c5c5 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..84cf1bb5aa --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/data_type_boolean/sqlite/db/models.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go new file mode 100644 index 0000000000..7cd3cb8dce --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Bar struct { + ColA sql.NullBool + ColB sql.NullBool +} + +type Foo struct { + ColA bool + ColB bool +} 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 new file mode 100644 index 0000000000..b76767679c --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT col_a, col_b FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.ColA, &i.ColB); 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 listFoo = `-- name: ListFoo :many +SELECT col_a, col_b FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ColA, &i.ColB); 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/data_type_boolean/sqlite/query.sql b/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql new file mode 100644 index 0000000000..c0adc5c5c5 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql b/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json b/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json new file mode 100644 index 0000000000..8dc788d7cd --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/datatype/go/db.go b/internal/endtoend/testdata/datatype/go/db.go deleted file mode 100644 index 1558a525e9..0000000000 --- a/internal/endtoend/testdata/datatype/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package datatype - -import ( - "context" - "database/sql" -) - -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 -} - -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/datatype/go/models.go b/internal/endtoend/testdata/datatype/go/models.go deleted file mode 100644 index 0527cfff54..0000000000 --- a/internal/endtoend/testdata/datatype/go/models.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package datatype - -import ( - "database/sql" - "time" -) - -type DtCharacter struct { - A sql.NullString - B sql.NullString - C sql.NullString - D sql.NullString - E sql.NullString -} - -type DtCharacterNotNull struct { - A string - B string - C string - D string - E string -} - -type DtDatetime struct { - A sql.NullTime - B sql.NullTime - C sql.NullTime - D sql.NullTime - E sql.NullTime - F sql.NullTime - G sql.NullTime - H sql.NullTime -} - -type DtDatetimeNotNull struct { - A time.Time - B time.Time - C time.Time - D time.Time - E time.Time - F time.Time - G time.Time - H time.Time -} - -type DtNumeric struct { - A int16 - B sql.NullInt32 - C sql.NullInt64 - D sql.NullString - E sql.NullString - F sql.NullFloat64 - G sql.NullFloat64 - H int16 - I sql.NullInt32 - J sql.NullInt64 - K int16 - L sql.NullInt32 - M sql.NullInt64 -} - -type DtNumericNotNull struct { - A int16 - B int32 - C int64 - D string - E string - F float32 - G float64 - H int16 - I int32 - J int64 - K int16 - L int32 - M int64 -} diff --git a/internal/endtoend/testdata/datatype/mysql/go/db.go b/internal/endtoend/testdata/datatype/mysql/go/db.go new file mode 100644 index 0000000000..0a639a6476 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +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 +} + +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/datatype/mysql/go/models.go b/internal/endtoend/testdata/datatype/mysql/go/models.go new file mode 100644 index 0000000000..8e15cde168 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/go/models.go @@ -0,0 +1,91 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "time" +) + +type DtCharacter struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullString + F sql.NullString + G sql.NullString + H sql.NullString + I sql.NullString + J sql.NullString + K sql.NullString + L sql.NullString +} + +type DtCharacterNotNull struct { + A string + B string + C string + D []byte + E []byte + F []byte + G string + H string + I string + J []byte + K string + L []byte +} + +type DtDatetime struct { + A sql.NullTime + B sql.NullTime + C sql.NullTime +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time +} + +type DtNumeric struct { + A sql.NullInt32 + B sql.NullInt32 + C sql.NullInt16 + D sql.NullInt16 + E sql.NullInt32 + F sql.NullInt64 + G interface{} + H sql.NullString + I sql.NullString + J sql.NullFloat64 + K sql.NullFloat64 + L sql.NullFloat64 +} + +type DtNumericNotNull struct { + A int32 + B int32 + C int8 + D int16 + E int32 + F int64 + G interface{} + H string + I string + J float64 + K float64 + L float64 +} + +type DtNumericUnsigned struct { + A sql.NullInt32 + B 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..4720927d0a --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/datatype/mysql/sql/character.sql new file mode 100644 index 0000000000..42130472d9 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/sql/character.sql @@ -0,0 +1,31 @@ +-- Character Types +-- https://dev.mysql.com/doc/refman/8.0/en/string-type-syntax.html +CREATE TABLE dt_character ( + a CHARACTER(32), + b VARCHAR(32), + c CHAR(32), + d BINARY(32), + e VARBINARY(32), + f TINYBLOB, + g TINYTEXT, + h TEXT, + i MEDIUMTEXT, + j MEDIUMBLOB, + k LONGTEXT, + l LONGBLOB +); + +CREATE TABLE dt_character_not_null ( + a CHARACTER(32) NOT NULL, + b VARCHAR(32) NOT NULL, + c CHAR(32) NOT NULL, + d BINARY(32) NOT NULL, + e VARBINARY(32) NOT NULL, + f TINYBLOB NOT NULL, + g TINYTEXT NOT NULL, + h TEXT NOT NULL, + i MEDIUMTEXT NOT NULL, + j MEDIUMBLOB NOT NULL, + k LONGTEXT NOT NULL, + l LONGBLOB NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/mysql/sql/datetime.sql b/internal/endtoend/testdata/datatype/mysql/sql/datetime.sql new file mode 100644 index 0000000000..6008cf6ae6 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/sql/datetime.sql @@ -0,0 +1,13 @@ +-- Date/Time Types +-- https://www.sqlite.org/datatype3.html +CREATE TABLE dt_datetime ( + a DATE, + b DATETIME, + c TIMESTAMP +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b DATETIME NOT NULL, + c TIMESTAMP NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/mysql/sql/numeric.sql b/internal/endtoend/testdata/datatype/mysql/sql/numeric.sql new file mode 100644 index 0000000000..ddc1573e63 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/sql/numeric.sql @@ -0,0 +1,40 @@ +-- Numeric Types +-- https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html +CREATE TABLE dt_numeric ( + a INT, + b INTEGER, + c TINYINT, + d SMALLINT, + e MEDIUMINT, + f BIGINT, + g BIT, + h DECIMAL(10, 5), + i DEC(10, 5), + j FLOAT, + k DOUBLE, + l DOUBLE PRECISION +); + +CREATE TABLE dt_numeric_unsigned ( + a INT UNSIGNED, + b INTEGER UNSIGNED, + c TINYINT UNSIGNED, + d SMALLINT UNSIGNED, + e MEDIUMINT UNSIGNED, + f BIGINT UNSIGNED +); + +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 BIT NOT NULL, + h DECIMAL(10, 5) NOT NULL, + i DEC(10, 5) NOT NULL, + j FLOAT NOT NULL, + k DOUBLE NOT NULL, + l DOUBLE PRECISION NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/mysql/sql/query.sql b/internal/endtoend/testdata/datatype/mysql/sql/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/datatype/mysql/sqlc.json b/internal/endtoend/testdata/datatype/mysql/sqlc.json new file mode 100644 index 0000000000..8bc2cb7ec2 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "mysql", + "name": "datatype", + "schema": "sql/", + "queries": "sql/" + } + ] +} diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/db.go b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go new file mode 100644 index 0000000000..4e47262b7d --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/datatype/pgx/v4/go/models.go b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go new file mode 100644 index 0000000000..6069c4a25c --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go @@ -0,0 +1,112 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "time" + + "github.com/jackc/pgtype" +) + +type DtCharacter struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullString +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A sql.NullTime + B sql.NullTime + C sql.NullTime + D sql.NullTime + E sql.NullTime + F sql.NullTime + G sql.NullTime + H sql.NullTime +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time + D time.Time + E time.Time + F time.Time + G time.Time + H time.Time +} + +type DtNetType struct { + A pgtype.Inet + B pgtype.CIDR + C pgtype.Macaddr +} + +type DtNetTypesNotNull struct { + A pgtype.Inet + B pgtype.CIDR + C pgtype.Macaddr +} + +type DtNumeric struct { + A sql.NullInt16 + B sql.NullInt32 + C sql.NullInt64 + D pgtype.Numeric + E pgtype.Numeric + F sql.NullFloat64 + G sql.NullFloat64 + H sql.NullInt16 + I sql.NullInt32 + J sql.NullInt64 + K sql.NullInt16 + L sql.NullInt32 + M sql.NullInt64 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D pgtype.Numeric + E pgtype.Numeric + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A pgtype.Int4range + B pgtype.Int8range + C pgtype.Numrange + D pgtype.Tsrange + E pgtype.Tstzrange + F pgtype.Daterange +} + +type DtRangeNotNull struct { + A pgtype.Int4range + B pgtype.Int8range + C pgtype.Numrange + D pgtype.Tsrange + E pgtype.Tstzrange + F pgtype.Daterange +} 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..3a1b6bccec --- /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.30.0 +// 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/sql/character.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/character.sql similarity index 100% rename from internal/endtoend/testdata/datatype/sql/character.sql rename to internal/endtoend/testdata/datatype/pgx/v4/sql/character.sql diff --git a/internal/endtoend/testdata/datatype/sql/datetime.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/datetime.sql similarity index 100% rename from internal/endtoend/testdata/datatype/sql/datetime.sql rename to internal/endtoend/testdata/datatype/pgx/v4/sql/datetime.sql diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sql/net-types.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/sql/numeric.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/numeric.sql similarity index 100% rename from internal/endtoend/testdata/datatype/sql/numeric.sql rename to internal/endtoend/testdata/datatype/pgx/v4/sql/numeric.sql diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sql/rangetypes.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sqlc.json b/internal/endtoend/testdata/datatype/pgx/v4/sqlc.json new file mode 100644 index 0000000000..196e0d3822 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "datatype", + "schema": "sql/", + "queries": "sql/" + } + ] +} diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/db.go b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go new file mode 100644 index 0000000000..2853d5f77e --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "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 +} + +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/datatype/pgx/v5/go/models.go b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go new file mode 100644 index 0000000000..49a90357c5 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go @@ -0,0 +1,114 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "net" + "net/netip" + "time" + + "github.com/jackc/pgx/v5/pgtype" +) + +type DtCharacter struct { + A pgtype.Text + B pgtype.Text + C pgtype.Text + D pgtype.Text + E pgtype.Text +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A pgtype.Date + B pgtype.Time + C pgtype.Time + D sql.NullTime + E pgtype.Timestamp + F pgtype.Timestamp + G pgtype.Timestamptz + H pgtype.Timestamptz +} + +type DtDatetimeNotNull struct { + A pgtype.Date + B pgtype.Time + C pgtype.Time + D time.Time + E pgtype.Timestamp + F pgtype.Timestamp + G pgtype.Timestamptz + H pgtype.Timestamptz +} + +type DtNetType struct { + A *netip.Addr + B *netip.Prefix + C net.HardwareAddr +} + +type DtNetTypesNotNull struct { + A netip.Addr + B netip.Prefix + C net.HardwareAddr +} + +type DtNumeric struct { + A pgtype.Int2 + B pgtype.Int4 + C pgtype.Int8 + D pgtype.Numeric + E pgtype.Numeric + F pgtype.Float4 + G pgtype.Float8 + H pgtype.Int2 + I pgtype.Int4 + J pgtype.Int8 + K pgtype.Int2 + L pgtype.Int4 + M pgtype.Int8 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D pgtype.Numeric + E pgtype.Numeric + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A pgtype.Range[pgtype.Int4] + B pgtype.Range[pgtype.Int8] + C pgtype.Range[pgtype.Numeric] + D pgtype.Range[pgtype.Timestamp] + E pgtype.Range[pgtype.Timestamptz] + F pgtype.Range[pgtype.Date] +} + +type DtRangeNotNull struct { + A pgtype.Range[pgtype.Int4] + B pgtype.Range[pgtype.Int8] + C pgtype.Range[pgtype.Numeric] + D pgtype.Range[pgtype.Timestamp] + E pgtype.Range[pgtype.Timestamptz] + F pgtype.Range[pgtype.Date] +} 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..3a1b6bccec --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/character.sql new file mode 100644 index 0000000000..e3f41dac81 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/character.sql @@ -0,0 +1,17 @@ +-- Character Types +-- https://www.postgresql.org/docs/current/datatype-character.html +CREATE TABLE dt_character ( + a text, + b character varying(32), + c varchar(32), + d character(32), + e char(32) +); + +CREATE TABLE dt_character_not_null ( + a text NOT NULL, + b character varying(32) NOT NULL, + c varchar(32) NOT NULL, + d character(32) NOT NULL, + e char(32) NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/datetime.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/datetime.sql new file mode 100644 index 0000000000..5e6bcf033f --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/datetime.sql @@ -0,0 +1,23 @@ +-- Date/Time Types +-- https://www.postgresql.org/docs/current/datatype-datetime.html +CREATE TABLE dt_datetime ( + a DATE, + b TIME, + c TIME WITHOUT TIME ZONE, + d TIME WITH TIME ZONE, + e TIMESTAMP, + f TIMESTAMP WITHOUT TIME ZONE, + g TIMESTAMP WITH TIME ZONE, + h timestamptz +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b TIME NOT NULL, + c TIME WITHOUT TIME ZONE NOT NULL, + d TIME WITH TIME ZONE NOT NULL, + e TIMESTAMP NOT NULL, + f TIMESTAMP WITHOUT TIME ZONE NOT NULL, + g TIMESTAMP WITH TIME ZONE NOT NULL, + h timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/net-types.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/numeric.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/numeric.sql new file mode 100644 index 0000000000..9df14947f3 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/numeric.sql @@ -0,0 +1,36 @@ +-- Numeric Types +-- https://www.postgresql.org/docs/current/datatype-numeric.html +CREATE TABLE dt_numeric ( + -- TODO: this maps incorrectly to int16, not NullInt16 + a smallint, + b integer, + c bigint, + d decimal, + e numeric, + f real, + g double precision, + -- TODO: this maps incorrectly to int16, not NullInt16 + h smallserial, + i serial, + j bigserial, + -- TODO: this maps incorrectly to int16, not NullInt16 + k int2, + l int4, + m int8 +); + +CREATE TABLE dt_numeric_not_null ( + a smallint NOT NULL, + b integer NOT NULL, + c bigint NOT NULL, + d decimal NOT NULL, + e numeric NOT NULL, + f real NOT NULL, + g double precision NOT NULL, + h smallserial NOT NULL, + i serial NOT NULL, + j bigserial NOT NULL, + k int2 NOT NULL, + l int4 NOT NULL, + m int8 NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/rangetypes.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sqlc.json b/internal/endtoend/testdata/datatype/pgx/v5/sqlc.json new file mode 100644 index 0000000000..c4ad3be17b --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "datatype", + "schema": "sql/", + "queries": "sql/" + } + ] +} diff --git a/internal/endtoend/testdata/datatype/sqlite/go/db.go b/internal/endtoend/testdata/datatype/sqlite/go/db.go new file mode 100644 index 0000000000..0a639a6476 --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +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 +} + +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/datatype/sqlite/go/models.go b/internal/endtoend/testdata/datatype/sqlite/go/models.go new file mode 100644 index 0000000000..277f6abedf --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/go/models.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "time" +) + +type DtCharacter struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullString + F sql.NullString + G sql.NullString + H sql.NullString +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string + F string + G string + H string +} + +type DtDatetime struct { + A sql.NullTime + B sql.NullTime + C sql.NullTime +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time +} + +type DtNumeric struct { + A sql.NullInt64 + B sql.NullInt64 + C sql.NullInt64 + D sql.NullInt64 + E sql.NullInt64 + F sql.NullInt64 + G sql.NullInt64 + H sql.NullInt64 + I sql.NullInt64 + J sql.NullFloat64 + K sql.NullFloat64 + L sql.NullFloat64 + M sql.NullFloat64 + N sql.NullFloat64 + O sql.NullFloat64 +} + +type DtNumericNotNull struct { + A int64 + B int64 + C int64 + D int64 + E int64 + F int64 + G int64 + H int64 + I int64 + J float64 + K float64 + L float64 + M float64 + N float64 + O float64 +} 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..a92313d1a7 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..d4b728bdab --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/sql/character.sql @@ -0,0 +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 +); + +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 +); diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql b/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql new file mode 100644 index 0000000000..6008cf6ae6 --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql @@ -0,0 +1,13 @@ +-- Date/Time Types +-- https://www.sqlite.org/datatype3.html +CREATE TABLE dt_datetime ( + a DATE, + b DATETIME, + c TIMESTAMP +); + +CREATE TABLE dt_datetime_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 new file mode 100644 index 0000000000..a85b4f295b --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/sql/numeric.sql @@ -0,0 +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) +); + +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 +); diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/query.sql b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/datatype/sqlite/sqlc.json b/internal/endtoend/testdata/datatype/sqlite/sqlc.json new file mode 100644 index 0000000000..768a85b0c1 --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "datatype", + "schema": "sql/", + "queries": "sql/" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/datatype/stdlib/go/db.go b/internal/endtoend/testdata/datatype/stdlib/go/db.go new file mode 100644 index 0000000000..0a639a6476 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +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 +} + +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/datatype/stdlib/go/models.go b/internal/endtoend/testdata/datatype/stdlib/go/models.go new file mode 100644 index 0000000000..691793cbdd --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/go/models.go @@ -0,0 +1,112 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "time" + + "github.com/sqlc-dev/pqtype" +) + +type DtCharacter struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullString +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A sql.NullTime + B sql.NullTime + C sql.NullTime + D sql.NullTime + E sql.NullTime + F sql.NullTime + G sql.NullTime + H sql.NullTime +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time + D time.Time + E time.Time + F time.Time + G time.Time + H time.Time +} + +type DtNetType struct { + A pqtype.Inet + B pqtype.CIDR + C pqtype.Macaddr +} + +type DtNetTypesNotNull struct { + A pqtype.Inet + B pqtype.CIDR + C pqtype.Macaddr +} + +type DtNumeric struct { + A sql.NullInt16 + B sql.NullInt32 + C sql.NullInt64 + D sql.NullString + E sql.NullString + F sql.NullFloat64 + G sql.NullFloat64 + H sql.NullInt16 + I sql.NullInt32 + J sql.NullInt64 + K sql.NullInt16 + L sql.NullInt32 + M sql.NullInt64 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D string + E string + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A interface{} + B interface{} + C interface{} + D interface{} + E interface{} + F interface{} +} + +type DtRangeNotNull struct { + A interface{} + B interface{} + C interface{} + D interface{} + E interface{} + F interface{} +} 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..4720927d0a --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/datatype/stdlib/sql/character.sql new file mode 100644 index 0000000000..e3f41dac81 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/character.sql @@ -0,0 +1,17 @@ +-- Character Types +-- https://www.postgresql.org/docs/current/datatype-character.html +CREATE TABLE dt_character ( + a text, + b character varying(32), + c varchar(32), + d character(32), + e char(32) +); + +CREATE TABLE dt_character_not_null ( + a text NOT NULL, + b character varying(32) NOT NULL, + c varchar(32) NOT NULL, + d character(32) NOT NULL, + e char(32) NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/datetime.sql b/internal/endtoend/testdata/datatype/stdlib/sql/datetime.sql new file mode 100644 index 0000000000..5e6bcf033f --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/datetime.sql @@ -0,0 +1,23 @@ +-- Date/Time Types +-- https://www.postgresql.org/docs/current/datatype-datetime.html +CREATE TABLE dt_datetime ( + a DATE, + b TIME, + c TIME WITHOUT TIME ZONE, + d TIME WITH TIME ZONE, + e TIMESTAMP, + f TIMESTAMP WITHOUT TIME ZONE, + g TIMESTAMP WITH TIME ZONE, + h timestamptz +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b TIME NOT NULL, + c TIME WITHOUT TIME ZONE NOT NULL, + d TIME WITH TIME ZONE NOT NULL, + e TIMESTAMP NOT NULL, + f TIMESTAMP WITHOUT TIME ZONE NOT NULL, + g TIMESTAMP WITH TIME ZONE NOT NULL, + h timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/net-types.sql b/internal/endtoend/testdata/datatype/stdlib/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/numeric.sql b/internal/endtoend/testdata/datatype/stdlib/sql/numeric.sql new file mode 100644 index 0000000000..9df14947f3 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/numeric.sql @@ -0,0 +1,36 @@ +-- Numeric Types +-- https://www.postgresql.org/docs/current/datatype-numeric.html +CREATE TABLE dt_numeric ( + -- TODO: this maps incorrectly to int16, not NullInt16 + a smallint, + b integer, + c bigint, + d decimal, + e numeric, + f real, + g double precision, + -- TODO: this maps incorrectly to int16, not NullInt16 + h smallserial, + i serial, + j bigserial, + -- TODO: this maps incorrectly to int16, not NullInt16 + k int2, + l int4, + m int8 +); + +CREATE TABLE dt_numeric_not_null ( + a smallint NOT NULL, + b integer NOT NULL, + c bigint NOT NULL, + d decimal NOT NULL, + e numeric NOT NULL, + f real NOT NULL, + g double precision NOT NULL, + h smallserial NOT NULL, + i serial NOT NULL, + j bigserial NOT NULL, + k int2 NOT NULL, + l int4 NOT NULL, + m int8 NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/query.sql b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/rangetypes.sql b/internal/endtoend/testdata/datatype/stdlib/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/datatype/sqlc.json b/internal/endtoend/testdata/datatype/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/datatype/sqlc.json rename to internal/endtoend/testdata/datatype/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md new file mode 100644 index 0000000000..c51bd7f6d4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1519 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..bbb0117133 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type ComputedTablesSomething struct { + ID pgtype.Int4 + EventType string + CreatedAt pgtype.Timestamptz +} + +type Event struct { + ID pgtype.Int4 + EventType string + CreatedAt pgtype.Timestamptz +} 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 new file mode 100644 index 0000000000..b5390d928e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const someQuery = `-- name: SomeQuery :many +select id from "computed_tables"."something" +` + +func (q *Queries) SomeQuery(ctx context.Context) ([]pgtype.Int4, error) { + rows, err := q.db.Query(ctx, someQuery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Int4 + for rows.Next() { + var id pgtype.Int4 + 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 +} diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql new file mode 100644 index 0000000000..24dafea7ed --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SomeQuery :many +select id from "computed_tables"."something"; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..2b788e0976 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql @@ -0,0 +1,13 @@ +create table events ( + id int, + event_type text not null, + created_at timestamptz +); + +CREATE MATERIALIZED VIEW something AS +select * from events +where event_type = 'sale' +order by created_at desc; + +create schema computed_tables; +alter materialized view something set schema computed_tables; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/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_alter_table_add_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go new file mode 100644 index 0000000000..b7e6d70cba --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + Baz sql.NullInt32 + Bio sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_add_column/mysql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/query.sql new file mode 100644 index 0000000000..bb628f9251 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :exec */ +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/schema.sql new file mode 100644 index 0000000000..0019a393a2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo ADD COLUMN baz integer; +ALTER TABLE foo ADD bio integer; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..2ac3331027 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + Baz sql.NullInt32 + Bio sql.NullInt32 + Foobar []int32 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a70d902d4e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo ADD COLUMN baz int; +ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..acf9e070a2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar string + Baz pgtype.Int4 + Bio pgtype.Int4 + Foobar []int32 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a70d902d4e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo ADD COLUMN baz int; +ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/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/ddl_alter_table_add_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..2ac3331027 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + Baz sql.NullInt32 + Bio sql.NullInt32 + Foobar []int32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_drop_column/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a70d902d4e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo ADD COLUMN baz int; +ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go new file mode 100644 index 0000000000..ba83d3d792 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + Name sql.NullString + Location sql.NullString + Size sql.NullInt64 +} 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 new file mode 100644 index 0000000000..c388865458 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :many +SELECT 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.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/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql new file mode 100644 index 0000000000..1dbfac7154 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :many */ +SELECT * from venues; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/schema.sql new file mode 100644 index 0000000000..8214519580 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE venues (name text); +ALTER TABLE venues ADD location text; +ALTER TABLE venues ADD COLUMN size integer; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/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_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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..115508d2bc --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..2f540786e0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo ADD COLUMN IF NOT EXISTS bar text; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..115508d2bc --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..6eb79f669c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo ADD COLUMN IF NOT EXISTS bar text; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..115508d2bc --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_rename/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..2f540786e0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo ADD COLUMN IF NOT EXISTS bar text; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go new file mode 100644 index 0000000000..15660dccd1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullInt32 + Baz sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_alter_type/mysql/query.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/query.sql new file mode 100644 index 0000000000..bb628f9251 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :exec */ +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/schema.sql new file mode 100644 index 0000000000..a81bc00990 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo MODIFY COLUMN bar integer; +ALTER TABLE foo MODIFY baz integer; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/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/ddl_alter_table_alter_type/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/models.go deleted file mode 100644 index 4d7c958fcf..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar []string -} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..957c613690 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..26fa6c7c9c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar TEXT); +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..957c613690 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..26fa6c7c9c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar TEXT); +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/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/ddl_alter_table_alter_type/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/schema.sql deleted file mode 100644 index 75a7a7bfbc..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..957c613690 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_set_not_null/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..26fa6c7c9c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar TEXT); +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/sqlc.json 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..3ec65a53d1 --- /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.30.0 + +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..610c92c218 --- /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.30.0 +// 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..79989697e8 --- /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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_change_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_change_column/mysql/query.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/query.sql new file mode 100644 index 0000000000..bb628f9251 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :exec */ +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/schema.sql new file mode 100644 index 0000000000..df60e48b23 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo CHANGE COLUMN bar baz text; diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..59658163a8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..501fc0c0f4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo RENAME COLUMN bar TO baz; diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..59658163a8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..501fc0c0f4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo RENAME COLUMN bar TO baz; diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/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/ddl_alter_table_change_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_change_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..59658163a8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_type_rename_value/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..501fc0c0f4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text NOT NULL); +ALTER TABLE foo RENAME COLUMN bar TO baz; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 e6d899cf6f..4a41234e03 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_column_drop_not_null/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/models.go deleted file mode 100644 index e6d899cf6f..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullString - Baz sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..4a41234e03 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_comment/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..e662ac1daa --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Baz pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1d68afb3f8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo ALTER COLUMN bar DROP NOT NULL; +ALTER TABLE foo ALTER baz DROP NOT NULL; diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..4a41234e03 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_function_args/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_args/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1d68afb3f8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text NOT NULL, baz text NOT NULL); +ALTER TABLE foo ALTER COLUMN bar DROP NOT NULL; +ALTER TABLE foo ALTER baz DROP NOT NULL; diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 b93c269f2e..67a0efc68c 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/models.go deleted file mode 100644 index b93c269f2e..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Baz sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_return/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..09cfadd9e7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Baz pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_types/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ca13f220e7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, baz text); +ALTER TABLE foo DROP COLUMN bar; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/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/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_table/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca13f220e7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, baz text); +ALTER TABLE foo DROP COLUMN bar; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..da6e0a8d41 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :exec +SELECT baz from foo +` + +func (q *Queries) Placeholder(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, placeholder) + return err +} 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 new file mode 100644 index 0000000000..198b08bb8d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT * from foo; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/schema.sql new file mode 100644 index 0000000000..ed3c451bed --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, baz text); +ALTER TABLE foo DROP COLUMN bar; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/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_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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 242533404e..d0184b2aec 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,8 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_if_exists/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/models.go deleted file mode 100644 index 242533404e..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/models.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { -} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..d0184b2aec --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,8 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..d0184b2aec --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,8 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_args/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e36aaeb3f3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo DROP COLUMN IF EXISTS bar; +ALTER TABLE foo DROP COLUMN IF EXISTS bar; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..d0184b2aec --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,8 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_function_if_exists/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e36aaeb3f3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo DROP COLUMN IF EXISTS bar; +ALTER TABLE foo DROP COLUMN IF EXISTS bar; diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_comment/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 18c1cd9abd..de9a55960a 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,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Venue struct { - ID int64 + 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_constraint/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/models.go deleted file mode 100644 index 5b99d4edce..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Venue struct { - ID int32 -} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..1944ccee84 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_schema/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1dbb844fa5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (id SERIAL PRIMARY KEY); +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..1944ccee84 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1dbb844fa5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (id SERIAL PRIMARY KEY); +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/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/ddl_alter_table_drop_constraint/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/schema.sql deleted file mode 100644 index 9477f00e68..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_constraint/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..1944ccee84 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1dbb844fa5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (id SERIAL PRIMARY KEY); +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_enum/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..43a3e75aa4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS foo ADD COLUMN bar integer; +ALTER TABLE IF EXISTS bar RENAME COLUMN bar TO baz; +ALTER TABLE IF EXISTS bat RENAME CONSTRAINT bar TO baz; +ALTER TABLE IF EXISTS baz RENAME TO bar; +ALTER TABLE IF EXISTS goo SET SCHEMA bar; +ALTER TABLE IF EXISTS gob ATTACH PARTITION partition_name DEFAULT; +ALTER TABLE IF EXISTS doo DETACH PARTITION partition_name; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..43a3e75aa4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS foo ADD COLUMN bar integer; +ALTER TABLE IF EXISTS bar RENAME COLUMN bar TO baz; +ALTER TABLE IF EXISTS bat RENAME CONSTRAINT bar TO baz; +ALTER TABLE IF EXISTS baz RENAME TO bar; +ALTER TABLE IF EXISTS goo SET SCHEMA bar; +ALTER TABLE IF EXISTS gob ATTACH PARTITION partition_name DEFAULT; +ALTER TABLE IF EXISTS doo DETACH PARTITION partition_name; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/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/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_type/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..43a3e75aa4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS foo ADD COLUMN bar integer; +ALTER TABLE IF EXISTS bar RENAME COLUMN bar TO baz; +ALTER TABLE IF EXISTS bat RENAME CONSTRAINT bar TO baz; +ALTER TABLE IF EXISTS baz RENAME TO bar; +ALTER TABLE IF EXISTS goo SET SCHEMA bar; +ALTER TABLE IF EXISTS gob ATTACH PARTITION partition_name DEFAULT; +ALTER TABLE IF EXISTS doo DETACH PARTITION partition_name; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_function/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_alter_table_index/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..8a05f10ef2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0fb8fb143e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql @@ -0,0 +1,17 @@ +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); + +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_alter_table_index/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..37aa1e6042 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Measurement struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0fb8fb143e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql @@ -0,0 +1,17 @@ +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); + +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/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/ddl_alter_table_index/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_index/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..8a05f10ef2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_pg_temp/postgresql/query.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_pg_temp/postgresql/query.sql rename to internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0fb8fb143e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql @@ -0,0 +1,17 @@ +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); + +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_args/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 02837cd9a8..fef18087e2 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/models.go deleted file mode 100644 index 41e0418d04..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Arena struct { - Name sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_alter_table_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..019c765b19 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Arena struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_alter_table_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..c3cac35296 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Arena struct { + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..cdc12b8b4f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (name text); +ALTER TABLE venues RENAME TO arenas; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/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/ddl_alter_table_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..019c765b19 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Arena struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_rename/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..cdc12b8b4f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (name text); +ALTER TABLE venues RENAME TO arenas; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_return/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go new file mode 100644 index 0000000000..019c765b19 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Arena struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..f224de356f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const placeholder = `-- name: Placeholder :many +SELECT name from arenas +` + +func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, placeholder) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var name sql.NullString + 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 +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql new file mode 100644 index 0000000000..3cb2745388 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :many */ +SELECT * from arenas; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/schema.sql new file mode 100644 index 0000000000..8ab8f0675b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE venues (name text); +ALTER TABLE venues RENAME TO arenas; + diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/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_rename_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go index 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 b93c269f2e..67a0efc68c 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_column/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/models.go deleted file mode 100644 index b93c269f2e..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Baz sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..09cfadd9e7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Baz pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1848df29b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo RENAME bar TO baz; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/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/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..67a0efc68c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_rename_column/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1848df29b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo RENAME bar TO baz; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_types/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go new file mode 100644 index 0000000000..927fff0f36 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Boo sql.NullString +} 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 new file mode 100644 index 0000000000..c9e55c9583 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const placeholder = `-- name: Placeholder :many +SELECT boo from foo +` + +func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, placeholder) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var boo sql.NullString + if err := rows.Scan(&boo); err != nil { + return nil, err + } + items = append(items, boo) + } + 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_column/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql new file mode 100644 index 0000000000..43794d52b5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: Placeholder :many */ +SELECT * from foo; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/schema.sql new file mode 100644 index 0000000000..f173f17d91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo RENAME COLUMN bar TO baz; + +ALTER TABLE foo RENAME baz TO boo; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/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_set_data_type/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go index 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 e406348ec7..06e143d2bd 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_set_data_type/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/models.go deleted file mode 100644 index 957878da55..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullBool -} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..33e41a2fea --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullBool +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..5ef5dc5489 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..8a716e4f7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Bool +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..5ef5dc5489 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/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/ddl_alter_table_set_data_type/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/schema.sql deleted file mode 100644 index 1ae8a69bf6..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_set_data_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..33e41a2fea --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullBool +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_set_data_type/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..5ef5dc5489 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_create_table/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 71b71fdd0b..0cd442222e 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,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_set_not_null/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/models.go deleted file mode 100644 index 71b71fdd0b..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar string -} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..0cd442222e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..0cd442222e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a5e129a249 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo ALTER bar SET NOT NULL; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_set_not_null/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..0cd442222e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_table_set_not_null/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a5e129a249 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); +ALTER TABLE foo ALTER bar SET NOT NULL; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_set_schema/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/models.go deleted file mode 100644 index ee7eb6e406..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/models.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { -} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..3d7be3b20f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FooBar struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..9e6b8735c7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getFooBar = `-- name: GetFooBar :exec +SELECT name FROM foo.bar +` + +func (q *Queries) GetFooBar(ctx context.Context) error { + _, err := q.db.Exec(ctx, getFooBar) + return err +} + +const updateFooBar = `-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1 +` + +func (q *Queries) UpdateFooBar(ctx context.Context, name sql.NullString) error { + _, err := q.db.Exec(ctx, updateFooBar, name) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..9d28274e0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: GetFooBar :exec +SELECT * FROM foo.bar; + +-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ac617b3f55 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE bar (name text); +ALTER TABLE bar SET SCHEMA foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..8e1f8559b0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type FooBar struct { + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..01336b0e2f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getFooBar = `-- name: GetFooBar :exec +SELECT name FROM foo.bar +` + +func (q *Queries) GetFooBar(ctx context.Context) error { + _, err := q.db.Exec(ctx, getFooBar) + return err +} + +const updateFooBar = `-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1 +` + +func (q *Queries) UpdateFooBar(ctx context.Context, name pgtype.Text) error { + _, err := q.db.Exec(ctx, updateFooBar, name) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..9d28274e0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: GetFooBar :exec +SELECT * FROM foo.bar; + +-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ac617b3f55 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE bar (name text); +ALTER TABLE bar SET SCHEMA foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/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/ddl_alter_table_set_schema/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/schema.sql deleted file mode 100644 index eb10fc9067..0000000000 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/schema.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE bar (); -ALTER TABLE bar SET SCHEMA foo; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..3d7be3b20f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type FooBar struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..fbff09c49d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getFooBar = `-- name: GetFooBar :exec +SELECT name FROM foo.bar +` + +func (q *Queries) GetFooBar(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, getFooBar) + return err +} + +const updateFooBar = `-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1 +` + +func (q *Queries) UpdateFooBar(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, updateFooBar, name) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..9d28274e0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetFooBar :exec +SELECT * FROM foo.bar; + +-- name: UpdateFooBar :exec +UPDATE foo.bar SET name = $1; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ac617b3f55 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE bar (name text); +ALTER TABLE bar SET SCHEMA foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_args/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_type_add_value/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/models.go deleted file mode 100644 index e0d860096d..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/models.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -type Status string - -const ( - StatusOpen Status = "open" - StatusClosed Status = "closed" - StatusUnknown Status = "unknown" -) - -func (e *Status) Scan(src interface{}) 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 -} diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..f539efec15 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusClosed Status = "closed" + StatusUnknown Status = "unknown" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..f539efec15 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusClosed Status = "closed" + StatusUnknown Status = "unknown" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..4fede5d227 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +ALTER TYPE status ADD VALUE 'unknown'; +ALTER TYPE status ADD VALUE IF NOT EXISTS 'unknown'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/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/ddl_alter_type_add_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_type_add_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f539efec15 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusClosed Status = "closed" + StatusUnknown Status = "unknown" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_type_add_value/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..4fede5d227 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +ALTER TYPE status ADD VALUE 'unknown'; +ALTER TYPE status ADD VALUE IF NOT EXISTS 'unknown'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_alter_type_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..01b4373918 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_alter_type_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..01b4373918 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/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/ddl_alter_type_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_type_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..89a510acd2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_schema/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..01b4373918 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..01b4373918 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..34a1484113 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent +} 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 new file mode 100644 index 0000000000..89a510acd2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &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/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_type_rename_value/postgresql/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/models.go deleted file mode 100644 index 798f3114d9..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/models.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -type Status string - -const ( - StatusOpen Status = "open" - StatusShut Status = "shut" -) - -func (e *Status) Scan(src interface{}) 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 -} diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..3b2d5ea724 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusShut Status = "shut" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..3b2d5ea724 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusShut Status = "shut" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ba623d5fd --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +ALTER TYPE status RENAME VALUE 'closed' TO 'shut'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/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/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_type_rename_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..3b2d5ea724 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusOpen Status = "open" + StatusShut Status = "shut" +) + +func (e *Status) Scan(src interface{}) 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 interface{}) 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 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_alter_type_rename_value/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ba623d5fd --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +ALTER TYPE status RENAME VALUE 'closed' TO 'shut'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..01922dfc08 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go @@ -0,0 +1,103 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Level string + +const ( + LevelDEBUG Level = "DEBUG" + LevelINFO Level = "INFO" + LevelWARN Level = "WARN" + LevelERROR Level = "ERROR" + LevelFATAL Level = "FATAL" +) + +func (e *Level) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Level(s) + case string: + *e = Level(s) + default: + return fmt.Errorf("unsupported scan type for Level: %T", src) + } + return nil +} + +type NullLevel struct { + Level Level + Valid bool // Valid is true if Level is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullLevel) Scan(value interface{}) error { + if value == nil { + ns.Level, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Level.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullLevel) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Level), nil +} + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent + Level Level +} 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 new file mode 100644 index 0000000000..6ad1109d83 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status, level FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &i.Status, &i.Level); 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_alter_type_set_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..01922dfc08 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go @@ -0,0 +1,103 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Level string + +const ( + LevelDEBUG Level = "DEBUG" + LevelINFO Level = "INFO" + LevelWARN Level = "WARN" + LevelERROR Level = "ERROR" + LevelFATAL Level = "FATAL" +) + +func (e *Level) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Level(s) + case string: + *e = Level(s) + default: + return fmt.Errorf("unsupported scan type for Level: %T", src) + } + return nil +} + +type NullLevel struct { + Level Level + Valid bool // Valid is true if Level is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullLevel) Scan(value interface{}) error { + if value == nil { + ns.Level, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Level.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullLevel) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Level), nil +} + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent + Level Level +} 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 new file mode 100644 index 0000000000..6ad1109d83 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status, level FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &i.Status, &i.Level); 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_alter_type_set_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/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/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_type_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..01922dfc08 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go @@ -0,0 +1,103 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Level string + +const ( + LevelDEBUG Level = "DEBUG" + LevelINFO Level = "INFO" + LevelWARN Level = "WARN" + LevelERROR Level = "ERROR" + LevelFATAL Level = "FATAL" +) + +func (e *Level) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Level(s) + case string: + *e = Level(s) + default: + return fmt.Errorf("unsupported scan type for Level: %T", src) + } + return nil +} + +type NullLevel struct { + Level Level + Valid bool // Valid is true if Level is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullLevel) Scan(value interface{}) error { + if value == nil { + ns.Level, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Level.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullLevel) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Level), nil +} + +type NewEvent string + +const ( + NewEventSTART NewEvent = "START" + NewEventSTOP NewEvent = "STOP" +) + +func (e *NewEvent) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = NewEvent(s) + case string: + *e = NewEvent(s) + default: + return fmt.Errorf("unsupported scan type for NewEvent: %T", src) + } + return nil +} + +type NullNewEvent struct { + NewEvent NewEvent + Valid bool // Valid is true if NewEvent is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullNewEvent) Scan(value interface{}) error { + if value == nil { + ns.NewEvent, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.NewEvent.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullNewEvent) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.NewEvent), nil +} + +type LogLine struct { + ID int64 + Status NewEvent + Level Level +} 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 new file mode 100644 index 0000000000..991a72e41c --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, status, level FROM log_lines +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LogLine + for rows.Next() { + var i LogLine + if err := rows.Scan(&i.ID, &i.Status, &i.Level); 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_type_set_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..92575af773 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go index 4c986d07ab..f81de56f8a 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_comment/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_comment/postgresql/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/go/models.go deleted file mode 100644 index da99bb0f2e..0000000000 --- a/internal/endtoend/testdata/ddl_comment/postgresql/go/models.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" - "fmt" -) - -// Enum comment -type FooBat string - -const ( - FooBatBat FooBat = "bat" -) - -func (e *FooBat) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = FooBat(s) - case string: - *e = FooBat(s) - default: - return fmt.Errorf("unsupported scan type for FooBat: %T", src) - } - return nil -} - -// Table comment -type FooBar struct { - // Column comment - Baz sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_comment/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_comment/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_comment/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..21fb81be1d --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +// Enum comment +type FooBat string + +const ( + FooBatBat FooBat = "bat" +) + +func (e *FooBat) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooBat(s) + case string: + *e = FooBat(s) + default: + return fmt.Errorf("unsupported scan type for FooBat: %T", src) + } + return nil +} + +type NullFooBat struct { + FooBat FooBat + Valid bool // Valid is true if FooBat is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooBat) Scan(value interface{}) error { + if value == nil { + ns.FooBat, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooBat.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooBat) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooBat), nil +} + +// Table comment +type FooBar struct { + // Column comment + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/schema.sql b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_comment/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_comment/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7a69cf3252 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" + + "github.com/jackc/pgx/v5/pgtype" +) + +// Enum comment +type FooBat string + +const ( + FooBatBat FooBat = "bat" +) + +func (e *FooBat) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooBat(s) + case string: + *e = FooBat(s) + default: + return fmt.Errorf("unsupported scan type for FooBat: %T", src) + } + return nil +} + +type NullFooBat struct { + FooBat FooBat + Valid bool // Valid is true if FooBat is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooBat) Scan(value interface{}) error { + if value == nil { + ns.FooBat, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooBat.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooBat) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooBat), nil +} + +// Table comment +type FooBar struct { + // Column comment + Baz pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..313e88c3ed --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (baz text); +CREATE TYPE foo.bat AS ENUM ('bat'); +COMMENT ON SCHEMA foo IS 'Schema comment'; +COMMENT ON TABLE foo.bar IS 'Table comment'; +COMMENT ON COLUMN foo.bar.baz IS 'Column comment'; +COMMENT ON TYPE foo.bat IS 'Enum comment'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/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/ddl_comment/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_comment/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..21fb81be1d --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +// Enum comment +type FooBat string + +const ( + FooBatBat FooBat = "bat" +) + +func (e *FooBat) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooBat(s) + case string: + *e = FooBat(s) + default: + return fmt.Errorf("unsupported scan type for FooBat: %T", src) + } + return nil +} + +type NullFooBat struct { + FooBat FooBat + Valid bool // Valid is true if FooBat is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooBat) Scan(value interface{}) error { + if value == nil { + ns.FooBat, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooBat.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooBat) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooBat), nil +} + +// Table comment +type FooBar struct { + // Column comment + Baz sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_comment/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..313e88c3ed --- /dev/null +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (baz text); +CREATE TYPE foo.bat AS ENUM ('bat'); +COMMENT ON SCHEMA foo IS 'Schema comment'; +COMMENT ON TABLE foo.bar IS 'Table comment'; +COMMENT ON COLUMN foo.bar.baz IS 'Column comment'; +COMMENT ON TYPE foo.bat IS 'Enum comment'; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_comment/postgresql/stdlib/sqlc.json 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 8210fa62d9..bceedb5629 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go @@ -1,11 +1,66 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest import ( + "database/sql/driver" "fmt" ) +type FooDigit string + +const ( + FooDigit0 FooDigit = "0" + FooDigit1 FooDigit = "1" + FooDigit2 FooDigit = "2" + FooDigit3 FooDigit = "3" + FooDigit4 FooDigit = "4" + FooDigit5 FooDigit = "5" + FooDigit6 FooDigit = "6" + FooDigit7 FooDigit = "7" + FooDigit8 FooDigit = "8" + FooDigit9 FooDigit = "9" + FooDigitValue10 FooDigit = "#" + FooDigitValue11 FooDigit = "*" +) + +func (e *FooDigit) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooDigit(s) + case string: + *e = FooDigit(s) + default: + return fmt.Errorf("unsupported scan type for FooDigit: %T", src) + } + return nil +} + +type NullFooDigit struct { + FooDigit FooDigit + Valid bool // Valid is true if FooDigit is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooDigit) Scan(value interface{}) error { + if value == nil { + ns.FooDigit, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooDigit.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooDigit) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooDigit), nil +} + type FooFoobar string const ( @@ -30,6 +85,30 @@ func (e *FooFoobar) Scan(src interface{}) error { return nil } +type NullFooFoobar struct { + FooFoobar FooFoobar + Valid bool // Valid is true if FooFoobar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooFoobar) Scan(value interface{}) error { + if value == nil { + ns.FooFoobar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooFoobar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooFoobar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooFoobar), nil +} + type Foo struct { Foobar FooFoobar + Digit FooDigit } 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 d766aa93ca..279c549bd6 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -8,22 +10,22 @@ import ( ) const listFoo = `-- name: ListFoo :many -SELECT foobar FROM foo +SELECT foobar, digit FROM foo ` -func (q *Queries) ListFoo(ctx context.Context) ([]FooFoobar, error) { +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { rows, err := q.db.QueryContext(ctx, listFoo) if err != nil { return nil, err } defer rows.Close() - var items []FooFoobar + var items []Foo for rows.Next() { - var foobar FooFoobar - if err := rows.Scan(&foobar); err != nil { + var i Foo + if err := rows.Scan(&i.Foobar, &i.Digit); err != nil { return nil, err } - items = append(items, foobar) + items = append(items, i) } if err := rows.Close(); err != nil { return nil, err diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/schema.sql b/internal/endtoend/testdata/ddl_create_enum/mysql/schema.sql index 98c2c56f06..da7818d909 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/schema.sql +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/schema.sql @@ -1,3 +1,4 @@ CREATE TABLE foo ( - foobar ENUM ('foo-a', 'foo_b', 'foo:c', 'foo/d', 'foo@e', 'foo+f', 'foo!g') NOT NULL + foobar ENUM ('foo-a', 'foo_b', 'foo:c', 'foo/d', 'foo@e', 'foo+f', 'foo!g') NOT NULL, + digit ENUM ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '#', '*') NOT NULL ); diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_enum/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/go/models.go deleted file mode 100644 index d4423cdb40..0000000000 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/go/models.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -type Foobar string - -const ( - FoobarFooA Foobar = "foo-a" - FoobarFooB Foobar = "foo_b" - FoobarFooC Foobar = "foo:c" - FoobarFooD Foobar = "foo/d" - FoobarFooe Foobar = "foo@e" - FoobarFoof Foobar = "foo+f" - FoobarFoog Foobar = "foo!g" -) - -func (e *Foobar) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = Foobar(s) - case string: - *e = Foobar(s) - default: - return fmt.Errorf("unsupported scan type for Foobar: %T", src) - } - return nil -} - -type Foo struct { - Val Foobar -} diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/go/query.sql.go deleted file mode 100644 index 85347b0255..0000000000 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listFoo = `-- name: ListFoo :many -SELECT val FROM foo -` - -func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { - rows, err := q.db.QueryContext(ctx, listFoo) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foobar - for rows.Next() { - var val Foobar - if err := rows.Scan(&val); err != nil { - return nil, err - } - items = append(items, val) - } - 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_create_enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..6a0cfe3560 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go @@ -0,0 +1,113 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Digit string + +const ( + Digit0 Digit = "0" + Digit1 Digit = "1" + Digit2 Digit = "2" + Digit3 Digit = "3" + Digit4 Digit = "4" + Digit5 Digit = "5" + Digit6 Digit = "6" + Digit7 Digit = "7" + Digit8 Digit = "8" + Digit9 Digit = "9" + DigitValue10 Digit = "#" + DigitValue11 Digit = "*" +) + +func (e *Digit) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Digit(s) + case string: + *e = Digit(s) + default: + return fmt.Errorf("unsupported scan type for Digit: %T", src) + } + return nil +} + +type NullDigit struct { + Digit Digit + Valid bool // Valid is true if Digit is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullDigit) Scan(value interface{}) error { + if value == nil { + ns.Digit, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Digit.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullDigit) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Digit), nil +} + +type Foobar string + +const ( + FoobarFooA Foobar = "foo-a" + FoobarFooB Foobar = "foo_b" + FoobarFooC Foobar = "foo:c" + FoobarFooD Foobar = "foo/d" + FoobarFooe Foobar = "foo@e" + FoobarFoof Foobar = "foo+f" + FoobarFoog Foobar = "foo!g" +) + +func (e *Foobar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Foobar(s) + case string: + *e = Foobar(s) + default: + return fmt.Errorf("unsupported scan type for Foobar: %T", src) + } + return nil +} + +type NullFoobar struct { + Foobar Foobar + Valid bool // Valid is true if Foobar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFoobar) Scan(value interface{}) error { + if value == nil { + ns.Foobar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Foobar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFoobar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Foobar), nil +} + +type Foo struct { + Val Foobar +} 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 new file mode 100644 index 0000000000..3cbd273217 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT val FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foobar + for rows.Next() { + var val Foobar + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/query.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_enum/postgresql/query.sql rename to internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0ba7f1ac8b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/schema.sql @@ -0,0 +1,28 @@ +CREATE TYPE foobar AS ENUM ( + -- Valid separators + 'foo-a', + 'foo_b', + 'foo:c', + 'foo/d', + -- Strip unknown characters + 'foo@e', + 'foo+f', + 'foo!g' +); + +CREATE TYPE "digit" AS ENUM ( + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '#', + '*' +); + +CREATE TABLE foo (val foobar NOT NULL); diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..6a0cfe3560 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go @@ -0,0 +1,113 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Digit string + +const ( + Digit0 Digit = "0" + Digit1 Digit = "1" + Digit2 Digit = "2" + Digit3 Digit = "3" + Digit4 Digit = "4" + Digit5 Digit = "5" + Digit6 Digit = "6" + Digit7 Digit = "7" + Digit8 Digit = "8" + Digit9 Digit = "9" + DigitValue10 Digit = "#" + DigitValue11 Digit = "*" +) + +func (e *Digit) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Digit(s) + case string: + *e = Digit(s) + default: + return fmt.Errorf("unsupported scan type for Digit: %T", src) + } + return nil +} + +type NullDigit struct { + Digit Digit + Valid bool // Valid is true if Digit is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullDigit) Scan(value interface{}) error { + if value == nil { + ns.Digit, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Digit.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullDigit) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Digit), nil +} + +type Foobar string + +const ( + FoobarFooA Foobar = "foo-a" + FoobarFooB Foobar = "foo_b" + FoobarFooC Foobar = "foo:c" + FoobarFooD Foobar = "foo/d" + FoobarFooe Foobar = "foo@e" + FoobarFoof Foobar = "foo+f" + FoobarFoog Foobar = "foo!g" +) + +func (e *Foobar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Foobar(s) + case string: + *e = Foobar(s) + default: + return fmt.Errorf("unsupported scan type for Foobar: %T", src) + } + return nil +} + +type NullFoobar struct { + Foobar Foobar + Valid bool // Valid is true if Foobar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFoobar) Scan(value interface{}) error { + if value == nil { + ns.Foobar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Foobar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFoobar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Foobar), nil +} + +type Foo struct { + Val Foobar +} 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 new file mode 100644 index 0000000000..3cbd273217 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT val FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foobar + for rows.Next() { + var val Foobar + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/multischema/sql/query.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/multischema/sql/query.sql rename to internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0ba7f1ac8b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/schema.sql @@ -0,0 +1,28 @@ +CREATE TYPE foobar AS ENUM ( + -- Valid separators + 'foo-a', + 'foo_b', + 'foo:c', + 'foo/d', + -- Strip unknown characters + 'foo@e', + 'foo+f', + 'foo!g' +); + +CREATE TYPE "digit" AS ENUM ( + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '#', + '*' +); + +CREATE TABLE foo (val foobar NOT NULL); diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/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/ddl_create_enum/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/schema.sql deleted file mode 100644 index 252f31dc93..0000000000 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TYPE foobar AS ENUM ( - -- Valid separators - 'foo-a', - 'foo_b', - 'foo:c', - 'foo/d', - -- Strip unknown characters - 'foo@e', - 'foo+f', - 'foo!g' -); - -CREATE TABLE foo (val foobar NOT NULL); 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..6a0cfe3560 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go @@ -0,0 +1,113 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type Digit string + +const ( + Digit0 Digit = "0" + Digit1 Digit = "1" + Digit2 Digit = "2" + Digit3 Digit = "3" + Digit4 Digit = "4" + Digit5 Digit = "5" + Digit6 Digit = "6" + Digit7 Digit = "7" + Digit8 Digit = "8" + Digit9 Digit = "9" + DigitValue10 Digit = "#" + DigitValue11 Digit = "*" +) + +func (e *Digit) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Digit(s) + case string: + *e = Digit(s) + default: + return fmt.Errorf("unsupported scan type for Digit: %T", src) + } + return nil +} + +type NullDigit struct { + Digit Digit + Valid bool // Valid is true if Digit is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullDigit) Scan(value interface{}) error { + if value == nil { + ns.Digit, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Digit.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullDigit) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Digit), nil +} + +type Foobar string + +const ( + FoobarFooA Foobar = "foo-a" + FoobarFooB Foobar = "foo_b" + FoobarFooC Foobar = "foo:c" + FoobarFooD Foobar = "foo/d" + FoobarFooe Foobar = "foo@e" + FoobarFoof Foobar = "foo+f" + FoobarFoog Foobar = "foo!g" +) + +func (e *Foobar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Foobar(s) + case string: + *e = Foobar(s) + default: + return fmt.Errorf("unsupported scan type for Foobar: %T", src) + } + return nil +} + +type NullFoobar struct { + Foobar Foobar + Valid bool // Valid is true if Foobar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFoobar) Scan(value interface{}) error { + if value == nil { + ns.Foobar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Foobar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFoobar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Foobar), nil +} + +type Foo struct { + Val Foobar +} 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 new file mode 100644 index 0000000000..620055c43c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT val FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foobar + for rows.Next() { + var val Foobar + if err := rows.Scan(&val); err != nil { + return nil, err + } + items = append(items, val) + } + 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_create_enum/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0ba7f1ac8b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/schema.sql @@ -0,0 +1,28 @@ +CREATE TYPE foobar AS ENUM ( + -- Valid separators + 'foo-a', + 'foo_b', + 'foo:c', + 'foo/d', + -- Strip unknown characters + 'foo@e', + 'foo+f', + 'foo!g' +); + +CREATE TYPE "digit" AS ENUM ( + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '#', + '*' +); + +CREATE TABLE foo (val foobar NOT NULL); diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/sqlc.json 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/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_function/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_create_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8caad3e307 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE FUNCTION foo(TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/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/ddl_create_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_function/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8caad3e307 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE FUNCTION foo(TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_function_args/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_create_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_function_args/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..55b04034e2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +CREATE FUNCTION foo(bar TEXT, baz TEXT) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/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/ddl_create_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_function_args/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..55b04034e2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +CREATE FUNCTION foo(bar TEXT, baz TEXT) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_function_return/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_create_function_return/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_function_return/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..4b98ce9597 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_function_return/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..4b98ce9597 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/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/ddl_create_function_return/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/schema.sql deleted file mode 100644 index a318fb91f2..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/schema.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_function_return/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_function_return/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..4b98ce9597 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/sqlc.json b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/ddl_pg_temp/postgresql/sqlc.json rename to internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_function_types/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_create_function_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_function_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..876d0f8e80 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_function_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..876d0f8e80 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/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/ddl_create_function_types/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/schema.sql deleted file mode 100644 index b3a3f3b158..0000000000 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_function_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_function_types/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..876d0f8e80 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_function_types/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/ddl_create_procedure/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_procedure/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go new file mode 100644 index 0000000000..f4ed97c5d2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Tbl struct { + Value sql.NullInt32 +} 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 new file mode 100644 index 0000000000..bf5b8f5890 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const callInsertData = `-- name: CallInsertData :exec +CALL insert_data(?, ?) +` + +type CallInsertDataParams struct { + A int32 + B int32 +} + +func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { + _, err := q.db.ExecContext(ctx, callInsertData, arg.A, arg.B) + return err +} + +const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2) +` + +func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, callInsertDataNoArgs) + return err +} + +const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(?, ?) +` + +type CallInsertDataSqlcArgsParams struct { + Foo int32 + Bar int32 +} + +func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { + _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql b/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql new file mode 100644 index 0000000000..ff9bbadf2c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql @@ -0,0 +1,8 @@ +-- name: CallInsertData :exec +CALL insert_data(?, ?); + +-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2); + +-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(sqlc.arg('foo'), sqlc.arg('bar')); diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql b/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql new file mode 100644 index 0000000000..e3f2d0af34 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE tbl ( + value int +); + +CREATE PROCEDURE insert_data(a int, b int) +BEGIN + INSERT INTO tbl VALUES (a); + INSERT INTO tbl VALUES (b); +END; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/sqlc.json b/internal/endtoend/testdata/ddl_create_procedure/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/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/ddl_create_procedure/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_procedure/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f4ed97c5d2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Tbl struct { + Value sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3b04c9af76 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const callInsertData = `-- name: CallInsertData :exec +CALL insert_data($1, $2) +` + +type CallInsertDataParams struct { + A int32 + B int32 +} + +func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { + _, err := q.db.Exec(ctx, callInsertData, arg.A, arg.B) + return err +} + +const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2) +` + +type CallInsertDataNamedParams struct { + B int32 + A int32 +} + +func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { + _, err := q.db.Exec(ctx, callInsertDataNamed, arg.B, arg.A) + return err +} + +const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2) +` + +func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { + _, err := q.db.Exec(ctx, callInsertDataNoArgs) + return err +} + +const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +CALL insert_data($1, $2) +` + +type CallInsertDataSqlcArgsParams struct { + Foo int32 + Bar int32 +} + +func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { + _, err := q.db.Exec(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..2d8d86ad0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/query.sql @@ -0,0 +1,11 @@ +-- name: CallInsertData :exec +CALL insert_data($1, $2); + +-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2); + +-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2); + +-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(sqlc.arg('foo'), sqlc.arg('bar')); diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..55a9a2e69a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE tbl ( + value integer +); + +-- https://www.postgresql.org/docs/current/sql-createprocedure.html +CREATE PROCEDURE insert_data(a integer, b integer) +LANGUAGE SQL +AS $$ +INSERT INTO tbl VALUES (a); +INSERT INTO tbl VALUES (b); +$$; diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_procedure/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..aeb0ffd1ff --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Tbl struct { + Value pgtype.Int4 +} 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 new file mode 100644 index 0000000000..3b04c9af76 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const callInsertData = `-- name: CallInsertData :exec +CALL insert_data($1, $2) +` + +type CallInsertDataParams struct { + A int32 + B int32 +} + +func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { + _, err := q.db.Exec(ctx, callInsertData, arg.A, arg.B) + return err +} + +const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2) +` + +type CallInsertDataNamedParams struct { + B int32 + A int32 +} + +func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { + _, err := q.db.Exec(ctx, callInsertDataNamed, arg.B, arg.A) + return err +} + +const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2) +` + +func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { + _, err := q.db.Exec(ctx, callInsertDataNoArgs) + return err +} + +const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +CALL insert_data($1, $2) +` + +type CallInsertDataSqlcArgsParams struct { + Foo int32 + Bar int32 +} + +func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { + _, err := q.db.Exec(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..2d8d86ad0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/query.sql @@ -0,0 +1,11 @@ +-- name: CallInsertData :exec +CALL insert_data($1, $2); + +-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2); + +-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2); + +-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(sqlc.arg('foo'), sqlc.arg('bar')); diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..55a9a2e69a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE tbl ( + value integer +); + +-- https://www.postgresql.org/docs/current/sql-createprocedure.html +CREATE PROCEDURE insert_data(a integer, b integer) +LANGUAGE SQL +AS $$ +INSERT INTO tbl VALUES (a); +INSERT INTO tbl VALUES (b); +$$; diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/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/ddl_create_procedure/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_procedure/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f4ed97c5d2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Tbl struct { + Value sql.NullInt32 +} 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 new file mode 100644 index 0000000000..b7059b0a78 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const callInsertData = `-- name: CallInsertData :exec +CALL insert_data($1, $2) +` + +type CallInsertDataParams struct { + A int32 + B int32 +} + +func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { + _, err := q.db.ExecContext(ctx, callInsertData, arg.A, arg.B) + return err +} + +const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2) +` + +type CallInsertDataNamedParams struct { + B int32 + A int32 +} + +func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { + _, err := q.db.ExecContext(ctx, callInsertDataNamed, arg.B, arg.A) + return err +} + +const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2) +` + +func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, callInsertDataNoArgs) + return err +} + +const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +CALL insert_data($1, $2) +` + +type CallInsertDataSqlcArgsParams struct { + Foo int32 + Bar int32 +} + +func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { + _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..2d8d86ad0c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: CallInsertData :exec +CALL insert_data($1, $2); + +-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2); + +-- name: CallInsertDataNamed :exec +CALL insert_data(b => $1, a => $2); + +-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(sqlc.arg('foo'), sqlc.arg('bar')); diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..55a9a2e69a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE tbl ( + value integer +); + +-- https://www.postgresql.org/docs/current/sql-createprocedure.html +CREATE PROCEDURE insert_data(a integer, b integer) +LANGUAGE SQL +AS $$ +INSERT INTO tbl VALUES (a); +INSERT INTO tbl VALUES (b); +$$; diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/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/ddl_create_table/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 1824ef8794..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_create_table/postgresql/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/go/models.go deleted file mode 100644 index 1824ef8794..0000000000 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Venue struct { - Name sql.NullString -} diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_create_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..c43b161fde --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/schema.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_create_table/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..81249afc4a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Venue struct { + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..78e89cbf4f --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE venues (name text); diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/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/ddl_create_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..c43b161fde --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..78e89cbf4f --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE venues (name text); diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/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/ddl_create_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go new file mode 100644 index 0000000000..c43b161fde --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table/sqlite/query.sql b/internal/endtoend/testdata/ddl_create_table/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/schema.sql b/internal/endtoend/testdata/ddl_create_table/sqlite/schema.sql new file mode 100644 index 0000000000..6bcf8cee7d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE venues (name text); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_create_table/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table/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_create_table_include/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_include/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4c34036e2c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + B int32 + C sql.NullInt32 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..db08b9d26d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + PRIMARY KEY (a, b) INCLUDE (c), + a integer, + b integer, + c integer +); diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_include/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..dbc5cbd8b1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A int32 + B int32 + C pgtype.Int4 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..db08b9d26d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + PRIMARY KEY (a, b) INCLUDE (c), + a integer, + b integer, + c integer +); diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/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/ddl_create_table_include/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_include/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4c34036e2c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + B int32 + C sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_include/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..db08b9d26d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + PRIMARY KEY (a, b) INCLUDE (c), + a integer, + b integer, + c integer +); diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_include/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/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_inherits/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..87aff71db6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Llc struct { + PartyID uuid.UUID + Name string + LegalName string + IncorporationDate sql.NullTime +} + +type Organisation struct { + PartyID uuid.UUID + Name string + LegalName string +} + +type Party struct { + PartyID uuid.UUID + Name string +} + +type Person struct { + PartyID uuid.UUID + Name string + FirstName string + LastName string +} 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 new file mode 100644 index 0000000000..4caab44ccb --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAllOrganisations = `-- name: GetAllOrganisations :many +SELECT party_id, name, legal_name FROM organisation +` + +func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { + rows, err := q.db.Query(ctx, getAllOrganisations) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Organisation + for rows.Next() { + var i Organisation + if err := rows.Scan(&i.PartyID, &i.Name, &i.LegalName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAllParties = `-- name: GetAllParties :many +SELECT party_id, name FROM party +` + +func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { + rows, err := q.db.Query(ctx, getAllParties) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Party + for rows.Next() { + var i Party + if err := rows.Scan(&i.PartyID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAllPeople = `-- name: GetAllPeople :many +SELECT party_id, name, first_name, last_name FROM person +` + +func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { + rows, err := q.db.Query(ctx, getAllPeople) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Person + for rows.Next() { + var i Person + if err := rows.Scan( + &i.PartyID, + &i.Name, + &i.FirstName, + &i.LastName, + ); 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_inherits/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..30adbd9aa1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- name: GetAllParties :many +SELECT * FROM party; + +-- name: GetAllPeople :many +SELECT * FROM person; + +-- name: GetAllOrganisations :many +SELECT * FROM organisation; diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..2da6749754 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE party ( + party_id uuid PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE person ( + first_name text NOT NULL, + last_name text NOT NULL +) INHERITS (party); + +CREATE TABLE organisation ( + legal_name text +) INHERITS (party); + +CREATE TABLE llc ( + incorporation_date timestamp, + legal_name text NOT NULL +) INHERITS (organisation); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_inherits/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..2cbc4b68a6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Llc struct { + PartyID pgtype.UUID + Name string + LegalName string + IncorporationDate pgtype.Timestamp +} + +type Organisation struct { + PartyID pgtype.UUID + Name string + LegalName string +} + +type Party struct { + PartyID pgtype.UUID + Name string +} + +type Person struct { + PartyID pgtype.UUID + Name string + FirstName string + LastName string +} 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 new file mode 100644 index 0000000000..4caab44ccb --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAllOrganisations = `-- name: GetAllOrganisations :many +SELECT party_id, name, legal_name FROM organisation +` + +func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { + rows, err := q.db.Query(ctx, getAllOrganisations) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Organisation + for rows.Next() { + var i Organisation + if err := rows.Scan(&i.PartyID, &i.Name, &i.LegalName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAllParties = `-- name: GetAllParties :many +SELECT party_id, name FROM party +` + +func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { + rows, err := q.db.Query(ctx, getAllParties) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Party + for rows.Next() { + var i Party + if err := rows.Scan(&i.PartyID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAllPeople = `-- name: GetAllPeople :many +SELECT party_id, name, first_name, last_name FROM person +` + +func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { + rows, err := q.db.Query(ctx, getAllPeople) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Person + for rows.Next() { + var i Person + if err := rows.Scan( + &i.PartyID, + &i.Name, + &i.FirstName, + &i.LastName, + ); 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_inherits/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..30adbd9aa1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: GetAllParties :many +SELECT * FROM party; + +-- name: GetAllPeople :many +SELECT * FROM person; + +-- name: GetAllOrganisations :many +SELECT * FROM organisation; diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..2da6749754 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE party ( + party_id uuid PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE person ( + first_name text NOT NULL, + last_name text NOT NULL +) INHERITS (party); + +CREATE TABLE organisation ( + legal_name text +) INHERITS (party); + +CREATE TABLE llc ( + incorporation_date timestamp, + legal_name text NOT NULL +) INHERITS (organisation); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/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/ddl_create_table_inherits/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_inherits/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..87aff71db6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Llc struct { + PartyID uuid.UUID + Name string + LegalName string + IncorporationDate sql.NullTime +} + +type Organisation struct { + PartyID uuid.UUID + Name string + LegalName string +} + +type Party struct { + PartyID uuid.UUID + Name string +} + +type Person struct { + PartyID uuid.UUID + Name string + FirstName string + LastName string +} 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 new file mode 100644 index 0000000000..fe4b5e86fa --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,96 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAllOrganisations = `-- name: GetAllOrganisations :many +SELECT party_id, name, legal_name FROM organisation +` + +func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { + rows, err := q.db.QueryContext(ctx, getAllOrganisations) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Organisation + for rows.Next() { + var i Organisation + if err := rows.Scan(&i.PartyID, &i.Name, &i.LegalName); 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 getAllParties = `-- name: GetAllParties :many +SELECT party_id, name FROM party +` + +func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { + rows, err := q.db.QueryContext(ctx, getAllParties) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Party + for rows.Next() { + var i Party + if err := rows.Scan(&i.PartyID, &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 getAllPeople = `-- name: GetAllPeople :many +SELECT party_id, name, first_name, last_name FROM person +` + +func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { + rows, err := q.db.QueryContext(ctx, getAllPeople) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Person + for rows.Next() { + var i Person + if err := rows.Scan( + &i.PartyID, + &i.Name, + &i.FirstName, + &i.LastName, + ); 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_create_table_inherits/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..30adbd9aa1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: GetAllParties :many +SELECT * FROM party; + +-- name: GetAllPeople :many +SELECT * FROM person; + +-- name: GetAllOrganisations :many +SELECT * FROM organisation; diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..2da6749754 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE party ( + party_id uuid PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE person ( + first_name text NOT NULL, + last_name text NOT NULL +) INHERITS (party); + +CREATE TABLE organisation ( + legal_name text +) INHERITS (party); + +CREATE TABLE llc ( + incorporation_date timestamp, + legal_name text NOT NULL +) INHERITS (organisation); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_inherits/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/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_invalid_inherits/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c7d9d233d2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetAllParties :many +SELECT * FROM party; + +-- name: GetAllOrganisations :many +SELECT * FROM organisation; diff --git a/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..4df1c0466f --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE party ( + name text NOT NULL +); + +CREATE TABLE organisation ( + name integer NOT NULL +) INHERITS (party); diff --git a/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/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/ddl_create_table_invalid_inherits/postgresql/stdlib/stderr.txt b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/stderr.txt new file mode 100644 index 0000000000..2e95325f26 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +schema.sql:1:1: column "name" has a type conflict 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..b23f089922 --- /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.30.0 + +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..2a19ba1d08 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_partition/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f2b61659d0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/google/uuid" +) + +type Foo struct { + ID uuid.UUID + OtherID uuid.UUID +} + +type Foo1 struct { + ID uuid.UUID + OtherID uuid.UUID +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..928b1302bf --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL +) PARTITION BY HASH (other_id); + +CREATE TABLE foo_1 PARTITION OF foo FOR VALUES WITH (MODULUS 10, REMAINDER 0); diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_partition/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..2021aeb9b0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + ID pgtype.UUID + OtherID pgtype.UUID +} + +type Foo1 struct { + ID pgtype.UUID + OtherID pgtype.UUID +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..928b1302bf --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL +) PARTITION BY HASH (other_id); + +CREATE TABLE foo_1 PARTITION OF foo FOR VALUES WITH (MODULUS 10, REMAINDER 0); diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/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/ddl_create_table_partition/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_partition/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f2b61659d0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/google/uuid" +) + +type Foo struct { + ID uuid.UUID + OtherID uuid.UUID +} + +type Foo1 struct { + ID uuid.UUID + OtherID uuid.UUID +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_partition/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..928b1302bf --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL +) PARTITION BY HASH (other_id); + +CREATE TABLE foo_1 PARTITION OF foo FOR VALUES WITH (MODULUS 10, REMAINDER 0); diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_partition/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/ddl_create_table_reserved/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_reserved/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go new file mode 100644 index 0000000000..93892e5783 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type XVenue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_reserved/mysql/query.sql b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/schema.sql b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/schema.sql new file mode 100644 index 0000000000..a7b4398a65 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE `x-venues` (name text); diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/sqlc.json b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/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/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..93892e5783 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type XVenue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..28fff49065 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE "x-venues" (name text); diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4289389f52 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type XVenue struct { + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..28fff49065 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE "x-venues" (name text); diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/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/ddl_create_table_reserved/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..93892e5783 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type XVenue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_reserved/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..28fff49065 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE "x-venues" (name text); diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_reserved/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/ddl_create_table_strict/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_strict/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go new file mode 100644 index 0000000000..c43b161fde --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + Name sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_strict/sqlite/query.sql b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/schema.sql b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/schema.sql new file mode 100644 index 0000000000..368491ebc9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE venues (name text) STRICT; diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_strict/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_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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_table_without_rowid/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go new file mode 100644 index 0000000000..8886ac424e --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Arena struct { + Name string + Location sql.NullString + Size int64 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_table_without_rowid/sqlite/query.sql b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/schema.sql b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/schema.sql new file mode 100644 index 0000000000..4a8bff73e5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE IF NOT EXISTS arenas (name text PRIMARY KEY, location text, size int NOT NULL) WITHOUT ROWID; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/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_create_trigger/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_trigger/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..b45d05b560 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "time" + + "github.com/google/uuid" +) + +type TddTest struct { + TestID uuid.UUID + Title string + Descr string + TsCreated time.Time + TsUpdated time.Time +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d218ce9e77 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/schema.sql @@ -0,0 +1,24 @@ +CREATE SCHEMA tdd; + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +CREATE EXTENSION IF NOT EXISTS pgcrypto + SCHEMA public + VERSION "1.3"; + +CREATE FUNCTION tdd.trigger_set_timestamp() RETURNS trigger +LANGUAGE plpgsql +AS $$BEGIN + NEW.ts_updated = NOW(); + RETURN NEW; +END; +$$; + +CREATE TABLE tdd.tests ( + test_id uuid DEFAULT uuid_generate_v4() PRIMARY KEY, + title text DEFAULT ''::text NOT NULL, + descr text DEFAULT ''::text NOT NULL, + ts_created timestamp with time zone DEFAULT now() NOT NULL, + ts_updated timestamp with time zone DEFAULT now() NOT NULL +); + +CREATE TRIGGER set_timestamp BEFORE UPDATE ON tdd.tests FOR EACH ROW EXECUTE FUNCTION tdd.trigger_set_timestamp(); diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_trigger/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f1fd7cc650 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TddTest struct { + TestID pgtype.UUID + Title string + Descr string + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d218ce9e77 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/schema.sql @@ -0,0 +1,24 @@ +CREATE SCHEMA tdd; + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +CREATE EXTENSION IF NOT EXISTS pgcrypto + SCHEMA public + VERSION "1.3"; + +CREATE FUNCTION tdd.trigger_set_timestamp() RETURNS trigger +LANGUAGE plpgsql +AS $$BEGIN + NEW.ts_updated = NOW(); + RETURN NEW; +END; +$$; + +CREATE TABLE tdd.tests ( + test_id uuid DEFAULT uuid_generate_v4() PRIMARY KEY, + title text DEFAULT ''::text NOT NULL, + descr text DEFAULT ''::text NOT NULL, + ts_created timestamp with time zone DEFAULT now() NOT NULL, + ts_updated timestamp with time zone DEFAULT now() NOT NULL +); + +CREATE TRIGGER set_timestamp BEFORE UPDATE ON tdd.tests FOR EACH ROW EXECUTE FUNCTION tdd.trigger_set_timestamp(); diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/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/ddl_create_trigger/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_trigger/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..b45d05b560 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "time" + + "github.com/google/uuid" +) + +type TddTest struct { + TestID uuid.UUID + Title string + Descr string + TsCreated time.Time + TsUpdated time.Time +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_trigger/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d218ce9e77 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/schema.sql @@ -0,0 +1,24 @@ +CREATE SCHEMA tdd; + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +CREATE EXTENSION IF NOT EXISTS pgcrypto + SCHEMA public + VERSION "1.3"; + +CREATE FUNCTION tdd.trigger_set_timestamp() RETURNS trigger +LANGUAGE plpgsql +AS $$BEGIN + NEW.ts_updated = NOW(); + RETURN NEW; +END; +$$; + +CREATE TABLE tdd.tests ( + test_id uuid DEFAULT uuid_generate_v4() PRIMARY KEY, + title text DEFAULT ''::text NOT NULL, + descr text DEFAULT ''::text NOT NULL, + ts_created timestamp with time zone DEFAULT now() NOT NULL, + ts_updated timestamp with time zone DEFAULT now() NOT NULL +); + +CREATE TRIGGER set_timestamp BEFORE UPDATE ON tdd.tests FOR EACH ROW EXECUTE FUNCTION tdd.trigger_set_timestamp(); diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/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/ddl_create_trigger/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_create_trigger/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go new file mode 100644 index 0000000000..e651fe2f3d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Customer struct { + CustID int64 + CustName sql.NullString + CustAddr sql.NullString +} + +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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_create_trigger/sqlite/query.sql b/internal/endtoend/testdata/ddl_create_trigger/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql b/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql new file mode 100644 index 0000000000..59df748064 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql @@ -0,0 +1,32 @@ +/* examples copied from https://www.sqlite.org/lang_createtrigger.html + only expectation in sqlc is that they parse, codegen is unaffected */ + +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 trigger_orders SET address = new.address WHERE customer_name = old.name; +END; + +CREATE TABLE customer( + cust_id INTEGER PRIMARY KEY, + cust_name TEXT, + cust_addr TEXT +); +CREATE VIEW customer_address AS +SELECT cust_id, cust_addr FROM customer; +CREATE TRIGGER cust_addr_chng + INSTEAD OF UPDATE OF cust_addr ON customer_address +BEGIN + UPDATE customer SET cust_addr=NEW.cust_addr + WHERE cust_id=NEW.cust_id; +END; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_create_trigger/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_trigger/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_drop_function/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_function/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_drop_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_drop_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_drop_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e88ec8530f --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +DROP FUNCTION foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/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/ddl_drop_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_function/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e88ec8530f --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +DROP FUNCTION foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function/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/ddl_drop_function_args/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_function_args/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_drop_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_drop_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_args/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_drop_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..7150d3d06d --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +DROP FUNCTION foo(text); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/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/ddl_drop_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_function_args/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7150d3d06d --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; +DROP FUNCTION foo(text); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_args/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/ddl_drop_function_if_exists/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_function_if_exists/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1265430689 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +DROP FUNCTION IF EXISTS bar; +DROP FUNCTION IF EXISTS bar(); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/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/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_function_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_function_if_exists/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1265430689 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +DROP FUNCTION IF EXISTS bar; +DROP FUNCTION IF EXISTS bar(); \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/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/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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 4e2b892600..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go @@ -1,5 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 203f0fe62c..3f59aec9b9 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_schema/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_drop_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_drop_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0b9d918da0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (baz text); +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_drop_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0b9d918da0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (baz text); +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/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/ddl_drop_schema/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/schema.sql deleted file mode 100644 index 8553bb9e05..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/schema.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0b9d918da0 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (baz text); +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/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/ddl_drop_schema_if_exists/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_schema_if_exists/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f39997eddc --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +DROP SCHEMA IF EXISTS foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/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/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_schema_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_schema_if_exists/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..f39997eddc --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +DROP SCHEMA IF EXISTS foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/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/ddl_drop_table/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_table/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_drop_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_drop_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_drop_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..4b50366582 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (); +DROP TABLE venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/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/ddl_drop_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..4b50366582 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (); +DROP TABLE venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/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/ddl_drop_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table/sqlite/query.sql b/internal/endtoend/testdata/ddl_drop_table/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql new file mode 100644 index 0000000000..c0b8f00ed1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE venues (hi text); +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/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_drop_table/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table/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_drop_table_if_exists/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_table_if_exists/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ecaee7dc69 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE venues (); +DROP TABLE IF EXISTS venues; +DROP TABLE IF EXISTS venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/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/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_table_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table_if_exists/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ecaee7dc69 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE venues (); +DROP TABLE IF EXISTS venues; +DROP TABLE IF EXISTS venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/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/ddl_drop_table_if_exists/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_table_if_exists/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table_if_exists/sqlite/query.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/schema.sql b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/schema.sql new file mode 100644 index 0000000000..3233bad12f --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE venues (hi text); +DROP TABLE IF EXISTS venues; +DROP TABLE IF EXISTS venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/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_drop_table_in_schema/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_table_in_schema/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..7567dfb29e --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (); +DROP TABLE public.venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/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/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_table_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_table_in_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7567dfb29e --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE venues (); +DROP TABLE public.venues; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/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/ddl_drop_type/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_type/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_drop_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_drop_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_drop_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..437084d626 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/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/ddl_drop_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_type/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..437084d626 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type/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/ddl_drop_type_if_exists/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_type_if_exists/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8910499e91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE IF EXISTS status; +DROP TYPE IF EXISTS status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/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/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_type_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_type_if_exists/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8910499e91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE IF EXISTS status; +DROP TYPE IF EXISTS status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/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/ddl_drop_type_in_schema/postgresql/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_drop_type_in_schema/postgresql/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/schema.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/schema.sql rename to internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..902406ee69 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE public.status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/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/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_drop_type_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_drop_type_in_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..902406ee69 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TYPE status AS ENUM ('open', 'closed'); +DROP TYPE public.status; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/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/ddl_generated_columns/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_generated_columns/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..90fc088b4d --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Description struct { + ID string + Txt sql.NullString +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8df3af69b2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +create table descriptions ( + id varchar(32) GENERATED ALWAYS AS (MD5(txt)) STORED, + txt text, + primary key (id) +); diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_generated_columns/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7851cb18be --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Description struct { + ID string + Txt pgtype.Text +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8df3af69b2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +create table descriptions ( + id varchar(32) GENERATED ALWAYS AS (MD5(txt)) STORED, + txt text, + primary key (id) +); diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/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/ddl_generated_columns/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_generated_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..90fc088b4d --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Description struct { + ID string + Txt sql.NullString +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_generated_columns/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8df3af69b2 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +create table descriptions ( + id varchar(32) GENERATED ALWAYS AS (MD5(txt)) STORED, + txt text, + primary key (id) +); diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_generated_columns/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/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/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_pg_temp/postgresql/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/models.go deleted file mode 100644 index 62310d9e42..0000000000 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type PgTempMigrate struct { - Val sql.NullInt32 -} diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/query.sql.go deleted file mode 100644 index 203f0fe62c..0000000000 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// 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/ddl_pg_temp/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_pg_temp/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..99dabef55e --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type NewTable struct { + Val sql.NullInt32 +} + +type OldTable struct { + Val sql.NullInt32 +} + +type PgTempMigrate struct { + Val sql.NullInt32 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..c02d6df65e --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); +CREATE TABLE pg_temp.migrate (val SERIAL); +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_pg_temp/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..8592a198af --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type NewTable struct { + Val pgtype.Int4 +} + +type OldTable struct { + Val pgtype.Int4 +} + +type PgTempMigrate struct { + Val pgtype.Int4 +} 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 new file mode 100644 index 0000000000..d490737c00 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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.Exec(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..c02d6df65e --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); +CREATE TABLE pg_temp.migrate (val SERIAL); +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/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/ddl_pg_temp/postgresql/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/schema.sql deleted file mode 100644 index 23a15e7842..0000000000 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/schema.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE pg_temp.migrate (val SERIAL); -INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_pg_temp/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..99dabef55e --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type NewTable struct { + Val sql.NullInt32 +} + +type OldTable struct { + Val sql.NullInt32 +} + +type PgTempMigrate struct { + Val sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/ddl_pg_temp/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c02d6df65e --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); +CREATE TABLE pg_temp.migrate (val SERIAL); +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/ddl_pg_temp/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/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..3895084dc3 --- /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.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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..b2288a73cf --- /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.30.0 + +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..6b935d3625 --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..79b9c0ebc3 --- /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.30.0 + +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..6b935d3625 --- /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.30.0 +// 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/delete_from/mysql/go/db.go b/internal/endtoend/testdata/delete_from/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/db.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/mysql/go/models.go b/internal/endtoend/testdata/delete_from/mysql/go/models.go index b443f16b28..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/models.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 6410ada1d7..1691acb0c2 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/mysql/query.sql b/internal/endtoend/testdata/delete_from/mysql/query.sql index dbf6a1508a..b47bfc4f4c 100644 --- a/internal/endtoend/testdata/delete_from/mysql/query.sql +++ b/internal/endtoend/testdata/delete_from/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id text not null); - /* name: DeleteFrom :exec */ DELETE FROM foo WHERE id = ?; diff --git a/internal/endtoend/testdata/delete_from/mysql/schema.sql b/internal/endtoend/testdata/delete_from/mysql/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/mysql/sqlc.json b/internal/endtoend/testdata/delete_from/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/delete_from/mysql/sqlc.json +++ b/internal/endtoend/testdata/delete_from/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/delete_from/postgresql/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/delete_from/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/delete_from/postgresql/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/go/models.go deleted file mode 100644 index b443f16b28..0000000000 --- a/internal/endtoend/testdata/delete_from/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - ID string -} diff --git a/internal/endtoend/testdata/delete_from/postgresql/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/go/query.sql.go deleted file mode 100644 index c64636e335..0000000000 --- a/internal/endtoend/testdata/delete_from/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const deleteFrom = `-- name: DeleteFrom :exec -DELETE FROM foo WHERE id = $1 -` - -func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.ExecContext(ctx, deleteFrom, id) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2ee4810a1a --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteFrom = `-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1 +` + +func (q *Queries) DeleteFrom(ctx context.Context, id string) error { + _, err := q.db.Exec(ctx, deleteFrom, id) + return err +} diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ed305f4b2c --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2ee4810a1a --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteFrom = `-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1 +` + +func (q *Queries) DeleteFrom(ctx context.Context, id string) error { + _, err := q.db.Exec(ctx, deleteFrom, id) + return err +} diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ed305f4b2c --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/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/delete_from/postgresql/query.sql b/internal/endtoend/testdata/delete_from/postgresql/query.sql deleted file mode 100644 index 09734fdbc5..0000000000 --- a/internal/endtoend/testdata/delete_from/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (id text not null); - --- name: DeleteFrom :exec -DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/delete_from/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/delete_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..923b59d51a --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteFrom = `-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1 +` + +func (q *Queries) DeleteFrom(ctx context.Context, id string) error { + _, err := q.db.ExecContext(ctx, deleteFrom, id) + return err +} diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql b/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ed305f4b2c --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/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/delete_from/sqlite/go/db.go b/internal/endtoend/testdata/delete_from/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/delete_from/sqlite/go/models.go b/internal/endtoend/testdata/delete_from/sqlite/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/delete_from/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1691acb0c2 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteFrom = `-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = ? +` + +func (q *Queries) DeleteFrom(ctx context.Context, id string) error { + _, err := q.db.ExecContext(ctx, deleteFrom, id) + return err +} diff --git a/internal/endtoend/testdata/delete_from/sqlite/query.sql b/internal/endtoend/testdata/delete_from/sqlite/query.sql new file mode 100644 index 0000000000..c222adb821 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteFrom :exec +DELETE FROM foo WHERE id = ?; diff --git a/internal/endtoend/testdata/delete_from/sqlite/schema.sql b/internal/endtoend/testdata/delete_from/sqlite/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/delete_from/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/delete_from/sqlite/sqlc.json b/internal/endtoend/testdata/delete_from/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/delete_from/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/delete_inner_join/mysql/go/db.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/delete_inner_join/mysql/go/models.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go new file mode 100644 index 0000000000..d10385dde7 --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Author struct { + ID uint32 + Name string +} + +type AuthorBook struct { + AuthorID uint32 + BookID uint32 +} + +type Book struct { + ID uint32 + Title 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 new file mode 100644 index 0000000000..c61efcac1c --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const removeAllAuthorsFromTheGreatGatsby = `-- name: RemoveAllAuthorsFromTheGreatGatsby :exec +DELETE author_book +FROM + author_book + INNER JOIN book ON book.id = author_book.book_id +WHERE + book.title = 'The Great Gatsby' +` + +func (q *Queries) RemoveAllAuthorsFromTheGreatGatsby(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, removeAllAuthorsFromTheGreatGatsby) + return err +} diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/query.sql b/internal/endtoend/testdata/delete_inner_join/mysql/query.sql new file mode 100644 index 0000000000..58f27474cf --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/query.sql @@ -0,0 +1,7 @@ +/* name: RemoveAllAuthorsFromTheGreatGatsby :exec */ +DELETE author_book +FROM + author_book + INNER JOIN book ON book.id = author_book.book_id +WHERE + book.title = 'The Great Gatsby'; \ No newline at end of file diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql b/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql new file mode 100644 index 0000000000..61c646b48a --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE author ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL +); + +CREATE TABLE book ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL +); + +CREATE TABLE author_book ( + author_id INT UNSIGNED NOT NULL, + book_id INT UNSIGNED NOT NULL, + CONSTRAINT `pk-author_book` PRIMARY KEY (author_id, book_id), + CONSTRAINT `fk-author_book-author-id` FOREIGN KEY (author_id) REFERENCES author (id), + CONSTRAINT `fk-author_book-book-id` FOREIGN KEY (book_id) REFERENCES book (id) +); + diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json b/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/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/delete_join/mysql/db/db.go b/internal/endtoend/testdata/delete_join/mysql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/delete_join/mysql/db/models.go b/internal/endtoend/testdata/delete_join/mysql/db/models.go new file mode 100644 index 0000000000..ebf0df7b7b --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type JoinTable struct { + ID uint64 + PrimaryTableID uint64 + OtherTableID uint64 + IsActive bool +} + +type PrimaryTable struct { + ID uint64 + UserID 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 new file mode 100644 index 0000000000..adab0de2cc --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go @@ -0,0 +1,84 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const deleteJoin = `-- name: DeleteJoin :exec +DELETE jt.*, +pt.* +FROM + join_table as jt + JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + AND pt.user_id = ? +` + +type DeleteJoinParams struct { + ID uint64 + UserID uint64 +} + +func (q *Queries) DeleteJoin(ctx context.Context, arg DeleteJoinParams) error { + _, err := q.db.ExecContext(ctx, deleteJoin, arg.ID, arg.UserID) + 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.* +FROM + join_table as jt + LEFT JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + AND pt.user_id = ? +` + +type DeleteLeftJoinParams struct { + ID uint64 + UserID uint64 +} + +func (q *Queries) DeleteLeftJoin(ctx context.Context, arg DeleteLeftJoinParams) error { + _, err := q.db.ExecContext(ctx, deleteLeftJoin, arg.ID, arg.UserID) + return err +} + +const deleteRightJoin = `-- name: DeleteRightJoin :exec +DELETE jt.*, +pt.* +FROM + join_table as jt + RIGHT JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + AND pt.user_id = ? +` + +type DeleteRightJoinParams struct { + ID uint64 + UserID uint64 +} + +func (q *Queries) DeleteRightJoin(ctx context.Context, arg DeleteRightJoinParams) error { + _, err := q.db.ExecContext(ctx, deleteRightJoin, arg.ID, arg.UserID) + return err +} diff --git a/internal/endtoend/testdata/delete_join/mysql/query.sql b/internal/endtoend/testdata/delete_join/mysql/query.sql new file mode 100644 index 0000000000..d29062f90e --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/query.sql @@ -0,0 +1,34 @@ +-- name: DeleteJoin :exec +DELETE jt.*, +pt.* +FROM + join_table as jt + JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + AND pt.user_id = ?; + +-- name: DeleteLeftJoin :exec +DELETE jt.*, +pt.* +FROM + join_table as jt + LEFT JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + AND pt.user_id = ?; + +-- name: DeleteRightJoin :exec +DELETE jt.*, +pt.* +FROM + join_table as jt + RIGHT JOIN primary_table as pt ON jt.primary_table_id = pt.id +WHERE + jt.id = ? + 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_join/mysql/schema.sql b/internal/endtoend/testdata/delete_join/mysql/schema.sql new file mode 100644 index 0000000000..d0ec352052 --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE primary_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + user_id bigint(20) unsigned NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE join_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + primary_table_id bigint(20) unsigned NOT NULL, + other_table_id bigint(20) unsigned NOT NULL, + is_active tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/delete_join/mysql/sqlc.json b/internal/endtoend/testdata/delete_join/mysql/sqlc.json new file mode 100644 index 0000000000..421770653f --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..f2040e28d2 --- /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.30.0 + +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..581c1d6fb3 --- /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.30.0 +// 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/exec.json b/internal/endtoend/testdata/diff_no_output/exec.json new file mode 100644 index 0000000000..699e10bacd --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/exec.json @@ -0,0 +1,3 @@ +{ + "command": "diff" +} diff --git a/internal/endtoend/testdata/diff_no_output/go/db.go b/internal/endtoend/testdata/diff_no_output/go/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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/diff_no_output/go/models.go b/internal/endtoend/testdata/diff_no_output/go/models.go new file mode 100644 index 0000000000..0e2e889bc6 --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Book struct { + ID int64 + Title string +} diff --git a/internal/endtoend/testdata/diff_no_output/go/query.sql.go b/internal/endtoend/testdata/diff_no_output/go/query.sql.go new file mode 100644 index 0000000000..e54b0f59a1 --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/go/query.sql.go @@ -0,0 +1,83 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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 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 bio +` + +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 +} + +const selectOne = `-- name: SelectOne :one +SELECT 1 +` + +func (q *Queries) SelectOne(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, selectOne) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/diff_no_output/query.sql b/internal/endtoend/testdata/diff_no_output/query.sql new file mode 100644 index 0000000000..cc98eae93c --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/query.sql @@ -0,0 +1,18 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY bio; + +-- name: SelectOne :one +SELECT 1; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; diff --git a/internal/endtoend/testdata/diff_no_output/schema.sql b/internal/endtoend/testdata/diff_no_output/schema.sql new file mode 100644 index 0000000000..baed2e0504 --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/diff_no_output/sqlc.json b/internal/endtoend/testdata/diff_no_output/sqlc.json new file mode 100644 index 0000000000..3576609e21 --- /dev/null +++ b/internal/endtoend/testdata/diff_no_output/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "package": "authors", + "out": "go" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/diff_output/exec.json b/internal/endtoend/testdata/diff_output/exec.json new file mode 100644 index 0000000000..699e10bacd --- /dev/null +++ b/internal/endtoend/testdata/diff_output/exec.json @@ -0,0 +1,3 @@ +{ + "command": "diff" +} diff --git a/internal/endtoend/testdata/diff_output/go/db.go b/internal/endtoend/testdata/diff_output/go/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/internal/endtoend/testdata/diff_output/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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/diff_output/go/models.go b/internal/endtoend/testdata/diff_output/go/models.go new file mode 100644 index 0000000000..24e47df1ef --- /dev/null +++ b/internal/endtoend/testdata/diff_output/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/diff_output/go/query.sql.go b/internal/endtoend/testdata/diff_output/go/query.sql.go new file mode 100644 index 0000000000..bb0bc6ce56 --- /dev/null +++ b/internal/endtoend/testdata/diff_output/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/internal/endtoend/testdata/diff_output/query.sql b/internal/endtoend/testdata/diff_output/query.sql new file mode 100644 index 0000000000..cc98eae93c --- /dev/null +++ b/internal/endtoend/testdata/diff_output/query.sql @@ -0,0 +1,18 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY bio; + +-- name: SelectOne :one +SELECT 1; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; diff --git a/internal/endtoend/testdata/diff_output/schema.sql b/internal/endtoend/testdata/diff_output/schema.sql new file mode 100644 index 0000000000..baed2e0504 --- /dev/null +++ b/internal/endtoend/testdata/diff_output/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/diff_output/sqlc.json b/internal/endtoend/testdata/diff_output/sqlc.json new file mode 100644 index 0000000000..3576609e21 --- /dev/null +++ b/internal/endtoend/testdata/diff_output/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "package": "authors", + "out": "go" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/diff_output/stderr.txt b/internal/endtoend/testdata/diff_output/stderr.txt new file mode 100644 index 0000000000..e7e455436e --- /dev/null +++ b/internal/endtoend/testdata/diff_output/stderr.txt @@ -0,0 +1,55 @@ +--- a/go/models.go ++++ b/go/models.go +@@ -13,3 +13,8 @@ + Name string + Bio sql.NullString + } ++ ++type Book struct { ++ ID int64 ++ Title string ++} +--- a/go/query.sql.go ++++ b/go/query.sql.go +@@ -31,16 +31,6 @@ + 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 +@@ -55,7 +45,7 @@ + + const listAuthors = `-- name: ListAuthors :many + SELECT id, name, bio FROM authors ++ORDER BY bio +-ORDER BY name + ` + + func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { +@@ -80,3 +70,14 @@ + } + return items, nil + } ++ ++const selectOne = `-- name: SelectOne :one ++SELECT 1 ++` ++ ++func (q *Queries) SelectOne(ctx context.Context) (int32, error) { ++ row := q.db.QueryRowContext(ctx, selectOne) ++ var column_1 int32 ++ err := row.Scan(&column_1) ++ return column_1, err ++} + diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/db.go b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go new file mode 100644 index 0000000000..9d485b5f16 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + + "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 +} + +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/do/postgresql/pgx/db/models.go b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..d3515f1ede --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go new file mode 100644 index 0000000000..31b1fefa59 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const doStuff = `-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$ +` + +func (q *Queries) DoStuff(ctx context.Context) error { + _, err := q.db.Exec(ctx, doStuff) + return err +} diff --git a/internal/endtoend/testdata/do/postgresql/pgx/query.sql b/internal/endtoend/testdata/do/postgresql/pgx/query.sql new file mode 100644 index 0000000000..26a790d341 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$; diff --git a/internal/endtoend/testdata/do/postgresql/pgx/schema.sql b/internal/endtoend/testdata/do/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/do/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/do/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/do/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..b74a2efca0 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5" + } + ] +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/db.go b/internal/endtoend/testdata/do/postgresql/pq/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/do/postgresql/pq/db/models.go b/internal/endtoend/testdata/do/postgresql/pq/db/models.go new file mode 100644 index 0000000000..5041799d54 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go new file mode 100644 index 0000000000..10fa883b3d --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const doStuff = `-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$ +` + +func (q *Queries) DoStuff(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, doStuff) + return err +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/query.sql b/internal/endtoend/testdata/do/postgresql/pq/query.sql new file mode 100644 index 0000000000..26a790d341 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/query.sql @@ -0,0 +1,7 @@ +-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$; diff --git a/internal/endtoend/testdata/do/postgresql/pq/schema.sql b/internal/endtoend/testdata/do/postgresql/pq/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/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/do/postgresql/pq/sqlc.json b/internal/endtoend/testdata/do/postgresql/pq/sqlc.json new file mode 100644 index 0000000000..2a46100899 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.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/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/emit_db_and_json_tags/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_db_and_json_tags/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/go/models.go deleted file mode 100644 index 7946e7fe09..0000000000 --- a/internal/endtoend/testdata/emit_db_and_json_tags/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type User struct { - ID int32 `db:"id" json:"id"` - FirstName string `db:"first_name" json:"first_name"` - LastName sql.NullString `db:"last_name" json:"last_name"` - Age int32 `db:"age" json:"age"` -} diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/go/query.sql.go deleted file mode 100644 index 062f587b58..0000000000 --- a/internal/endtoend/testdata/emit_db_and_json_tags/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const getAll = `-- name: GetAll :many -SELECT id, first_name, last_name, age FROM users -` - -func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) - 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.FirstName, - &i.LastName, - &i.Age, - ); 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/emit_db_and_json_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_and_json_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go new file mode 100644 index 0000000000..7a8d049ca3 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id" json:"id"` + FirstName string `db:"first_name" json:"first_name"` + LastName sql.NullString `db:"last_name" json:"last_name"` + Age int32 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_and_json_tags/query.sql b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/query.sql similarity index 100% rename from internal/endtoend/testdata/emit_db_and_json_tags/query.sql rename to internal/endtoend/testdata/emit_db_and_json_tags/mysql/query.sql diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/schema.sql b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/schema.sql similarity index 100% rename from internal/endtoend/testdata/emit_db_and_json_tags/schema.sql rename to internal/endtoend/testdata/emit_db_and_json_tags/mysql/schema.sql diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlc.json b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/sqlc.json similarity index 100% rename from internal/endtoend/testdata/emit_db_and_json_tags/sqlc.json rename to internal/endtoend/testdata/emit_db_and_json_tags/mysql/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..7a8d049ca3 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id" json:"id"` + FirstName string `db:"first_name" json:"first_name"` + LastName sql.NullString `db:"last_name" json:"last_name"` + Age int32 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..ac9cb5cc66 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_star/postgresql/query.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/select_star/postgresql/query.sql rename to internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..c74e245180 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "emit_db_tags": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..3e61e3751a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + ID int32 `db:"id" json:"id"` + FirstName string `db:"first_name" json:"first_name"` + LastName pgtype.Text `db:"last_name" json:"last_name"` + Age int32 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..ac9cb5cc66 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_db_and_json_tags/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..22dee5d7ff --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/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_json_tags": true, + "emit_db_tags": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_and_json_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..7a8d049ca3 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id" json:"id"` + FirstName string `db:"first_name" json:"first_name"` + LastName sql.NullString `db:"last_name" json:"last_name"` + Age int32 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_and_json_tags/postgresql/stdlib/query.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..45dbdc427c --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "emit_db_tags": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_and_json_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go new file mode 100644 index 0000000000..6adfc71ef9 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 `db:"id" json:"id"` + FirstName string `db:"first_name" json:"first_name"` + LastName sql.NullString `db:"last_name" json:"last_name"` + Age int64 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_tags/query.sql b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/query.sql similarity index 100% rename from internal/endtoend/testdata/emit_db_tags/query.sql rename to internal/endtoend/testdata/emit_db_and_json_tags/sqlite/query.sql diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/schema.sql b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/schema.sql new file mode 100644 index 0000000000..86b83a3ddd --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + first_name varchar NOT NULL, + last_name varchar, + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/sqlc.json b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/sqlc.json new file mode 100644 index 0000000000..83a15e27ae --- /dev/null +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "sqlite", + "emit_json_tags": true, + "emit_db_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_db_tags/go/db.go b/internal/endtoend/testdata/emit_db_tags/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/emit_db_tags/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_db_tags/go/models.go b/internal/endtoend/testdata/emit_db_tags/go/models.go deleted file mode 100644 index c04fee530d..0000000000 --- a/internal/endtoend/testdata/emit_db_tags/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type User struct { - ID int32 `db:"id"` - FirstName string `db:"first_name"` - LastName sql.NullString `db:"last_name"` - Age int32 `db:"age"` -} diff --git a/internal/endtoend/testdata/emit_db_tags/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/go/query.sql.go deleted file mode 100644 index 062f587b58..0000000000 --- a/internal/endtoend/testdata/emit_db_tags/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const getAll = `-- name: GetAll :many -SELECT id, first_name, last_name, age FROM users -` - -func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) - 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.FirstName, - &i.LastName, - &i.Age, - ); 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/emit_db_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go new file mode 100644 index 0000000000..7b7052a133 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id"` + FirstName string `db:"first_name"` + LastName sql.NullString `db:"last_name"` + Age int32 `db:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_tags/mysql/query.sql b/internal/endtoend/testdata/emit_db_tags/mysql/query.sql new file mode 100644 index 0000000000..e2f85e2a9a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_tags/schema.sql b/internal/endtoend/testdata/emit_db_tags/mysql/schema.sql similarity index 100% rename from internal/endtoend/testdata/emit_db_tags/schema.sql rename to internal/endtoend/testdata/emit_db_tags/mysql/schema.sql diff --git a/internal/endtoend/testdata/emit_db_tags/sqlc.json b/internal/endtoend/testdata/emit_db_tags/mysql/sqlc.json similarity index 100% rename from internal/endtoend/testdata/emit_db_tags/sqlc.json rename to internal/endtoend/testdata/emit_db_tags/mysql/sqlc.json 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_db_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..7b7052a133 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id"` + FirstName string `db:"first_name"` + LastName sql.NullString `db:"last_name"` + Age int32 `db:"age"` +} 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 new file mode 100644 index 0000000000..ac9cb5cc66 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_db_tags/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..a96cd6de09 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/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_db_tags": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_db_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7abf837c7d --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + ID int32 `db:"id"` + FirstName string `db:"first_name"` + LastName pgtype.Text `db:"last_name"` + Age int32 `db:"age"` +} 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 new file mode 100644 index 0000000000..ac9cb5cc66 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_db_tags/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..c24ba0899e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/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_db_tags": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..7b7052a133 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 `db:"id"` + FirstName string `db:"first_name"` + LastName sql.NullString `db:"last_name"` + Age int32 `db:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_tags/postgresql/stdlib/query.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..98122fb32b --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_db_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_db_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go new file mode 100644 index 0000000000..7dabd95332 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 `db:"id"` + FirstName string `db:"first_name"` + LastName sql.NullString `db:"last_name"` + Age int64 `db:"age"` +} 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 new file mode 100644 index 0000000000..5018df0e2a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_db_tags/sqlite/query.sql b/internal/endtoend/testdata/emit_db_tags/sqlite/query.sql new file mode 100644 index 0000000000..e2f85e2a9a --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/schema.sql b/internal/endtoend/testdata/emit_db_tags/sqlite/schema.sql new file mode 100644 index 0000000000..86b83a3ddd --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + first_name varchar NOT NULL, + last_name varchar, + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/sqlc.json b/internal/endtoend/testdata/emit_db_tags/sqlite/sqlc.json new file mode 100644 index 0000000000..7e2ee44f15 --- /dev/null +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "sqlite", + "emit_db_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_empty_slices/go/db.go b/internal/endtoend/testdata/emit_empty_slices/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/emit_empty_slices/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_empty_slices/go/models.go b/internal/endtoend/testdata/emit_empty_slices/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/emit_empty_slices/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/emit_empty_slices/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/go/query.sql.go deleted file mode 100644 index 38a9a69979..0000000000 --- a/internal/endtoend/testdata/emit_empty_slices/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listBar = `-- name: ListBar :many -SELECT id FROM 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() - 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/emit_empty_slices/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_empty_slices/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..df99bb1722 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql new file mode 100644 index 0000000000..af1f130f18 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d3e0569d0f --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/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_empty_slices": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_empty_slices/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..df99bb1722 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql new file mode 100644 index 0000000000..af1f130f18 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json new file mode 100644 index 0000000000..ed890d325a --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/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_empty_slices": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_empty_slices/query.sql b/internal/endtoend/testdata/emit_empty_slices/query.sql deleted file mode 100644 index 68d61ce7e9..0000000000 --- a/internal/endtoend/testdata/emit_empty_slices/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: ListBar :many -SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/sqlc.json deleted file mode 100644 index c906b4eeb7..0000000000 --- a/internal/endtoend/testdata/emit_empty_slices/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql", - "emit_empty_slices": true - } - ] -} diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_empty_slices/stdlib/go/models.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..24ca1da9c1 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM 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() + 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/emit_empty_slices/stdlib/query.sql b/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql new file mode 100644 index 0000000000..af1f130f18 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql b/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json new file mode 100644 index 0000000000..b496f6a68d --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_empty_slices": true + } + ] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_enum_valid_and_values/go/models.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go new file mode 100644 index 0000000000..9a5c991421 --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +func (e IPProtocol) Valid() bool { + switch e { + case IPProtocolTCP, + IpProtocolIp, + IpProtocolIcmp: + return true + } + return false +} + +func AllIPProtocolValues() []IPProtocol { + return []IPProtocol{ + IPProtocolTCP, + IpProtocolIp, + IpProtocolIcmp, + } +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} 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 new file mode 100644 index 0000000000..30a1622132 --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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_enum_valid_and_values/query.sql b/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql b/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql new file mode 100644 index 0000000000..85cb7d33fb --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum ('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json b/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json new file mode 100644 index 0000000000..ffa7377573 --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json @@ -0,0 +1,22 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_enum_valid_method": true, + "emit_all_enum_values": true + } + ], + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_exported_queries/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..934bf69c13 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const UpdateBarID = `-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2 +` + +type UpdateBarIDParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { + _, err := q.db.Exec(ctx, UpdateBarID, arg.ID, arg.ID_2) + return err +} diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql new file mode 100644 index 0000000000..7591d3bd4e --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d0002132c5 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/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_exported_queries": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_exported_queries/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..934bf69c13 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const UpdateBarID = `-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2 +` + +type UpdateBarIDParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { + _, err := q.db.Exec(ctx, UpdateBarID, arg.ID, arg.ID_2) + return err +} diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql new file mode 100644 index 0000000000..7591d3bd4e --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json new file mode 100644 index 0000000000..22064cf9de --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/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_exported_queries": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_exported_queries/stdlib/go/models.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4325490a42 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const UpdateBarID = `-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2 +` + +type UpdateBarIDParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { + _, err := q.db.ExecContext(ctx, UpdateBarID, arg.ID, arg.ID_2) + return err +} diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql b/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql new file mode 100644 index 0000000000..7591d3bd4e --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateBarID :exec +UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql b/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json new file mode 100644 index 0000000000..24db62ec28 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_exported_queries": true + } + ] +} 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 new file mode 100644 index 0000000000..44139faf54 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..f5668bd976 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..a710fa5c85 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_methods_with_db_argument/mysql/query.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/query.sql new file mode 100644 index 0000000000..e2f85e2a9a --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/schema.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/schema.sql new file mode 100644 index 0000000000..3e36d6cdf7 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/sqlc.json b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/sqlc.json new file mode 100644 index 0000000000..f27ded3934 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql", + "emit_methods_with_db_argument": true + } + ] +} 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 new file mode 100644 index 0000000000..7599fccb42 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..f5668bd976 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..611c1e5874 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_methods_with_db_argument/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..069e8bc5bc --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/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_methods_with_db_argument": true + } + ] +} 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 new file mode 100644 index 0000000000..166695c170 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..f68e9f60b9 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + ID int32 + FirstName string + LastName pgtype.Text + Age int32 +} 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 new file mode 100644 index 0000000000..611c1e5874 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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_methods_with_db_argument/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..558a107985 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/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_methods_with_db_argument": true + } + ] +} 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 new file mode 100644 index 0000000000..44139faf54 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..f5668bd976 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..a710fa5c85 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_methods_with_db_argument/postgresql/stdlib/query.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ae8e46e25e --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..6acde89538 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_methods_with_db_argument": true + } + ] +} 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 new file mode 100644 index 0000000000..44139faf54 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} 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 new file mode 100644 index 0000000000..dfbb4f7e0b --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 + FirstName string + LastName sql.NullString + Age int64 +} 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 new file mode 100644 index 0000000000..a710fa5c85 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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/emit_methods_with_db_argument/sqlite/query.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/query.sql new file mode 100644 index 0000000000..e2f85e2a9a --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM users; diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/schema.sql b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/schema.sql new file mode 100644 index 0000000000..86b83a3ddd --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + first_name varchar NOT NULL, + last_name varchar, + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/sqlc.json b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/sqlc.json new file mode 100644 index 0000000000..c0107e0579 --- /dev/null +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "sqlite", + "emit_methods_with_db_argument": 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 new file mode 100644 index 0000000000..4e47262b7d --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_types/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go new file mode 100644 index 0000000000..70b1ef30f7 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go @@ -0,0 +1,111 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "time" + + "github.com/jackc/pgtype" +) + +type DtCharacter struct { + A *string + B *string + C *string + D *string + E *string +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A *time.Time + B *time.Time + C *time.Time + D *time.Time + E *time.Time + F *time.Time + G *time.Time + H *time.Time +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time + D time.Time + E time.Time + F time.Time + G time.Time + H time.Time +} + +type DtNetType struct { + A pgtype.Inet + B pgtype.CIDR + C pgtype.Macaddr +} + +type DtNetTypesNotNull struct { + A pgtype.Inet + B pgtype.CIDR + C pgtype.Macaddr +} + +type DtNumeric struct { + A *int16 + B *int32 + C *int64 + D pgtype.Numeric + E pgtype.Numeric + F *float32 + G *float64 + H *int16 + I *int32 + J *int64 + K *int16 + L *int32 + M *int64 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D pgtype.Numeric + E pgtype.Numeric + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A pgtype.Int4range + B pgtype.Int8range + C pgtype.Numrange + D pgtype.Tsrange + E pgtype.Tstzrange + F pgtype.Daterange +} + +type DtRangeNotNull struct { + A pgtype.Int4range + B pgtype.Int8range + C pgtype.Numrange + D pgtype.Tsrange + E pgtype.Tstzrange + F pgtype.Daterange +} 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..3a1b6bccec --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/character.sql new file mode 100644 index 0000000000..e3f41dac81 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/character.sql @@ -0,0 +1,17 @@ +-- Character Types +-- https://www.postgresql.org/docs/current/datatype-character.html +CREATE TABLE dt_character ( + a text, + b character varying(32), + c varchar(32), + d character(32), + e char(32) +); + +CREATE TABLE dt_character_not_null ( + a text NOT NULL, + b character varying(32) NOT NULL, + c varchar(32) NOT NULL, + d character(32) NOT NULL, + e char(32) NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/datetime.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/datetime.sql new file mode 100644 index 0000000000..5e6bcf033f --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/datetime.sql @@ -0,0 +1,23 @@ +-- Date/Time Types +-- https://www.postgresql.org/docs/current/datatype-datetime.html +CREATE TABLE dt_datetime ( + a DATE, + b TIME, + c TIME WITHOUT TIME ZONE, + d TIME WITH TIME ZONE, + e TIMESTAMP, + f TIMESTAMP WITHOUT TIME ZONE, + g TIMESTAMP WITH TIME ZONE, + h timestamptz +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b TIME NOT NULL, + c TIME WITHOUT TIME ZONE NOT NULL, + d TIME WITH TIME ZONE NOT NULL, + e TIMESTAMP NOT NULL, + f TIMESTAMP WITHOUT TIME ZONE NOT NULL, + g TIMESTAMP WITH TIME ZONE NOT NULL, + h timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/net-types.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/numeric.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/numeric.sql new file mode 100644 index 0000000000..9df14947f3 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/numeric.sql @@ -0,0 +1,36 @@ +-- Numeric Types +-- https://www.postgresql.org/docs/current/datatype-numeric.html +CREATE TABLE dt_numeric ( + -- TODO: this maps incorrectly to int16, not NullInt16 + a smallint, + b integer, + c bigint, + d decimal, + e numeric, + f real, + g double precision, + -- TODO: this maps incorrectly to int16, not NullInt16 + h smallserial, + i serial, + j bigserial, + -- TODO: this maps incorrectly to int16, not NullInt16 + k int2, + l int4, + m int8 +); + +CREATE TABLE dt_numeric_not_null ( + a smallint NOT NULL, + b integer NOT NULL, + c bigint NOT NULL, + d decimal NOT NULL, + e numeric NOT NULL, + f real NOT NULL, + g double precision NOT NULL, + h smallserial NOT NULL, + i serial NOT NULL, + j bigserial NOT NULL, + k int2 NOT NULL, + l int4 NOT NULL, + m int8 NOT NULL +); 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/rangetypes.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sqlc.json new file mode 100644 index 0000000000..6fd3f734ff --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "datatype", + "schema": "sql/", + "queries": "sql/", + "emit_pointers_for_null_types": true + } + ] +} 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 new file mode 100644 index 0000000000..2853d5f77e --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "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 +} + +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_types/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go new file mode 100644 index 0000000000..deab99cd28 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go @@ -0,0 +1,113 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "net" + "net/netip" + "time" + + "github.com/jackc/pgx/v5/pgtype" +) + +type DtCharacter struct { + A *string + B *string + C *string + D *string + E *string +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A pgtype.Date + B pgtype.Time + C pgtype.Time + D *time.Time + E pgtype.Timestamp + F pgtype.Timestamp + G pgtype.Timestamptz + H pgtype.Timestamptz +} + +type DtDatetimeNotNull struct { + A pgtype.Date + B pgtype.Time + C pgtype.Time + D time.Time + E pgtype.Timestamp + F pgtype.Timestamp + G pgtype.Timestamptz + H pgtype.Timestamptz +} + +type DtNetType struct { + A *netip.Addr + B *netip.Prefix + C net.HardwareAddr +} + +type DtNetTypesNotNull struct { + A netip.Addr + B netip.Prefix + C net.HardwareAddr +} + +type DtNumeric struct { + A *int16 + B *int32 + C *int64 + D pgtype.Numeric + E pgtype.Numeric + F *float32 + G *float64 + H *int16 + I *int32 + J *int64 + K *int16 + L *int32 + M *int64 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D pgtype.Numeric + E pgtype.Numeric + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A pgtype.Range[pgtype.Int4] + B pgtype.Range[pgtype.Int8] + C pgtype.Range[pgtype.Numeric] + D pgtype.Range[pgtype.Timestamp] + E pgtype.Range[pgtype.Timestamptz] + F pgtype.Range[pgtype.Date] +} + +type DtRangeNotNull struct { + A pgtype.Range[pgtype.Int4] + B pgtype.Range[pgtype.Int8] + C pgtype.Range[pgtype.Numeric] + D pgtype.Range[pgtype.Timestamp] + E pgtype.Range[pgtype.Timestamptz] + F pgtype.Range[pgtype.Date] +} 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..3a1b6bccec --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/character.sql new file mode 100644 index 0000000000..e3f41dac81 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/character.sql @@ -0,0 +1,17 @@ +-- Character Types +-- https://www.postgresql.org/docs/current/datatype-character.html +CREATE TABLE dt_character ( + a text, + b character varying(32), + c varchar(32), + d character(32), + e char(32) +); + +CREATE TABLE dt_character_not_null ( + a text NOT NULL, + b character varying(32) NOT NULL, + c varchar(32) NOT NULL, + d character(32) NOT NULL, + e char(32) NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/datetime.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/datetime.sql new file mode 100644 index 0000000000..5e6bcf033f --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/datetime.sql @@ -0,0 +1,23 @@ +-- Date/Time Types +-- https://www.postgresql.org/docs/current/datatype-datetime.html +CREATE TABLE dt_datetime ( + a DATE, + b TIME, + c TIME WITHOUT TIME ZONE, + d TIME WITH TIME ZONE, + e TIMESTAMP, + f TIMESTAMP WITHOUT TIME ZONE, + g TIMESTAMP WITH TIME ZONE, + h timestamptz +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b TIME NOT NULL, + c TIME WITHOUT TIME ZONE NOT NULL, + d TIME WITH TIME ZONE NOT NULL, + e TIMESTAMP NOT NULL, + f TIMESTAMP WITHOUT TIME ZONE NOT NULL, + g TIMESTAMP WITH TIME ZONE NOT NULL, + h timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/net-types.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/numeric.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/numeric.sql new file mode 100644 index 0000000000..9df14947f3 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/numeric.sql @@ -0,0 +1,36 @@ +-- Numeric Types +-- https://www.postgresql.org/docs/current/datatype-numeric.html +CREATE TABLE dt_numeric ( + -- TODO: this maps incorrectly to int16, not NullInt16 + a smallint, + b integer, + c bigint, + d decimal, + e numeric, + f real, + g double precision, + -- TODO: this maps incorrectly to int16, not NullInt16 + h smallserial, + i serial, + j bigserial, + -- TODO: this maps incorrectly to int16, not NullInt16 + k int2, + l int4, + m int8 +); + +CREATE TABLE dt_numeric_not_null ( + a smallint NOT NULL, + b integer NOT NULL, + c bigint NOT NULL, + d decimal NOT NULL, + e numeric NOT NULL, + f real NOT NULL, + g double precision NOT NULL, + h smallserial NOT NULL, + i serial NOT NULL, + j bigserial NOT NULL, + k int2 NOT NULL, + l int4 NOT NULL, + m int8 NOT NULL +); 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/rangetypes.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sqlc.json new file mode 100644 index 0000000000..1073b51b31 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "datatype", + "schema": "sql/", + "queries": "sql/", + "emit_pointers_for_null_types": true + } + ] +} 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..0a639a6476 --- /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.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +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 +} + +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..2d52f36770 --- /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.30.0 + +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..fa36be67e6 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..0a639a6476 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +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 +} + +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/stdlib/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go new file mode 100644 index 0000000000..691793cbdd --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go @@ -0,0 +1,112 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "database/sql" + "time" + + "github.com/sqlc-dev/pqtype" +) + +type DtCharacter struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullString +} + +type DtCharacterNotNull struct { + A string + B string + C string + D string + E string +} + +type DtDatetime struct { + A sql.NullTime + B sql.NullTime + C sql.NullTime + D sql.NullTime + E sql.NullTime + F sql.NullTime + G sql.NullTime + H sql.NullTime +} + +type DtDatetimeNotNull struct { + A time.Time + B time.Time + C time.Time + D time.Time + E time.Time + F time.Time + G time.Time + H time.Time +} + +type DtNetType struct { + A pqtype.Inet + B pqtype.CIDR + C pqtype.Macaddr +} + +type DtNetTypesNotNull struct { + A pqtype.Inet + B pqtype.CIDR + C pqtype.Macaddr +} + +type DtNumeric struct { + A sql.NullInt16 + B sql.NullInt32 + C sql.NullInt64 + D sql.NullString + E sql.NullString + F sql.NullFloat64 + G sql.NullFloat64 + H sql.NullInt16 + I sql.NullInt32 + J sql.NullInt64 + K sql.NullInt16 + L sql.NullInt32 + M sql.NullInt64 +} + +type DtNumericNotNull struct { + A int16 + B int32 + C int64 + D string + E string + F float32 + G float64 + H int16 + I int32 + J int64 + K int16 + L int32 + M int64 +} + +type DtRange struct { + A interface{} + B interface{} + C interface{} + D interface{} + E interface{} + F interface{} +} + +type DtRangeNotNull struct { + A interface{} + B interface{} + C interface{} + D interface{} + E interface{} + F interface{} +} 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..4720927d0a --- /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.30.0 +// 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/character.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/character.sql new file mode 100644 index 0000000000..e3f41dac81 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/character.sql @@ -0,0 +1,17 @@ +-- Character Types +-- https://www.postgresql.org/docs/current/datatype-character.html +CREATE TABLE dt_character ( + a text, + b character varying(32), + c varchar(32), + d character(32), + e char(32) +); + +CREATE TABLE dt_character_not_null ( + a text NOT NULL, + b character varying(32) NOT NULL, + c varchar(32) NOT NULL, + d character(32) NOT NULL, + e char(32) NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/datetime.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/datetime.sql new file mode 100644 index 0000000000..5e6bcf033f --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/datetime.sql @@ -0,0 +1,23 @@ +-- Date/Time Types +-- https://www.postgresql.org/docs/current/datatype-datetime.html +CREATE TABLE dt_datetime ( + a DATE, + b TIME, + c TIME WITHOUT TIME ZONE, + d TIME WITH TIME ZONE, + e TIMESTAMP, + f TIMESTAMP WITHOUT TIME ZONE, + g TIMESTAMP WITH TIME ZONE, + h timestamptz +); + +CREATE TABLE dt_datetime_not_null ( + a DATE NOT NULL, + b TIME NOT NULL, + c TIME WITHOUT TIME ZONE NOT NULL, + d TIME WITH TIME ZONE NOT NULL, + e TIMESTAMP NOT NULL, + f TIMESTAMP WITHOUT TIME ZONE NOT NULL, + g TIMESTAMP WITH TIME ZONE NOT NULL, + h timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/net-types.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/net-types.sql new file mode 100644 index 0000000000..6239b6f9f6 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/net-types.sql @@ -0,0 +1,13 @@ +-- Network Address Types +-- https://www.postgresql.org/docs/current/datatype-net-types.html +CREATE TABLE dt_net_types ( + a inet, + b cidr, + c macaddr +); + +CREATE TABLE dt_net_types_not_null ( + a inet NOT NULL, + b cidr NOT NULL, + c macaddr NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/numeric.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/numeric.sql new file mode 100644 index 0000000000..9df14947f3 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/numeric.sql @@ -0,0 +1,36 @@ +-- Numeric Types +-- https://www.postgresql.org/docs/current/datatype-numeric.html +CREATE TABLE dt_numeric ( + -- TODO: this maps incorrectly to int16, not NullInt16 + a smallint, + b integer, + c bigint, + d decimal, + e numeric, + f real, + g double precision, + -- TODO: this maps incorrectly to int16, not NullInt16 + h smallserial, + i serial, + j bigserial, + -- TODO: this maps incorrectly to int16, not NullInt16 + k int2, + l int4, + m int8 +); + +CREATE TABLE dt_numeric_not_null ( + a smallint NOT NULL, + b integer NOT NULL, + c bigint NOT NULL, + d decimal NOT NULL, + e numeric NOT NULL, + f real NOT NULL, + g double precision NOT NULL, + h smallserial NOT NULL, + i serial NOT NULL, + j bigserial NOT NULL, + k int2 NOT NULL, + l int4 NOT NULL, + m int8 NOT NULL +); 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/rangetypes.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/rangetypes.sql new file mode 100644 index 0000000000..7e61b658a5 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/rangetypes.sql @@ -0,0 +1,19 @@ +-- Range Types +-- https://www.postgresql.org/docs/current/rangetypes.html +CREATE TABLE dt_range ( + a int4range, + b int8range, + c numrange, + d tsrange, + e tstzrange, + f daterange +); + +CREATE TABLE dt_range_not_null ( + a int4range NOT NULL, + b int8range NOT NULL, + c numrange NOT NULL, + d tsrange NOT NULL, + e tstzrange NOT NULL, + f daterange NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sqlc.json new file mode 100644 index 0000000000..be5e301859 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "datatype", + "schema": "sql/", + "queries": "sql/", + "emit_pointers_for_null_types": 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_result_and_params_struct_pointers/mysql/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go new file mode 100644 index 0000000000..530968fc6b --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullInt32 + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..928b9423af --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type Querier interface { + GetAll(ctx context.Context) ([]*Foo, error) + GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullInt32, error) + GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..6314b95930 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAll = `-- name: GetAll :many +SELECT a, b FROM foo +` + +func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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 getAllAByB = `-- name: GetAllAByB :many +SELECT a FROM foo WHERE b = ? +` + +func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullInt32, error) { + rows, err := q.db.QueryContext(ctx, getAllAByB, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullInt32 + for rows.Next() { + var a sql.NullInt32 + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getOne = `-- name: GetOne :one +SELECT a, b FROM foo WHERE a = ? AND b = ? LIMIT 1 +` + +type GetOneParams struct { + A sql.NullInt32 + B sql.NullInt32 +} + +func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { + row := q.db.QueryRowContext(ctx, getOne, arg.A, arg.B) + var i Foo + err := row.Scan(&i.A, &i.B) + return &i, err +} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql new file mode 100644 index 0000000000..06d3554f09 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql @@ -0,0 +1,8 @@ +/* name: GetOne :one */ +SELECT * FROM foo WHERE a = ? AND b = ? LIMIT 1; + +/* name: GetAll :many */ +SELECT * FROM foo; + +/* name: GetAllAByB :many */ +SELECT a FROM foo WHERE b = ?; diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json new file mode 100644 index 0000000000..be5b7dd55f --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql", + "emit_interface": true, + "emit_result_struct_pointers": true, + "emit_params_struct_pointers": true + } + ] +} 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 new file mode 100644 index 0000000000..ec7726ffae --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package querytest + +import ( + "context" + "database/sql" + "errors" + + "github.com/jackc/pgx/v4" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const insertValues = `-- name: InsertValues :batchone +INSERT INTO foo (a, b) +VALUES ($1, $2) +ON CONFLICT DO NOTHING +RETURNING a, b +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A sql.NullInt32 + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, *Foo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var i Foo + if b.closed { + if f != nil { + f(t, nil, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&i.A, &i.B) + if f != nil { + f(t, &i, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..fa88475d3d --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/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 new file mode 100644 index 0000000000..530968fc6b --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullInt32 + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..cbec4e96ee --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,75 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAll = `-- name: GetAll :many +SELECT a, b FROM foo +` + +func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { + rows, err := q.db.Query(ctx, getAll) + 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 getAllAByB = `-- name: GetAllAByB :many +SELECT a FROM foo WHERE b = $1 +` + +func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullInt32, error) { + rows, err := q.db.Query(ctx, getAllAByB, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullInt32 + for rows.Next() { + var a sql.NullInt32 + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getOne = `-- name: GetOne :one +SELECT a, b FROM foo WHERE a = $1 AND b = $2 LIMIT 1 +` + +type GetOneParams struct { + A sql.NullInt32 + B sql.NullInt32 +} + +func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { + row := q.db.QueryRow(ctx, getOne, arg.A, arg.B) + var i Foo + err := row.Scan(&i.A, &i.B) + return &i, err +} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..e6321bb867 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql @@ -0,0 +1,14 @@ +-- name: InsertValues :batchone +INSERT INTO foo (a, b) +VALUES ($1, $2) +ON CONFLICT DO NOTHING +RETURNING *; + +-- name: GetOne :one +SELECT * FROM foo WHERE a = $1 AND b = $2 LIMIT 1; + +-- name: GetAll :many +SELECT * FROM foo; + +-- name: GetAllAByB :many +SELECT a FROM foo WHERE b = $1; diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..2289f94fd5 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "sql_package": "pgx/v4", + "out": "go", + "emit_result_struct_pointers": true, + "emit_params_struct_pointers": true + } + } + } + ] +} 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 new file mode 100644 index 0000000000..13d3eb8db6 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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 insertValues = `-- name: InsertValues :batchone +INSERT INTO foo (a, b) +VALUES ($1, $2) +ON CONFLICT DO NOTHING +RETURNING a, b +` + +type InsertValuesBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertValuesParams struct { + A pgtype.Int4 + B pgtype.Int4 +} + +func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) *InsertValuesBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.A, + a.B, + } + batch.Queue(insertValues, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertValuesBatchResults{br, len(arg), false} +} + +func (b *InsertValuesBatchResults) QueryRow(f func(int, *Foo, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var i Foo + if b.closed { + if f != nil { + f(t, nil, ErrBatchAlreadyClosed) + } + continue + } + row := b.br.QueryRow() + err := row.Scan(&i.A, &i.B) + if f != nil { + f(t, &i, err) + } + } +} + +func (b *InsertValuesBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..9a44027379 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + 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/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 new file mode 100644 index 0000000000..95e7754cd6 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Int4 + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..d6a2282c78 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAll = `-- name: GetAll :many +SELECT a, b FROM foo +` + +func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { + rows, err := q.db.Query(ctx, getAll) + 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 getAllAByB = `-- name: GetAllAByB :many +SELECT a FROM foo WHERE b = $1 +` + +func (q *Queries) GetAllAByB(ctx context.Context, b pgtype.Int4) ([]pgtype.Int4, error) { + rows, err := q.db.Query(ctx, getAllAByB, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Int4 + for rows.Next() { + var a pgtype.Int4 + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getOne = `-- name: GetOne :one +SELECT a, b FROM foo WHERE a = $1 AND b = $2 LIMIT 1 +` + +type GetOneParams struct { + A pgtype.Int4 + B pgtype.Int4 +} + +func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { + row := q.db.QueryRow(ctx, getOne, arg.A, arg.B) + var i Foo + err := row.Scan(&i.A, &i.B) + return &i, err +} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..e6321bb867 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql @@ -0,0 +1,14 @@ +-- name: InsertValues :batchone +INSERT INTO foo (a, b) +VALUES ($1, $2) +ON CONFLICT DO NOTHING +RETURNING *; + +-- name: GetOne :one +SELECT * FROM foo WHERE a = $1 AND b = $2 LIMIT 1; + +-- name: GetAll :many +SELECT * FROM foo; + +-- name: GetAllAByB :many +SELECT a FROM foo WHERE b = $1; diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..eac0177ca5 --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "sql_package": "pgx/v5", + "out": "go", + "emit_result_struct_pointers": true, + "emit_params_struct_pointers": true + } + } + } + ] +} 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..4f106ee2e3 --- /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.30.0 + +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..3438f222fe --- /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.30.0 +// 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 new file mode 100644 index 0000000000..44139faf54 --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/go/db.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} diff --git a/internal/endtoend/testdata/enum/mysql/go/models.go b/internal/endtoend/testdata/enum/mysql/go/models.go new file mode 100644 index 0000000000..0ed9bc8b73 --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/go/models.go @@ -0,0 +1,110 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type UsersShirtSize string + +const ( + UsersShirtSizeXSmall UsersShirtSize = "x-small" + UsersShirtSizeSmall UsersShirtSize = "small" + UsersShirtSizeMedium UsersShirtSize = "medium" + UsersShirtSizeLarge UsersShirtSize = "large" + UsersShirtSizeXLarge UsersShirtSize = "x-large" +) + +func (e *UsersShirtSize) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = UsersShirtSize(s) + case string: + *e = UsersShirtSize(s) + default: + return fmt.Errorf("unsupported scan type for UsersShirtSize: %T", src) + } + return nil +} + +type NullUsersShirtSize struct { + UsersShirtSize UsersShirtSize + Valid bool // Valid is true if UsersShirtSize is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUsersShirtSize) Scan(value interface{}) error { + if value == nil { + ns.UsersShirtSize, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UsersShirtSize.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUsersShirtSize) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UsersShirtSize), nil +} + +type UsersShoeSize string + +const ( + UsersShoeSizeXSmall UsersShoeSize = "x-small" + UsersShoeSizeSmall UsersShoeSize = "small" + UsersShoeSizeMedium UsersShoeSize = "medium" + UsersShoeSizeLarge UsersShoeSize = "large" + UsersShoeSizeXLarge UsersShoeSize = "x-large" +) + +func (e *UsersShoeSize) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = UsersShoeSize(s) + case string: + *e = UsersShoeSize(s) + default: + return fmt.Errorf("unsupported scan type for UsersShoeSize: %T", src) + } + return nil +} + +type NullUsersShoeSize struct { + UsersShoeSize UsersShoeSize + Valid bool // Valid is true if UsersShoeSize is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUsersShoeSize) Scan(value interface{}) error { + if value == nil { + ns.UsersShoeSize, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UsersShoeSize.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUsersShoeSize) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UsersShoeSize), nil +} + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + ShoeSize UsersShoeSize + ShirtSize NullUsersShirtSize +} diff --git a/internal/endtoend/testdata/enum/mysql/go/query.sql.go b/internal/endtoend/testdata/enum/mysql/go/query.sql.go new file mode 100644 index 0000000000..4c95030785 --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/go/query.sql.go @@ -0,0 +1,110 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteBySize = `-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = ? AND shirt_size = ? +` + +type DeleteBySizeParams struct { + ShoeSize UsersShoeSize + ShirtSize NullUsersShirtSize +} + +func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { + _, err := db.ExecContext(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + return err +} + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + &i.ShoeSize, + &i.ShirtSize, + ); 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 newUser = `-- name: NewUser :exec +INSERT INTO users ( + id, + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +(?, ?, ?, ?, ?, ?) +` + +type NewUserParams struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + ShoeSize UsersShoeSize + ShirtSize NullUsersShirtSize +} + +func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { + _, err := db.ExecContext(ctx, newUser, + arg.ID, + arg.FirstName, + arg.LastName, + arg.Age, + arg.ShoeSize, + arg.ShirtSize, + ) + return err +} + +const updateSizes = `-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = ?, shirt_size = ? +WHERE id = ? +` + +type UpdateSizesParams struct { + ShoeSize UsersShoeSize + ShirtSize NullUsersShirtSize + ID int32 +} + +func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { + _, err := db.ExecContext(ctx, updateSizes, arg.ShoeSize, arg.ShirtSize, arg.ID) + return err +} diff --git a/internal/endtoend/testdata/enum/mysql/query.sql b/internal/endtoend/testdata/enum/mysql/query.sql new file mode 100644 index 0000000000..dfc427d0ad --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/query.sql @@ -0,0 +1,22 @@ +/* name: GetAll :many */ +SELECT * FROM users; + +-- name: NewUser :exec +INSERT INTO users ( + id, + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +(?, ?, ?, ?, ?, ?); + +-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = ?, shirt_size = ? +WHERE id = ?; + +-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = ? AND shirt_size = ?; diff --git a/internal/endtoend/testdata/enum/mysql/schema.sql b/internal/endtoend/testdata/enum/mysql/schema.sql new file mode 100644 index 0000000000..ee7b6ea9cd --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE users ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + shoe_size ENUM('x-small', 'small', 'medium', 'large', 'x-large') NOT NULL, + shirt_size ENUM('x-small', 'small', 'medium', 'large', 'x-large') +); diff --git a/internal/endtoend/testdata/enum/mysql/sqlc.json b/internal/endtoend/testdata/enum/mysql/sqlc.json new file mode 100644 index 0000000000..f27ded3934 --- /dev/null +++ b/internal/endtoend/testdata/enum/mysql/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql", + "emit_methods_with_db_argument": true + } + ] +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..7599fccb42 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..152ecabadd --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type Size string + +const ( + SizeXSmall Size = "x-small" + SizeSmall Size = "small" + SizeMedium Size = "medium" + SizeLarge Size = "large" + SizeXLarge Size = "x-large" +) + +func (e *Size) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Size(s) + case string: + *e = Size(s) + default: + return fmt.Errorf("unsupported scan type for Size: %T", src) + } + return nil +} + +type NullSize struct { + Size Size + Valid bool // Valid is true if Size is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullSize) Scan(value interface{}) error { + if value == nil { + ns.Size, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Size.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullSize) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Size), nil +} + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + ShoeSize Size + ShirtSize NullSize +} 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 new file mode 100644 index 0000000000..66a8db871b --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,104 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteBySize = `-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2 +` + +type DeleteBySizeParams struct { + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { + _, err := db.Exec(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + return err +} + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + &i.ShoeSize, + &i.ShirtSize, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const newUser = `-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5) +` + +type NewUserParams struct { + FirstName string + LastName sql.NullString + Age int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { + _, err := db.Exec(ctx, newUser, + arg.FirstName, + arg.LastName, + arg.Age, + arg.ShoeSize, + arg.ShirtSize, + ) + return err +} + +const updateSizes = `-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1 +` + +type UpdateSizesParams struct { + ID int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { + _, err := db.Exec(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + return err +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..818eafd10d --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql @@ -0,0 +1,21 @@ +-- name: GetAll :many +SELECT * FROM users; + +-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5); + +-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1; + +-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ad2802d4a9 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +CREATE TYPE size AS ENUM('x-small', 'small', 'medium', 'large', 'x-large'); + + +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + shoe_size size NOT NULL, + shirt_size size +); diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/enum/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..069e8bc5bc --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/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_methods_with_db_argument": true + } + ] +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..166695c170 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..22c9bb0555 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go @@ -0,0 +1,66 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" + + "github.com/jackc/pgx/v5/pgtype" +) + +type Size string + +const ( + SizeXSmall Size = "x-small" + SizeSmall Size = "small" + SizeMedium Size = "medium" + SizeLarge Size = "large" + SizeXLarge Size = "x-large" +) + +func (e *Size) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Size(s) + case string: + *e = Size(s) + default: + return fmt.Errorf("unsupported scan type for Size: %T", src) + } + return nil +} + +type NullSize struct { + Size Size + Valid bool // Valid is true if Size is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullSize) Scan(value interface{}) error { + if value == nil { + ns.Size, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Size.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullSize) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Size), nil +} + +type User struct { + ID int32 + FirstName string + LastName pgtype.Text + Age int32 + ShoeSize Size + ShirtSize NullSize +} 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 new file mode 100644 index 0000000000..81bde82c79 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,105 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const deleteBySize = `-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2 +` + +type DeleteBySizeParams struct { + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { + _, err := db.Exec(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + return err +} + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + &i.ShoeSize, + &i.ShirtSize, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const newUser = `-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5) +` + +type NewUserParams struct { + FirstName string + LastName pgtype.Text + Age int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { + _, err := db.Exec(ctx, newUser, + arg.FirstName, + arg.LastName, + arg.Age, + arg.ShoeSize, + arg.ShirtSize, + ) + return err +} + +const updateSizes = `-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1 +` + +type UpdateSizesParams struct { + ID int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { + _, err := db.Exec(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + return err +} diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..1902312c1a --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql @@ -0,0 +1,21 @@ +-- name: GetAll :many +SELECT * FROM users; + +-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5); + +-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1; + +-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2; diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ad2802d4a9 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +CREATE TYPE size AS ENUM('x-small', 'small', 'medium', 'large', 'x-large'); + + +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + shoe_size size NOT NULL, + shirt_size size +); diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/enum/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..558a107985 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/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_methods_with_db_argument": true + } + ] +} diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..44139faf54 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +func New() *Queries { + return &Queries{} +} + +type Queries struct { +} diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..152ecabadd --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go @@ -0,0 +1,65 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type Size string + +const ( + SizeXSmall Size = "x-small" + SizeSmall Size = "small" + SizeMedium Size = "medium" + SizeLarge Size = "large" + SizeXLarge Size = "x-large" +) + +func (e *Size) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = Size(s) + case string: + *e = Size(s) + default: + return fmt.Errorf("unsupported scan type for Size: %T", src) + } + return nil +} + +type NullSize struct { + Size Size + Valid bool // Valid is true if Size is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullSize) Scan(value interface{}) error { + if value == nil { + ns.Size, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Size.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullSize) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Size), nil +} + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + ShoeSize Size + ShirtSize NullSize +} diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..08e77ed7b7 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,107 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteBySize = `-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2 +` + +type DeleteBySizeParams struct { + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { + _, err := db.ExecContext(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + return err +} + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users +` + +func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { + rows, err := db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + &i.ShoeSize, + &i.ShirtSize, + ); 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 newUser = `-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5) +` + +type NewUserParams struct { + FirstName string + LastName sql.NullString + Age int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { + _, err := db.ExecContext(ctx, newUser, + arg.FirstName, + arg.LastName, + arg.Age, + arg.ShoeSize, + arg.ShirtSize, + ) + return err +} + +const updateSizes = `-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1 +` + +type UpdateSizesParams struct { + ID int32 + ShoeSize Size + ShirtSize NullSize +} + +func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { + _, err := db.ExecContext(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + return err +} diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql b/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..1902312c1a --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql @@ -0,0 +1,21 @@ +-- name: GetAll :many +SELECT * FROM users; + +-- name: NewUser :exec +INSERT INTO users ( + first_name, + last_name, + age, + shoe_size, + shirt_size +) VALUES +($1, $2, $3, $4, $5); + +-- name: UpdateSizes :exec +UPDATE users +SET shoe_size = $2, shirt_size = $3 +WHERE id = $1; + +-- name: DeleteBySize :exec +DELETE FROM users +WHERE shoe_size = $1 AND shirt_size = $2; diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/enum/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..134694ab0d --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/schema.sql @@ -0,0 +1,10 @@ +CREATE TYPE size AS ENUM('x-small', 'small', 'medium', 'large', 'x-large'); + +CREATE TABLE users ( + id integer NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + shoe_size size NOT NULL, + shirt_size size +); diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/enum/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..6acde89538 --- /dev/null +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_methods_with_db_argument": true + } + ] +} diff --git a/internal/endtoend/testdata/enum_column/issue.md b/internal/endtoend/testdata/enum_column/issue.md new file mode 100644 index 0000000000..e618d6c240 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/issue.md @@ -0,0 +1,3 @@ +https://github.com/sqlc-dev/sqlc/issues/1503 +https://github.com/sqlc-dev/sqlc/issues/2475 + diff --git a/internal/endtoend/testdata/enum_column/mysql/go/db.go b/internal/endtoend/testdata/enum_column/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/enum_column/mysql/go/models.go b/internal/endtoend/testdata/enum_column/mysql/go/models.go new file mode 100644 index 0000000000..2c8383b687 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/models.go @@ -0,0 +1,271 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type AuthorsAddItem string + +const ( + AuthorsAddItemOk AuthorsAddItem = "ok" + AuthorsAddItemAdded AuthorsAddItem = "added" +) + +func (e *AuthorsAddItem) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsAddItem(s) + case string: + *e = AuthorsAddItem(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsAddItem: %T", src) + } + return nil +} + +type NullAuthorsAddItem struct { + AuthorsAddItem AuthorsAddItem + Valid bool // Valid is true if AuthorsAddItem is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsAddItem) Scan(value interface{}) error { + if value == nil { + ns.AuthorsAddItem, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsAddItem.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsAddItem) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsAddItem), nil +} + +type AuthorsAdded string + +const ( + AuthorsAddedOk AuthorsAdded = "ok" +) + +func (e *AuthorsAdded) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsAdded(s) + case string: + *e = AuthorsAdded(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsAdded: %T", src) + } + return nil +} + +type NullAuthorsAdded struct { + AuthorsAdded AuthorsAdded + Valid bool // Valid is true if AuthorsAdded is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsAdded) Scan(value interface{}) error { + if value == nil { + ns.AuthorsAdded, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsAdded.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsAdded) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsAdded), nil +} + +type AuthorsBar string + +const ( + AuthorsBarOk AuthorsBar = "ok" +) + +func (e *AuthorsBar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsBar(s) + case string: + *e = AuthorsBar(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsBar: %T", src) + } + return nil +} + +type NullAuthorsBar struct { + AuthorsBar AuthorsBar + Valid bool // Valid is true if AuthorsBar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsBar) Scan(value interface{}) error { + if value == nil { + ns.AuthorsBar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsBar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsBar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsBar), nil +} + +type AuthorsFoo string + +const ( + AuthorsFooOk AuthorsFoo = "ok" +) + +func (e *AuthorsFoo) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsFoo(s) + case string: + *e = AuthorsFoo(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsFoo: %T", src) + } + return nil +} + +type NullAuthorsFoo struct { + AuthorsFoo AuthorsFoo + Valid bool // Valid is true if AuthorsFoo is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsFoo) Scan(value interface{}) error { + if value == nil { + ns.AuthorsFoo, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsFoo.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsFoo) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsFoo), nil +} + +type AuthorsRemoveItem string + +const ( + AuthorsRemoveItemOk AuthorsRemoveItem = "ok" +) + +func (e *AuthorsRemoveItem) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsRemoveItem(s) + case string: + *e = AuthorsRemoveItem(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsRemoveItem: %T", src) + } + return nil +} + +type NullAuthorsRemoveItem struct { + AuthorsRemoveItem AuthorsRemoveItem + Valid bool // Valid is true if AuthorsRemoveItem is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsRemoveItem) Scan(value interface{}) error { + if value == nil { + ns.AuthorsRemoveItem, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsRemoveItem.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsRemoveItem) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsRemoveItem), nil +} + +type BooksFoo string + +const ( + BooksFooOk BooksFoo = "ok" +) + +func (e *BooksFoo) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = BooksFoo(s) + case string: + *e = BooksFoo(s) + default: + return fmt.Errorf("unsupported scan type for BooksFoo: %T", src) + } + return nil +} + +type NullBooksFoo struct { + BooksFoo BooksFoo + Valid bool // Valid is true if BooksFoo is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullBooksFoo) Scan(value interface{}) error { + if value == nil { + ns.BooksFoo, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.BooksFoo.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullBooksFoo) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.BooksFoo), nil +} + +type Author struct { + ID int64 + Foo AuthorsFoo + Bar AuthorsBar + Added AuthorsAdded + AddItem AuthorsAddItem + RemoveItem AuthorsRemoveItem +} + +type Book struct { + ID int64 + Foo BooksFoo +} diff --git a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go new file mode 100644 index 0000000000..3fc35608e0 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go @@ -0,0 +1,71 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, foo, bar, added, add_item, remove_item FROM authors +` + +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.Foo, + &i.Bar, + &i.Added, + &i.AddItem, + &i.RemoveItem, + ); 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 listBooks = `-- name: ListBooks :many +SELECT id, foo FROM books +` + +func (q *Queries) ListBooks(ctx context.Context) ([]Book, error) { + rows, err := q.db.QueryContext(ctx, listBooks) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Book + for rows.Next() { + var i Book + if err := rows.Scan(&i.ID, &i.Foo); 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/enum_column/mysql/query.sql b/internal/endtoend/testdata/enum_column/mysql/query.sql new file mode 100644 index 0000000000..893743b53a --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/query.sql @@ -0,0 +1,5 @@ +/* name: ListAuthors :many */ +SELECT * FROM authors; + +/* name: ListBooks :many */ +SELECT * FROM books; diff --git a/internal/endtoend/testdata/enum_column/mysql/schema.sql b/internal/endtoend/testdata/enum_column/mysql/schema.sql new file mode 100644 index 0000000000..82771c1951 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/schema.sql @@ -0,0 +1,39 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL, + renamed ENUM("ok") DEFAULT "ok" NOT NULL, + removed ENUM("ok") DEFAULT "ok" NOT NULL, + add_item ENUM("ok") DEFAULT "ok" NOT NULL, + remove_item ENUM("ok", "removed") DEFAULT "ok" NOT NULL +); + +CREATE TABLE renamed ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL +); + +CREATE TABLE removed ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL +); + +/* Rename column */ +ALTER TABLE authors RENAME COLUMN renamed TO bar; + +/* Drop column */ +ALTER TABLE authors DROP COLUMN removed; + +/* Add column */ +ALTER TABLE authors ADD COLUMN added ENUM("ok") DEFAULT "ok" NOT NULL; + +/* Add enum values */ +ALTER TABLE authors MODIFY add_item ENUM("ok", "added") DEFAULT "ok" NOT NULL; + +/* Remove enum values */ +ALTER TABLE authors MODIFY remove_item ENUM("ok") DEFAULT "ok" NOT NULL; + +/* Drop table */ +DROP TABLE removed; + +/* Rename table */ +ALTER TABLE renamed RENAME TO books; diff --git a/internal/endtoend/testdata/enum_column/mysql/sqlc.yaml b/internal/endtoend/testdata/enum_column/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/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/enum_ordering/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/enum_ordering/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..09436fd2e7 --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go @@ -0,0 +1,90 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql/driver" + "fmt" +) + +type EnumType string + +const ( + EnumTypeBeforefirst EnumType = "beforefirst" + EnumTypeFirst EnumType = "first" + EnumTypeSecond EnumType = "second" + EnumTypeThird EnumType = "third" + EnumTypeFourth EnumType = "fourth" + EnumTypeFifth EnumType = "fifth" + EnumTypeLast EnumType = "last" + EnumTypeAfterlast EnumType = "afterlast" +) + +func (e *EnumType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = EnumType(s) + case string: + *e = EnumType(s) + default: + return fmt.Errorf("unsupported scan type for EnumType: %T", src) + } + return nil +} + +type NullEnumType struct { + EnumType EnumType + Valid bool // Valid is true if EnumType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullEnumType) Scan(value interface{}) error { + if value == nil { + ns.EnumType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.EnumType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullEnumType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.EnumType), nil +} + +func (e EnumType) Valid() bool { + switch e { + case EnumTypeBeforefirst, + EnumTypeFirst, + EnumTypeSecond, + EnumTypeThird, + EnumTypeFourth, + EnumTypeFifth, + EnumTypeLast, + EnumTypeAfterlast: + return true + } + return false +} + +func AllEnumTypeValues() []EnumType { + return []EnumType{ + EnumTypeBeforefirst, + EnumTypeFirst, + EnumTypeSecond, + EnumTypeThird, + EnumTypeFourth, + EnumTypeFifth, + EnumTypeLast, + EnumTypeAfterlast, + } +} + +type Foo struct { + ID int32 +} diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go new file mode 100644 index 0000000000..4df64b6fb2 --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" +) + +type Querier interface { + GetAll(ctx context.Context) ([]int32, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..61d2425c01 --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id FROM foo +` + +func (q *Queries) GetAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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/enum_ordering/postgresql/stdlib/query.sql b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..202b352652 --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM foo; \ No newline at end of file diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..679091891e --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +CREATE TYPE enum_type AS ENUM ('first', 'last'); +ALTER TYPE enum_type ADD VALUE 'afterlast' AFTER 'last'; +ALTER TYPE enum_type ADD VALUE 'third' AFTER 'first'; +ALTER TYPE enum_type ADD VALUE 'fourth' BEFORE 'last'; +ALTER TYPE enum_type ADD VALUE 'fifth' AFTER 'fourth'; +ALTER TYPE enum_type ADD VALUE 'second' BEFORE 'third'; +ALTER TYPE enum_type ADD VALUE 'beforefirst' BEFORE 'first'; + +CREATE TABLE foo ( + id SERIAL PRIMARY KEY +); \ No newline at end of file diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..b0d556848e --- /dev/null +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "out" : "go", + "package" : "db", + "emit_interface": true, + "emit_all_enum_values": true, + "emit_enum_valid_method": true + } + } + } + ] +} 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..32099017df --- /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.30.0 + +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..11947091b9 --- /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.30.0 +// 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/internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql b/internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql new file mode 100644 index 0000000000..e69de29bb2 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..32099017df --- /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.30.0 + +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..3ecce84aa4 --- /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.30.0 +// 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/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql new file mode 100644 index 0000000000..e69de29bb2 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..32099017df --- /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.30.0 + +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..17ffec74e7 --- /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.30.0 +// 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/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/exec_imports/go/db.go b/internal/endtoend/testdata/exec_imports/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/exec_imports/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_imports/go/models.go b/internal/endtoend/testdata/exec_imports/go/models.go deleted file mode 100644 index 7a983f8535..0000000000 --- a/internal/endtoend/testdata/exec_imports/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Bar sql.NullInt32 - Bars []int32 -} diff --git a/internal/endtoend/testdata/exec_imports/go/querier.go b/internal/endtoend/testdata/exec_imports/go/querier.go deleted file mode 100644 index 56e1d6400a..0000000000 --- a/internal/endtoend/testdata/exec_imports/go/querier.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" -) - -type Querier interface { - Bar(ctx context.Context) error - Bars(ctx context.Context) error -} - -var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/exec_imports/go/query.sql.go b/internal/endtoend/testdata/exec_imports/go/query.sql.go deleted file mode 100644 index f2ed9d33d6..0000000000 --- a/internal/endtoend/testdata/exec_imports/go/query.sql.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const bar = `-- name: Bar :exec -SELECT bar -FROM foo -` - -func (q *Queries) Bar(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, bar) - return err -} - -const bars = `-- name: Bars :exec -SELECT bars -FROM foo -` - -func (q *Queries) Bars(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, bars) - return err -} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_imports/pgx/v4/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go new file mode 100644 index 0000000000..aa72c20020 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullInt32 + Bars []int32 +} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go new file mode 100644 index 0000000000..4ac6134bc7 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + Bar(ctx context.Context) error + Bars(ctx context.Context) error +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..9b47f5f368 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const bar = `-- name: Bar :exec +SELECT bar +FROM foo +` + +func (q *Queries) Bar(ctx context.Context) error { + _, err := q.db.Exec(ctx, bar) + return err +} + +const bars = `-- name: Bars :exec +SELECT bars +FROM foo +` + +func (q *Queries) Bars(ctx context.Context) error { + _, err := q.db.Exec(ctx, bars) + return err +} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql b/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql new file mode 100644 index 0000000000..b1be28c911 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql @@ -0,0 +1,7 @@ +-- name: Bar :exec +SELECT bar +FROM foo; + +-- name: Bars :exec +SELECT bars +FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql b/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/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_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_imports/pgx/v5/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go new file mode 100644 index 0000000000..5dde21524b --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Int4 + Bars []int32 +} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go new file mode 100644 index 0000000000..4ac6134bc7 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + Bar(ctx context.Context) error + Bars(ctx context.Context) error +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..9b47f5f368 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const bar = `-- name: Bar :exec +SELECT bar +FROM foo +` + +func (q *Queries) Bar(ctx context.Context) error { + _, err := q.db.Exec(ctx, bar) + return err +} + +const bars = `-- name: Bars :exec +SELECT bars +FROM foo +` + +func (q *Queries) Bars(ctx context.Context) error { + _, err := q.db.Exec(ctx, bars) + return err +} diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql b/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql new file mode 100644 index 0000000000..b1be28c911 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql @@ -0,0 +1,7 @@ +-- name: Bar :exec +SELECT bar +FROM foo; + +-- name: Bars :exec +SELECT bars +FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql b/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/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_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/exec_imports/query.sql b/internal/endtoend/testdata/exec_imports/query.sql deleted file mode 100644 index 00b2b7d7f3..0000000000 --- a/internal/endtoend/testdata/exec_imports/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE foo (bar int, bars int[] not null); - --- name: Bar :exec -SELECT bar -FROM foo; - --- name: Bars :exec -SELECT bars -FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/sqlc.json b/internal/endtoend/testdata/exec_imports/sqlc.json deleted file mode 100644 index b23380237a..0000000000 --- a/internal/endtoend/testdata/exec_imports/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql", - "emit_interface": true - } - ] -} diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/db.go b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_imports/stdlib/go/models.go b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go new file mode 100644 index 0000000000..aa72c20020 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullInt32 + Bars []int32 +} diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go new file mode 100644 index 0000000000..4ac6134bc7 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + Bar(ctx context.Context) error + Bars(ctx context.Context) error +} + +var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go new file mode 100644 index 0000000000..56f78eddb9 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const bar = `-- name: Bar :exec +SELECT bar +FROM foo +` + +func (q *Queries) Bar(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, bar) + return err +} + +const bars = `-- name: Bars :exec +SELECT bars +FROM foo +` + +func (q *Queries) Bars(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, bars) + return err +} diff --git a/internal/endtoend/testdata/exec_imports/stdlib/query.sql b/internal/endtoend/testdata/exec_imports/stdlib/query.sql new file mode 100644 index 0000000000..b1be28c911 --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/query.sql @@ -0,0 +1,7 @@ +-- name: Bar :exec +SELECT bar +FROM foo; + +-- name: Bars :exec +SELECT bars +FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/stdlib/schema.sql b/internal/endtoend/testdata/exec_imports/stdlib/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json b/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json new file mode 100644 index 0000000000..49e9851aab --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_lastid/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c231878b80 --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + InsertBar(ctx context.Context) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..ca4d7990ab --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertBar = `-- name: InsertBar :execlastid +INSERT INTO bar () VALUES () +` + +func (q *Queries) InsertBar(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, insertBar) + if err != nil { + return 0, err + } + return result.LastInsertId() +} diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql new file mode 100644 index 0000000000..9a96492c30 --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: InsertBar :execlastid +INSERT INTO bar () VALUES (); \ No newline at end of file diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..f314957f7c --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer(10) NOT NULL AUTO_INCREMENT PRIMARY KEY); + diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json new file mode 100644 index 0000000000..536433b1a8 --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..967badc4a9 --- /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.30.0 + +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..fda09ec9c5 --- /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.30.0 +// 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/db.go b/internal/endtoend/testdata/exec_result/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/exec_result/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_result/go/models.go b/internal/endtoend/testdata/exec_result/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/exec_result/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/exec_result/go/querier.go b/internal/endtoend/testdata/exec_result/go/querier.go deleted file mode 100644 index a9cf715261..0000000000 --- a/internal/endtoend/testdata/exec_result/go/querier.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -type Querier interface { - DeleteBarByID(ctx context.Context, id int32) (sql.Result, error) -} - -var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/exec_result/go/query.sql.go b/internal/endtoend/testdata/exec_result/go/query.sql.go deleted file mode 100644 index 4967174efa..0000000000 --- a/internal/endtoend/testdata/exec_result/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const deleteBarByID = `-- name: DeleteBarByID :execresult -DELETE FROM bar WHERE id = $1 -` - -func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (sql.Result, error) { - return q.db.ExecContext(ctx, deleteBarByID, id) -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_result/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..6c8ba2785f --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..21bf5b2a97 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" +) + +const deleteBarByID = `-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, deleteBarByID, id) +} diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql new file mode 100644 index 0000000000..73917782cb --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_result/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..835fc35107 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..4d9b85fd50 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" +) + +const deleteBarByID = `-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, deleteBarByID, id) +} diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql new file mode 100644 index 0000000000..73917782cb --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_result/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..e5fe52ff35 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (sql.Result, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..166b0fa972 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteBarByID = `-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (sql.Result, error) { + return q.db.ExecContext(ctx, deleteBarByID, id) +} diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql new file mode 100644 index 0000000000..73917782cb --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execresult +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json new file mode 100644 index 0000000000..49e9851aab --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/exec_result/query.sql b/internal/endtoend/testdata/exec_result/query.sql deleted file mode 100644 index 7f99212a9e..0000000000 --- a/internal/endtoend/testdata/exec_result/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: DeleteBarByID :execresult -DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/sqlc.json b/internal/endtoend/testdata/exec_result/sqlc.json deleted file mode 100644 index b23380237a..0000000000 --- a/internal/endtoend/testdata/exec_result/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql", - "emit_interface": 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_rows/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1b50d38666 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..5b5976e237 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteBarByID = `-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { + result, err := q.db.Exec(ctx, deleteBarByID, id) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql new file mode 100644 index 0000000000..94d2d09f90 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_rows/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1b50d38666 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..5b5976e237 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteBarByID = `-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { + result, err := q.db.Exec(ctx, deleteBarByID, id) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql new file mode 100644 index 0000000000..94d2d09f90 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_rows/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1b50d38666 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + DeleteBarByID(ctx context.Context, id int32) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..57dd159fd5 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteBarByID = `-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1 +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteBarByID, id) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql new file mode 100644 index 0000000000..94d2d09f90 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: DeleteBarByID :execrows +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json new file mode 100644 index 0000000000..49e9851aab --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/full_outer_join/sqlite/go/models.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go new file mode 100644 index 0000000000..f1e4064907 --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Author struct { + ID int64 + Name string +} + +type Book struct { + ID int64 + Title 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 new file mode 100644 index 0000000000..2e4903124d --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +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 +` + +type GetAuthorRow struct { + ID sql.NullInt64 + Name sql.NullString + ID_2 sql.NullInt64 + Title sql.NullString +} + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (GetAuthorRow, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i GetAuthorRow + err := row.Scan( + &i.ID, + &i.Name, + &i.ID_2, + &i.Title, + ) + return i, err +} diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/query.sql b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql new file mode 100644 index 0000000000..b9feaba655 --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql @@ -0,0 +1,5 @@ +-- 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 diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql b/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql new file mode 100644 index 0000000000..2018ca288c --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id INTEGER PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE books ( + id INTEGER PRIMARY KEY, + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json b/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json new file mode 100644 index 0000000000..99b3b5f074 --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json @@ -0,0 +1 @@ +{"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/func_aggregate/pganalyze/exec.json b/internal/endtoend/testdata/func_aggregate/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_aggregate/pganalyze/go/models.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..0d04b2855c --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors +` + +func (q *Queries) Percentile(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, percentile) + var percentile_disc string + err := row.Scan(&percentile_disc) + return percentile_disc, err +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql b/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql new file mode 100644 index 0000000000..cdda8237c9 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql @@ -0,0 +1,3 @@ +-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors; diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql b/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql new file mode 100644 index 0000000000..290bbe1642 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql @@ -0,0 +1,7 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json b/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/exec.json b/internal/endtoend/testdata/func_aggregate/postgresql/exec.json new file mode 100644 index 0000000000..c16f123ce3 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_aggregate/postgresql/go/models.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go new file mode 100644 index 0000000000..b57889b4a3 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors +` + +func (q *Queries) Percentile(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, percentile) + var percentile_disc interface{} + err := row.Scan(&percentile_disc) + return percentile_disc, err +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/query.sql b/internal/endtoend/testdata/func_aggregate/postgresql/query.sql new file mode 100644 index 0000000000..cdda8237c9 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors; diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql b/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql new file mode 100644 index 0000000000..290bbe1642 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql @@ -0,0 +1,7 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json b/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_args/go/db.go b/internal/endtoend/testdata/func_args/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/func_args/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_args/go/models.go b/internal/endtoend/testdata/func_args/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/func_args/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/go/query.sql.go b/internal/endtoend/testdata/func_args/go/query.sql.go deleted file mode 100644 index a2e2e83f51..0000000000 --- a/internal/endtoend/testdata/func_args/go/query.sql.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const makeIntervalDays = `-- name: MakeIntervalDays :one -SELECT make_interval(days => $1::int) -` - -func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalDays, dollar_1) - var make_interval int64 - err := row.Scan(&make_interval) - return make_interval, err -} - -const makeIntervalMonths = `-- name: MakeIntervalMonths :one -SELECT make_interval(months => $1::int) -` - -func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalMonths, months) - var make_interval int64 - err := row.Scan(&make_interval) - return make_interval, err -} - -const makeIntervalSecs = `-- name: MakeIntervalSecs :one -SELECT make_interval(secs => $1) -` - -func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalSecs, secs) - var make_interval int64 - err := row.Scan(&make_interval) - return make_interval, err -} - -const plus = `-- name: Plus :one -SELECT plus(b => $2, a => $1) -` - -type PlusParams struct { - A int32 - B int32 -} - -func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { - row := q.db.QueryRowContext(ctx, plus, arg.A, arg.B) - var plus int32 - err := row.Scan(&plus) - return plus, err -} - -const tableArgs = `-- name: TableArgs :one -SELECT table_args(x => $1) -` - -func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { - row := q.db.QueryRowContext(ctx, tableArgs, x) - var table_args int32 - err := row.Scan(&table_args) - return table_args, 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_args/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..74bd180307 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const makeIntervalDays = `-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int) +` + +func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (int64, error) { + row := q.db.QueryRow(ctx, makeIntervalDays, dollar_1) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalMonths = `-- name: MakeIntervalMonths :one +SELECT make_interval(months => $1::int) +` + +func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (int64, error) { + row := q.db.QueryRow(ctx, makeIntervalMonths, months) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalSecs = `-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1) +` + +func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (int64, error) { + row := q.db.QueryRow(ctx, makeIntervalSecs, secs) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const plus = `-- name: Plus :one +SELECT plus(b => $2, a => $1) +` + +type PlusParams struct { + A int32 + B int32 +} + +func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { + row := q.db.QueryRow(ctx, plus, arg.A, arg.B) + var plus int32 + err := row.Scan(&plus) + return plus, err +} + +const tableArgs = `-- name: TableArgs :one +SELECT table_args(x => $1) +` + +func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { + row := q.db.QueryRow(ctx, tableArgs, x) + var table_args int32 + err := row.Scan(&table_args) + return table_args, err +} diff --git a/internal/endtoend/testdata/func_args/pgx/v4/query.sql b/internal/endtoend/testdata/func_args/pgx/v4/query.sql new file mode 100644 index 0000000000..7ca3eace58 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/query.sql @@ -0,0 +1,14 @@ +-- name: Plus :one +SELECT plus(b => $2, a => $1); + +-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1); + +-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int); + +-- name: MakeIntervalMonths :one +SELECT make_interval(months => sqlc.arg('months')::int); + +-- name: TableArgs :one +SELECT table_args(x => $1); diff --git a/internal/endtoend/testdata/func_args/pgx/v4/schema.sql b/internal/endtoend/testdata/func_args/pgx/v4/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/db.go b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_args/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..55d849fca7 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const makeIntervalDays = `-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int) +` + +func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (pgtype.Interval, error) { + row := q.db.QueryRow(ctx, makeIntervalDays, dollar_1) + var make_interval pgtype.Interval + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalMonths = `-- name: MakeIntervalMonths :one +SELECT make_interval(months => $1::int) +` + +func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (pgtype.Interval, error) { + row := q.db.QueryRow(ctx, makeIntervalMonths, months) + var make_interval pgtype.Interval + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalSecs = `-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1) +` + +func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (pgtype.Interval, error) { + row := q.db.QueryRow(ctx, makeIntervalSecs, secs) + var make_interval pgtype.Interval + err := row.Scan(&make_interval) + return make_interval, err +} + +const plus = `-- name: Plus :one +SELECT plus(b => $2, a => $1) +` + +type PlusParams struct { + A int32 + B int32 +} + +func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { + row := q.db.QueryRow(ctx, plus, arg.A, arg.B) + var plus int32 + err := row.Scan(&plus) + return plus, err +} + +const tableArgs = `-- name: TableArgs :one +SELECT table_args(x => $1) +` + +func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { + row := q.db.QueryRow(ctx, tableArgs, x) + var table_args int32 + err := row.Scan(&table_args) + return table_args, err +} diff --git a/internal/endtoend/testdata/func_args/pgx/v5/query.sql b/internal/endtoend/testdata/func_args/pgx/v5/query.sql new file mode 100644 index 0000000000..7ca3eace58 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/query.sql @@ -0,0 +1,14 @@ +-- name: Plus :one +SELECT plus(b => $2, a => $1); + +-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1); + +-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int); + +-- name: MakeIntervalMonths :one +SELECT make_interval(months => sqlc.arg('months')::int); + +-- name: TableArgs :one +SELECT table_args(x => $1); diff --git a/internal/endtoend/testdata/func_args/pgx/v5/schema.sql b/internal/endtoend/testdata/func_args/pgx/v5/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_args/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/func_args/query.sql b/internal/endtoend/testdata/func_args/query.sql deleted file mode 100644 index bbc440081a..0000000000 --- a/internal/endtoend/testdata/func_args/query.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; - --- name: Plus :one -SELECT plus(b => $2, a => $1); - --- name: MakeIntervalSecs :one -SELECT make_interval(secs => $1); - --- name: MakeIntervalDays :one -SELECT make_interval(days => $1::int); - --- name: MakeIntervalMonths :one -SELECT make_interval(months => sqlc.arg('months')::int); - --- name: TableArgs :one -SELECT table_args(x => $1); diff --git a/internal/endtoend/testdata/func_args/sqlc.json b/internal/endtoend/testdata/func_args/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/func_args/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/func_args/stdlib/go/db.go b/internal/endtoend/testdata/func_args/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_args/stdlib/go/models.go b/internal/endtoend/testdata/func_args/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go new file mode 100644 index 0000000000..e083ece3f3 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const makeIntervalDays = `-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int) +` + +func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (int64, error) { + row := q.db.QueryRowContext(ctx, makeIntervalDays, dollar_1) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalMonths = `-- name: MakeIntervalMonths :one +SELECT make_interval(months => $1::int) +` + +func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (int64, error) { + row := q.db.QueryRowContext(ctx, makeIntervalMonths, months) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const makeIntervalSecs = `-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1) +` + +func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (int64, error) { + row := q.db.QueryRowContext(ctx, makeIntervalSecs, secs) + var make_interval int64 + err := row.Scan(&make_interval) + return make_interval, err +} + +const plus = `-- name: Plus :one +SELECT plus(b => $2, a => $1) +` + +type PlusParams struct { + A int32 + B int32 +} + +func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { + row := q.db.QueryRowContext(ctx, plus, arg.A, arg.B) + var plus int32 + err := row.Scan(&plus) + return plus, err +} + +const tableArgs = `-- name: TableArgs :one +SELECT table_args(x => $1) +` + +func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { + row := q.db.QueryRowContext(ctx, tableArgs, x) + var table_args int32 + err := row.Scan(&table_args) + return table_args, err +} diff --git a/internal/endtoend/testdata/func_args/stdlib/query.sql b/internal/endtoend/testdata/func_args/stdlib/query.sql new file mode 100644 index 0000000000..7ca3eace58 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/query.sql @@ -0,0 +1,14 @@ +-- name: Plus :one +SELECT plus(b => $2, a => $1); + +-- name: MakeIntervalSecs :one +SELECT make_interval(secs => $1); + +-- name: MakeIntervalDays :one +SELECT make_interval(days => $1::int); + +-- name: MakeIntervalMonths :one +SELECT make_interval(months => sqlc.arg('months')::int); + +-- name: TableArgs :one +SELECT table_args(x => $1); diff --git a/internal/endtoend/testdata/func_args/stdlib/schema.sql b/internal/endtoend/testdata/func_args/stdlib/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/stdlib/sqlc.json b/internal/endtoend/testdata/func_args/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_args_typecast/go/db.go b/internal/endtoend/testdata/func_args_typecast/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/func_args_typecast/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_args_typecast/go/models.go b/internal/endtoend/testdata/func_args_typecast/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/func_args_typecast/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/go/query.sql.go deleted file mode 100644 index 8abb20f8e5..0000000000 --- a/internal/endtoend/testdata/func_args_typecast/go/query.sql.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const plusPositionalCast = `-- name: PlusPositionalCast :one -SELECT plus($1, $2::INTEGER) -` - -type PlusPositionalCastParams struct { - A int32 - Column2 int32 -} - -func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { - row := q.db.QueryRowContext(ctx, plusPositionalCast, arg.A, arg.Column2) - var plus int32 - err := row.Scan(&plus) - return plus, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_args_typecast/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..9e091cf0f0 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const plusPositionalCast = `-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER) +` + +type PlusPositionalCastParams struct { + A int32 + Column2 int32 +} + +func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { + row := q.db.QueryRow(ctx, plusPositionalCast, arg.A, arg.Column2) + var plus int32 + err := row.Scan(&plus) + return plus, err +} diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql new file mode 100644 index 0000000000..5c5fccf030 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_args_typecast/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..9e091cf0f0 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const plusPositionalCast = `-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER) +` + +type PlusPositionalCastParams struct { + A int32 + Column2 int32 +} + +func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { + row := q.db.QueryRow(ctx, plusPositionalCast, arg.A, arg.Column2) + var plus int32 + err := row.Scan(&plus) + return plus, err +} diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql new file mode 100644 index 0000000000..5c5fccf030 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/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/func_args_typecast/query.sql b/internal/endtoend/testdata/func_args_typecast/query.sql deleted file mode 100644 index 399a5de922..0000000000 --- a/internal/endtoend/testdata/func_args_typecast/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - --- name: PlusPositionalCast :one -SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/sqlc.json b/internal/endtoend/testdata/func_args_typecast/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/func_args_typecast/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_args_typecast/stdlib/go/models.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..8d37ee409c --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const plusPositionalCast = `-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER) +` + +type PlusPositionalCastParams struct { + A int32 + Column2 int32 +} + +func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { + row := q.db.QueryRowContext(ctx, plusPositionalCast, arg.A, arg.Column2) + var plus int32 + err := row.Scan(&plus) + return plus, err +} diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql b/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql new file mode 100644 index 0000000000..5c5fccf030 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: PlusPositionalCast :one +SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql b/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json b/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_call_cast/go/db.go b/internal/endtoend/testdata/func_call_cast/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/func_call_cast/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_call_cast/go/models.go b/internal/endtoend/testdata/func_call_cast/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/func_call_cast/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/go/query.sql.go deleted file mode 100644 index 0415e7ff42..0000000000 --- a/internal/endtoend/testdata/func_call_cast/go/query.sql.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/google/uuid" -) - -const demo = `-- name: Demo :one -SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 -` - -func (q *Queries) Demo(ctx context.Context, uuidGenerateV5 interface{}) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, demo, uuidGenerateV5) - var col1 uuid.UUID - err := row.Scan(&col1) - return col1, err -} diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/db.go b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_call_cast/mysql/go/models.go b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..4199d37599 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const demo = `-- name: Demo :one +SELECT CAST(GREATEST(1,2,3,4,5) AS UNSIGNED) as col1 +` + +func (q *Queries) Demo(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, demo) + var col1 int64 + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/mysql/query.sql b/internal/endtoend/testdata/func_call_cast/mysql/query.sql new file mode 100644 index 0000000000..b653151a82 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: Demo :one +SELECT CAST(GREATEST(1,2,3,4,5) AS UNSIGNED) as col1 diff --git a/internal/endtoend/testdata/func_call_cast/mysql/schema.sql b/internal/endtoend/testdata/func_call_cast/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json b/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/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/func_call_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_call_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3c4ae5070b --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const demo = `-- name: Demo :one +SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 +` + +func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, demo, name) + var col1 uuid.UUID + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/func_call_cast/query.sql rename to internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_call_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..fb325cd9bc --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const demo = `-- name: Demo :one +SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 +` + +func (q *Queries) Demo(ctx context.Context, name string) (pgtype.UUID, error) { + row := q.db.QueryRow(ctx, demo, name) + var col1 pgtype.UUID + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..fa02ef793b --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Demo :one +SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1; diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/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/func_call_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_call_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..26f8697252 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const demo = `-- name: Demo :one +SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 +` + +func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { + row := q.db.QueryRowContext(ctx, demo, name) + var col1 uuid.UUID + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..fa02ef793b --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Demo :one +SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1; diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_call_cast/sqlc.json b/internal/endtoend/testdata/func_call_cast/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/func_call_cast/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_call_cast/sqlite/go/models.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..797db651d3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const demo = `-- name: Demo :one +SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 +` + +func (q *Queries) Demo(ctx context.Context) ([]byte, error) { + row := q.db.QueryRowContext(ctx, demo) + var col1 []byte + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/query.sql b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql new file mode 100644 index 0000000000..eb18aad656 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Demo :one +SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/schema.sql b/internal/endtoend/testdata/func_call_cast/sqlite/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json b/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/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/func_match_types/mysql/go/db.go b/internal/endtoend/testdata/func_match_types/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_match_types/mysql/go/models.go b/internal/endtoend/testdata/func_match_types/mysql/go/models.go new file mode 100644 index 0000000000..eb64577fc3 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/mysql/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Book struct { + ID int32 + Title string + Author string + Pages int32 +} 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 new file mode 100644 index 0000000000..4843b2807e --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const authorPages = `-- name: AuthorPages :many +select author, count(title) as num_books, SUM(pages) as total_pages +from books +group by author +` + +type AuthorPagesRow struct { + Author string + NumBooks int64 + TotalPages interface{} +} + +func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { + rows, err := q.db.QueryContext(ctx, authorPages) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AuthorPagesRow + for rows.Next() { + var i AuthorPagesRow + if err := rows.Scan(&i.Author, &i.NumBooks, &i.TotalPages); 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_match_types/mysql/query.sql b/internal/endtoend/testdata/func_match_types/mysql/query.sql new file mode 100644 index 0000000000..e3ad5471b6 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/mysql/query.sql @@ -0,0 +1,4 @@ +-- name: AuthorPages :many +select author, count(title) as num_books, SUM(pages) as total_pages +from books +group by author; diff --git a/internal/endtoend/testdata/func_match_types/mysql/schema.sql b/internal/endtoend/testdata/func_match_types/mysql/schema.sql new file mode 100644 index 0000000000..04aa15f82c --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE books ( + id integer PRIMARY KEY, + title text NOT NULL, + author text NOT NULL, + pages integer NOT NULL +); diff --git a/internal/endtoend/testdata/func_match_types/mysql/sqlc.json b/internal/endtoend/testdata/func_match_types/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/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/func_match_types/postgresql/go/db.go b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_match_types/postgresql/go/models.go b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go new file mode 100644 index 0000000000..eb64577fc3 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Book struct { + ID int32 + Title string + Author string + Pages int32 +} 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 new file mode 100644 index 0000000000..1a4f16f188 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const authorPages = `-- name: AuthorPages :many +select author, count(title) as num_books, SUM(pages) as total_pages +from books +group by author +` + +type AuthorPagesRow struct { + Author string + NumBooks int64 + TotalPages int64 +} + +func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { + rows, err := q.db.QueryContext(ctx, authorPages) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AuthorPagesRow + for rows.Next() { + var i AuthorPagesRow + if err := rows.Scan(&i.Author, &i.NumBooks, &i.TotalPages); 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_match_types/postgresql/query.sql b/internal/endtoend/testdata/func_match_types/postgresql/query.sql new file mode 100644 index 0000000000..e3ad5471b6 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/query.sql @@ -0,0 +1,4 @@ +-- name: AuthorPages :many +select author, count(title) as num_books, SUM(pages) as total_pages +from books +group by author; diff --git a/internal/endtoend/testdata/func_match_types/postgresql/schema.sql b/internal/endtoend/testdata/func_match_types/postgresql/schema.sql new file mode 100644 index 0000000000..cf91381e3f --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE books ( + id integer PRIMARY KEY, + title text NOT NULL, + author text NOT NULL, + pages integer NOT NULL +); diff --git a/internal/endtoend/testdata/func_match_types/postgresql/sqlc.json b/internal/endtoend/testdata/func_match_types/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/db.go b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_match_types/sqlite/go/models.go b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go new file mode 100644 index 0000000000..84258229b2 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Book struct { + ID int64 + Title string + Author string + Pages int64 +} 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 new file mode 100644 index 0000000000..60b373aeb9 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const authorPages = `-- name: AuthorPages :many +select author, count(title) as num_books, sum(pages) as total_pages +from books +group by author +` + +type AuthorPagesRow struct { + Author string + NumBooks int64 + TotalPages sql.NullFloat64 +} + +func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { + rows, err := q.db.QueryContext(ctx, authorPages) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AuthorPagesRow + for rows.Next() { + var i AuthorPagesRow + if err := rows.Scan(&i.Author, &i.NumBooks, &i.TotalPages); 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_match_types/sqlite/query.sql b/internal/endtoend/testdata/func_match_types/sqlite/query.sql new file mode 100644 index 0000000000..3452aebe01 --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: AuthorPages :many +select author, count(title) as num_books, sum(pages) as total_pages +from books +group by author; diff --git a/internal/endtoend/testdata/func_match_types/sqlite/schema.sql b/internal/endtoend/testdata/func_match_types/sqlite/schema.sql new file mode 100644 index 0000000000..04aa15f82c --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE books ( + id integer PRIMARY KEY, + title text NOT NULL, + author text NOT NULL, + pages integer NOT NULL +); diff --git a/internal/endtoend/testdata/func_match_types/sqlite/sqlc.json b/internal/endtoend/testdata/func_match_types/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/func_match_types/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/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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..e4cf9d17ae --- /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.30.0 + +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..03b53863f4 --- /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.30.0 +// 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/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_date/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..c11ac157c0 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getDate = `-- name: GetDate :one +SELECT now from NOW() +` + +func (q *Queries) GetDate(ctx context.Context) (pgtype.Timestamptz, error) { + row := q.db.QueryRow(ctx, getDate) + var now pgtype.Timestamptz + err := row.Scan(&now) + return now, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..8f71309953 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from NOW(); \ No newline at end of file diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/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/func_return_date/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_date/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..0a05becd82 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getDate = `-- name: GetDate :one +SELECT from CURRENT_DATE +` + +type GetDateRow struct { +} + +func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { + row := q.db.QueryRow(ctx, getDate) + var i GetDateRow + err := row.Scan() + return i, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b5696a969e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from CURRENT_DATE; diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/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/func_return_date/postgresql/stdlib/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_return_date/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..697afe2378 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getDate = `-- name: GetDate :one +SELECT from CURRENT_DATE +` + +type GetDateRow struct { +} + +func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { + row := q.db.QueryRowContext(ctx, getDate) + var i GetDateRow + err := row.Scan() + return i, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b5696a969e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from CURRENT_DATE; diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/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/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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..f323010acf --- /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.30.0 + +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..4aacc462ac --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..a976e628cf --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..a976e628cf --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/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/func_return_series/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_return_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..ab90ac0a03 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + 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_return_series/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/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/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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..c99cf3d8af --- /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.30.0 + +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..2d9be96f4b --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..85bf9ee12f --- /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.30.0 + +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..03818a02f4 --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..333ea43ea3 --- /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.30.0 + +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..8eca49cebe --- /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.30.0 +// 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) (interface{}, error) { + row := q.db.QueryRow(ctx, testFuncSelectBlog, pID) + var test_func_select_blog interface{} + 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_variadic/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..62625b2dd2 --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "encoding/json" +) + +type Test struct { + ID sql.NullInt32 + J json.RawMessage +} 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 new file mode 100644 index 0000000000..a4938a4241 --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const updateJ = `-- name: UpdateJ :exec +UPDATE + test +SET + j = jsonb_build_object($1::text, $2::text, $3::text, $4::text) +WHERE + id = $5 +` + +type UpdateJParams struct { + Column1 string + Column2 string + Column3 string + Column4 string + ID sql.NullInt32 +} + +func (q *Queries) UpdateJ(ctx context.Context, arg UpdateJParams) error { + _, err := q.db.ExecContext(ctx, updateJ, + arg.Column1, + arg.Column2, + arg.Column3, + arg.Column4, + arg.ID, + ) + return err +} diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..235e7cbb90 --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql @@ -0,0 +1,7 @@ +-- name: UpdateJ :exec +UPDATE + test +SET + j = jsonb_build_object($1::text, $2::text, $3::text, $4::text) +WHERE + id = $5; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6fdd78b6ed --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE test ( + id integer, + j jsonb NOT NULL + ); + diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/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/geometric/pgx/v4/go/db.go b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/geometric/pgx/v4/go/models.go b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go new file mode 100644 index 0000000000..1e9ad482a6 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VBoxNull pgtype.Box + VCircleNull pgtype.Circle + VLineNull pgtype.Line + VLsegNull pgtype.Lseg + VPathNull pgtype.Path + VPointNull pgtype.Point + VPolygonNull pgtype.Polygon + VBox pgtype.Box + VCircle pgtype.Circle + VLine pgtype.Line + VLseg pgtype.Lseg + VPath pgtype.Path + VPoint pgtype.Point + VPolygon pgtype.Polygon +} diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..164284d0a1 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_box_null, v_circle_null, v_line_null, v_lseg_null, v_path_null, v_point_null, v_polygon_null, v_box, v_circle, v_line, v_lseg, v_path, v_point, v_polygon +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBoxNull, + &i.VCircleNull, + &i.VLineNull, + &i.VLsegNull, + &i.VPathNull, + &i.VPointNull, + &i.VPolygonNull, + &i.VBox, + &i.VCircle, + &i.VLine, + &i.VLseg, + &i.VPath, + &i.VPoint, + &i.VPolygon, + ); 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/geometric/pgx/v4/query.sql b/internal/endtoend/testdata/geometric/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; diff --git a/internal/endtoend/testdata/geometric/pgx/v4/schema.sql b/internal/endtoend/testdata/geometric/pgx/v4/schema.sql new file mode 100644 index 0000000000..78a5f2109e --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE test_table +( + v_box_null box, + v_circle_null circle, + v_line_null line, + v_lseg_null lseg, + v_path_null path, + v_point_null point, + v_polygon_null polygon, + v_box box not null, + v_circle circle not null, + v_line line not null, + v_lseg lseg not null, + v_path path not null, + v_point point not null, + v_polygon polygon not null +); + diff --git a/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json b/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/db.go b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/geometric/pgx/v5/go/models.go b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go new file mode 100644 index 0000000000..82d4b4dfa9 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TestTable struct { + VBoxNull pgtype.Box + VCircleNull pgtype.Circle + VLineNull pgtype.Line + VLsegNull pgtype.Lseg + VPathNull pgtype.Path + VPointNull pgtype.Point + VPolygonNull pgtype.Polygon + VBox pgtype.Box + VCircle pgtype.Circle + VLine pgtype.Line + VLseg pgtype.Lseg + VPath pgtype.Path + VPoint pgtype.Point + VPolygon pgtype.Polygon +} diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..164284d0a1 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_box_null, v_circle_null, v_line_null, v_lseg_null, v_path_null, v_point_null, v_polygon_null, v_box, v_circle, v_line, v_lseg, v_path, v_point, v_polygon +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBoxNull, + &i.VCircleNull, + &i.VLineNull, + &i.VLsegNull, + &i.VPathNull, + &i.VPointNull, + &i.VPolygonNull, + &i.VBox, + &i.VCircle, + &i.VLine, + &i.VLseg, + &i.VPath, + &i.VPoint, + &i.VPolygon, + ); 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/geometric/pgx/v5/query.sql b/internal/endtoend/testdata/geometric/pgx/v5/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: SelectTest :many +SELECT * +from test_table; diff --git a/internal/endtoend/testdata/geometric/pgx/v5/schema.sql b/internal/endtoend/testdata/geometric/pgx/v5/schema.sql new file mode 100644 index 0000000000..78a5f2109e --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE test_table +( + v_box_null box, + v_circle_null circle, + v_line_null line, + v_lseg_null lseg, + v_path_null path, + v_point_null point, + v_polygon_null polygon, + v_box box not null, + v_circle circle not null, + v_line line not null, + v_lseg lseg not null, + v_path path not null, + v_point point not null, + v_polygon polygon not null +); + diff --git a/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json b/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/geometric/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/go.mod b/internal/endtoend/testdata/go.mod index 57a20a7f3e..e2a7ea704b 100644 --- a/internal/endtoend/testdata/go.mod +++ b/internal/endtoend/testdata/go.mod @@ -1,13 +1,35 @@ -module github.com/kyleconroy/sqlc/endtoend +module github.com/sqlc-dev/sqlc/endtoend -go 1.16 +go 1.18 require ( + github.com/go-sql-driver/mysql v1.7.0 github.com/gofrs/uuid v4.0.0+incompatible - github.com/google/uuid v1.2.0 + 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/kyleconroy/sqlc-testdata v0.0.0-20200512000015-15313bc43553 + github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904 + github.com/jackc/pgx/v5 v5.4.3 github.com/lib/pq v1.9.0 + github.com/sqlc-dev/pqtype v0.2.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 ( + github.com/friendsofgo/errors v0.9.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-20221227161230-091c0ba34f0a // indirect + github.com/pgvector/pgvector-go v0.1.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.9.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect +) diff --git a/internal/endtoend/testdata/go.sum b/internal/endtoend/testdata/go.sum index 117e479341..a5819e0a3b 100644 --- a/internal/endtoend/testdata/go.sum +++ b/internal/endtoend/testdata/go.sum @@ -1,4 +1,5 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +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= @@ -8,14 +9,17 @@ 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/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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 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/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= +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/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= @@ -29,10 +33,10 @@ github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853 h1:LRlrfJW9S99uiOCY github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= 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/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 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= 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= @@ -40,8 +44,11 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW 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 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU= 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/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= @@ -57,6 +64,12 @@ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXg 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/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU= +github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8= +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.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -68,8 +81,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN 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/kyleconroy/sqlc-testdata v0.0.0-20200512000015-15313bc43553 h1:IlnX6Ga5wEbn5Ejey9S6GTSzoAJuCnmxYjYZa6nUbsE= -github.com/kyleconroy/sqlc-testdata v0.0.0-20200512000015-15313bc43553/go.mod h1:F2aHHOnBI1Big/J6ffYQnyyUXxcZ1vI9IXPaA0noK8c= 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= @@ -84,6 +95,9 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd 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/pgvector/pgvector-go v0.1.1 h1:kqJigGctFnlWvskUiYIvJRNwUtQl/aMSUZVs0YWQe+g= +github.com/pgvector/pgvector-go v0.1.1/go.mod h1:wLJgD/ODkdtd2LJK4l6evHXTuG+8PxymYAVomKHOWac= +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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -93,17 +107,23 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK 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/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/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/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 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= 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.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= 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= @@ -126,8 +146,12 @@ golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaE 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 h1:3zb4D3T4G8jdExgVU/95+vQXfpEPiMdCaZgmGVxjNHM= 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.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= 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/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -146,8 +170,13 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= 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.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 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= @@ -160,12 +189,15 @@ golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8T 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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= 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 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..bf7f3fdc5b --- /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.30.0 + +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..426a750297 --- /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.30.0 +// 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..3062c6ad8e --- /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.30.0 + +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..a7c5349dab --- /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.30.0 +// 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..69bf4b51b6 --- /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.30.0 + +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..a5c350affa --- /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.30.0 +// 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..69bf4b51b6 --- /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.30.0 + +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..a5c350affa --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/having/mysql/go/models.go b/internal/endtoend/testdata/having/mysql/go/models.go new file mode 100644 index 0000000000..857d2a81f2 --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3dbecd981c --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const coldCities = `-- name: ColdCities :many +SELECT city +FROM weather +GROUP BY city +HAVING max(temp_lo) < ? +` + +func (q *Queries) ColdCities(ctx context.Context, tempLo int32) ([]string, error) { + rows, err := q.db.QueryContext(ctx, coldCities, tempLo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var city string + if err := rows.Scan(&city); err != nil { + return nil, err + } + items = append(items, city) + } + 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/having/mysql/query.sql b/internal/endtoend/testdata/having/mysql/query.sql new file mode 100644 index 0000000000..b234352fba --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: ColdCities :many +SELECT city +FROM weather +GROUP BY city +HAVING max(temp_lo) < ?; diff --git a/internal/endtoend/testdata/having/mysql/schema.sql b/internal/endtoend/testdata/having/mysql/schema.sql new file mode 100644 index 0000000000..b9e4261fce --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE weather ( + city text NOT NULL, + temp_lo integer NOT NULL +); + diff --git a/internal/endtoend/testdata/having/mysql/sqlc.json b/internal/endtoend/testdata/having/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/having/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/having/postgresql/go/db.go b/internal/endtoend/testdata/having/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/having/postgresql/go/models.go b/internal/endtoend/testdata/having/postgresql/go/models.go new file mode 100644 index 0000000000..857d2a81f2 --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..64f6b38ca9 --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const coldCities = `-- name: ColdCities :many +SELECT city +FROM weather +GROUP BY city +HAVING max(temp_lo) < $1 +` + +func (q *Queries) ColdCities(ctx context.Context, tempLo int32) ([]string, error) { + rows, err := q.db.QueryContext(ctx, coldCities, tempLo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var city string + if err := rows.Scan(&city); err != nil { + return nil, err + } + items = append(items, city) + } + 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/having/postgresql/query.sql b/internal/endtoend/testdata/having/postgresql/query.sql new file mode 100644 index 0000000000..5861dbab23 --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: ColdCities :many +SELECT city +FROM weather +GROUP BY city +HAVING max(temp_lo) < $1; diff --git a/internal/endtoend/testdata/having/postgresql/schema.sql b/internal/endtoend/testdata/having/postgresql/schema.sql new file mode 100644 index 0000000000..b9e4261fce --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE weather ( + city text NOT NULL, + temp_lo integer NOT NULL +); + diff --git a/internal/endtoend/testdata/having/postgresql/sqlc.json b/internal/endtoend/testdata/having/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/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/hstore/pgx/v4/go/db.go b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go new file mode 100644 index 0000000000..3b95a6875a --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/hstore/pgx/v4/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go new file mode 100644 index 0000000000..0d38588e84 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: hstore.sql + +package hstore + +import ( + "context" + + "github.com/jackc/pgtype" +) + +const listBar = `-- name: ListBar :many +SELECT bar FROM foo +` + +func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Hstore + for rows.Next() { + var bar pgtype.Hstore + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBaz = `-- name: ListBaz :many +SELECT baz FROM foo +` + +func (q *Queries) ListBaz(ctx context.Context) ([]pgtype.Hstore, error) { + rows, err := q.db.Query(ctx, listBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Hstore + for rows.Next() { + var baz pgtype.Hstore + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/models.go b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go new file mode 100644 index 0000000000..a736165f20 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +import ( + "github.com/jackc/pgtype" +) + +type Foo struct { + Bar pgtype.Hstore + Baz pgtype.Hstore +} diff --git a/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql new file mode 100644 index 0000000000..5299011de6 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql @@ -0,0 +1,14 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + +CREATE TABLE foo ( + bar hstore NOT NULL, + baz hstore +); + +-- name: ListBar :many +SELECT bar FROM foo; + +-- name: ListBaz :many +SELECT baz FROM foo; + + diff --git a/internal/endtoend/testdata/hstore/pgx/v4/sqlc.json b/internal/endtoend/testdata/hstore/pgx/v4/sqlc.json new file mode 100644 index 0000000000..66b4ca8872 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "hstore", + "schema": "hstore.sql", + "queries": "hstore.sql" + } + ] +} diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go new file mode 100644 index 0000000000..77d5163554 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +import ( + "context" + + "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 +} + +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/hstore/pgx/v5/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go new file mode 100644 index 0000000000..d97408441d --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: hstore.sql + +package hstore + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const listBar = `-- name: ListBar :many +SELECT bar FROM foo +` + +func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Hstore + for rows.Next() { + var bar pgtype.Hstore + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBaz = `-- name: ListBaz :many +SELECT baz FROM foo +` + +func (q *Queries) ListBaz(ctx context.Context) ([]pgtype.Hstore, error) { + rows, err := q.db.Query(ctx, listBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Hstore + for rows.Next() { + var baz pgtype.Hstore + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/models.go b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go new file mode 100644 index 0000000000..3a6e4a1287 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Hstore + Baz pgtype.Hstore +} diff --git a/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql new file mode 100644 index 0000000000..5299011de6 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql @@ -0,0 +1,14 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + +CREATE TABLE foo ( + bar hstore NOT NULL, + baz hstore +); + +-- name: ListBar :many +SELECT bar FROM foo; + +-- name: ListBaz :many +SELECT baz FROM foo; + + diff --git a/internal/endtoend/testdata/hstore/pgx/v5/sqlc.json b/internal/endtoend/testdata/hstore/pgx/v5/sqlc.json new file mode 100644 index 0000000000..5ae6383580 --- /dev/null +++ b/internal/endtoend/testdata/hstore/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "hstore", + "schema": "hstore.sql", + "queries": "hstore.sql" + } + ] +} diff --git a/internal/endtoend/testdata/hstore/stdlib/go/db.go b/internal/endtoend/testdata/hstore/stdlib/go/db.go new file mode 100644 index 0000000000..ae55290586 --- /dev/null +++ b/internal/endtoend/testdata/hstore/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +import ( + "context" + "database/sql" +) + +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 +} + +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/hstore/stdlib/go/hstore.sql.go b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go new file mode 100644 index 0000000000..0fb01ca1c2 --- /dev/null +++ b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: hstore.sql + +package hstore + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT bar FROM foo +` + +func (q *Queries) ListBar(ctx context.Context) ([]interface{}, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []interface{} + for rows.Next() { + var bar interface{} + 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 listBaz = `-- name: ListBaz :many +SELECT baz FROM foo +` + +func (q *Queries) ListBaz(ctx context.Context) ([]interface{}, error) { + rows, err := q.db.QueryContext(ctx, listBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []interface{} + for rows.Next() { + var baz interface{} + if err := rows.Scan(&baz); err != nil { + return nil, err + } + items = append(items, baz) + } + 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/hstore/stdlib/go/models.go b/internal/endtoend/testdata/hstore/stdlib/go/models.go new file mode 100644 index 0000000000..8fcd53858d --- /dev/null +++ b/internal/endtoend/testdata/hstore/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package hstore + +type Foo struct { + Bar interface{} + Baz interface{} +} diff --git a/internal/endtoend/testdata/hstore/stdlib/hstore.sql b/internal/endtoend/testdata/hstore/stdlib/hstore.sql new file mode 100644 index 0000000000..5299011de6 --- /dev/null +++ b/internal/endtoend/testdata/hstore/stdlib/hstore.sql @@ -0,0 +1,14 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + +CREATE TABLE foo ( + bar hstore NOT NULL, + baz hstore +); + +-- name: ListBar :many +SELECT bar FROM foo; + +-- name: ListBaz :many +SELECT baz FROM foo; + + diff --git a/internal/endtoend/testdata/hstore/stdlib/sqlc.json b/internal/endtoend/testdata/hstore/stdlib/sqlc.json new file mode 100644 index 0000000000..d218312403 --- /dev/null +++ b/internal/endtoend/testdata/hstore/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "hstore", + "schema": "hstore.sql", + "queries": "hstore.sql" + } + ] +} diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/db.go b/internal/endtoend/testdata/identical_tables/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/models.go b/internal/endtoend/testdata/identical_tables/mysql/go/models.go index 31b9b47eb4..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 e7a0e188c9..3d72df8d22 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/mysql/query.sql b/internal/endtoend/testdata/identical_tables/mysql/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/query.sql +++ b/internal/endtoend/testdata/identical_tables/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/mysql/schema.sql b/internal/endtoend/testdata/identical_tables/mysql/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/mysql/sqlc.json b/internal/endtoend/testdata/identical_tables/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/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/identical_tables/postgresql/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/identical_tables/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/identical_tables/postgresql/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/go/models.go deleted file mode 100644 index 31b9b47eb4..0000000000 --- a/internal/endtoend/testdata/identical_tables/postgresql/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID string -} - -type Foo struct { - ID string -} diff --git a/internal/endtoend/testdata/identical_tables/postgresql/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/go/query.sql.go deleted file mode 100644 index e7a0e188c9..0000000000 --- a/internal/endtoend/testdata/identical_tables/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const identicalTable = `-- name: IdenticalTable :many -SELECT id FROM foo -` - -func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identicalTable) - 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/identical_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/identical_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..962e8d9e66 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string +} + +type Foo 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 new file mode 100644 index 0000000000..6e424bf50d --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const identicalTable = `-- name: IdenticalTable :many +SELECT id FROM foo +` + +func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, identicalTable) + 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 +} diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..2e71d9a787 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: IdenticalTable :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/identical_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..962e8d9e66 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string +} + +type Foo 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 new file mode 100644 index 0000000000..6e424bf50d --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const identicalTable = `-- name: IdenticalTable :many +SELECT id FROM foo +` + +func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, identicalTable) + 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 +} diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..2e71d9a787 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: IdenticalTable :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/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/identical_tables/postgresql/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/query.sql deleted file mode 100644 index c995d0f183..0000000000 --- a/internal/endtoend/testdata/identical_tables/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - --- name: IdenticalTable :many -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/identical_tables/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/identical_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..962e8d9e66 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string +} + +type Foo 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 new file mode 100644 index 0000000000..3d72df8d22 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const identicalTable = `-- name: IdenticalTable :many +SELECT id FROM foo +` + +func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identicalTable) + 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/identical_tables/postgresql/stdlib/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..2e71d9a787 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: IdenticalTable :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/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/identical_tables/sqlite/go/db.go b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/identical_tables/sqlite/go/models.go b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go new file mode 100644 index 0000000000..962e8d9e66 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID string +} + +type Foo 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 new file mode 100644 index 0000000000..3d72df8d22 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const identicalTable = `-- name: IdenticalTable :many +SELECT id FROM foo +` + +func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identicalTable) + 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/identical_tables/sqlite/query.sql b/internal/endtoend/testdata/identical_tables/sqlite/query.sql new file mode 100644 index 0000000000..2e71d9a787 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: IdenticalTable :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/sqlite/schema.sql b/internal/endtoend/testdata/identical_tables/sqlite/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json b/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/identifier_case_sensitivity/db/models.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go new file mode 100644 index 0000000000..5041799d54 --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go new file mode 100644 index 0000000000..7e01490d7d --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go @@ -0,0 +1,78 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :execresult +INSERT INTO Authors ( + Name, Bio +) VALUES ( + ?, ? +) +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { + return q.db.ExecContext(ctx, createAuthor, 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 = ? 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/identifier_case_sensitivity/query.sql b/internal/endtoend/testdata/identifier_case_sensitivity/query.sql new file mode 100644 index 0000000000..c9a3b0c508 --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/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 :execresult +INSERT INTO Authors ( + Name, Bio +) VALUES ( + ?, ? +); + +-- name: DeleteAuthor :exec +DELETE FROM Authors +WHERE ID = ?; diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql b/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql new file mode 100644 index 0000000000..474238ca9c --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE Authors ( + ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + Name text NOT NULL, + Bio text +); + diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json b/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json new file mode 100644 index 0000000000..32a13d6fc6 --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/db.go b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/identifier_dollar_sign/db/models.go b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go new file mode 100644 index 0000000000..32099017df --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go new file mode 100644 index 0000000000..357c440e49 --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const fn = `-- name: Fn :one +SELECT f$n() +` + +func (q *Queries) Fn(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, fn) + var f_n int32 + err := row.Scan(&f_n) + return f_n, err +} diff --git a/internal/endtoend/testdata/identifier_dollar_sign/query.sql b/internal/endtoend/testdata/identifier_dollar_sign/query.sql new file mode 100644 index 0000000000..6b17cdf2dc --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/query.sql @@ -0,0 +1,2 @@ +-- name: Fn :one +SELECT f$n(); diff --git a/internal/endtoend/testdata/identifier_dollar_sign/schema.sql b/internal/endtoend/testdata/identifier_dollar_sign/schema.sql new file mode 100644 index 0000000000..fd248d2245 --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/schema.sql @@ -0,0 +1,3 @@ +CREATE FUNCTION f$n() RETURNS integer + AS $$ SELECT 1 $$ LANGUAGE SQL; + diff --git a/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json b/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json new file mode 100644 index 0000000000..2a46100899 --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..cde8844271 --- /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.30.0 + +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..4da95c2e62 --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/db.go +++ b/internal/endtoend/testdata/inflection/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/mysql/go/models.go b/internal/endtoend/testdata/inflection/mysql/go/models.go index 2f2834125a..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/models.go +++ b/internal/endtoend/testdata/inflection/mysql/go/models.go @@ -1,13 +1,25 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () +type Calorie struct { + ID string +} type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + +type ProductMetum struct { + ID string +} + type Student 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 da0a3338f5..9dc173e9bc 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -7,6 +9,60 @@ 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 +` + +func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listCalories) + 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 listCampuses = `-- name: ListCampuses :many SELECT id FROM campus ` @@ -34,6 +90,33 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } +const listMetadata = `-- name: ListMetadata :many +SELECT id FROM product_meta +` + +func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listMetadata) + 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 listStudents = `-- name: ListStudents :many SELECT id FROM students ` diff --git a/internal/endtoend/testdata/inflection/mysql/query.sql b/internal/endtoend/testdata/inflection/mysql/query.sql index 2b98c07785..74e1aaf8c3 100644 --- a/internal/endtoend/testdata/inflection/mysql/query.sql +++ b/internal/endtoend/testdata/inflection/mysql/query.sql @@ -1,8 +1,14 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); - /* name: ListCampuses :many */ SELECT * FROM campus; /* name: ListStudents :many */ SELECT * FROM students; + +/* name: ListMetadata :many */ +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 new file mode 100644 index 0000000000..f7d5c7c2a5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/mysql/schema.sql @@ -0,0 +1,5 @@ +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/mysql/sqlc.json b/internal/endtoend/testdata/inflection/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/inflection/mysql/sqlc.json +++ b/internal/endtoend/testdata/inflection/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/inflection/postgresql/go/db.go b/internal/endtoend/testdata/inflection/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/inflection/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/inflection/postgresql/go/models.go b/internal/endtoend/testdata/inflection/postgresql/go/models.go deleted file mode 100644 index 2f2834125a..0000000000 --- a/internal/endtoend/testdata/inflection/postgresql/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Campus struct { - ID string -} - -type Student struct { - ID string -} diff --git a/internal/endtoend/testdata/inflection/postgresql/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/go/query.sql.go deleted file mode 100644 index da0a3338f5..0000000000 --- a/internal/endtoend/testdata/inflection/postgresql/go/query.sql.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listCampuses = `-- name: ListCampuses :many -SELECT id FROM campus -` - -func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCampuses) - 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 listStudents = `-- name: ListStudents :many -SELECT id FROM students -` - -func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listStudents) - 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/inflection/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/inflection/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..dc018924d5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Calorie struct { + ID string +} + +type Campus struct { + ID string +} + +type ProductMetadatum struct { + ID string +} + +type ProductMetum struct { + ID string +} + +type Student 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 new file mode 100644 index 0000000000..1f9673c638 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,130 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +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 +` + +func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listCalories) + 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 listCampuses = `-- name: ListCampuses :many +SELECT id FROM campus +` + +func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listCampuses) + 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 listMetadata = `-- name: ListMetadata :many +SELECT id FROM product_meta +` + +func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listMetadata) + 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 listStudents = `-- name: ListStudents :many +SELECT id FROM students +` + +func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listStudents) + 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 +} diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..abc0da2ef2 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql @@ -0,0 +1,14 @@ +-- name: ListCampuses :many +SELECT * FROM campus; + +-- name: ListStudents :many +SELECT * FROM students; + +-- name: ListMetadata :many +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 new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +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/v4/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/inflection/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..dc018924d5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Calorie struct { + ID string +} + +type Campus struct { + ID string +} + +type ProductMetadatum struct { + ID string +} + +type ProductMetum struct { + ID string +} + +type Student 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 new file mode 100644 index 0000000000..1f9673c638 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,130 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +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 +` + +func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listCalories) + 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 listCampuses = `-- name: ListCampuses :many +SELECT id FROM campus +` + +func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listCampuses) + 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 listMetadata = `-- name: ListMetadata :many +SELECT id FROM product_meta +` + +func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listMetadata) + 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 listStudents = `-- name: ListStudents :many +SELECT id FROM students +` + +func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, listStudents) + 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 +} diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..abc0da2ef2 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql @@ -0,0 +1,14 @@ +-- name: ListCampuses :many +SELECT * FROM campus; + +-- name: ListStudents :many +SELECT * FROM students; + +-- name: ListMetadata :many +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 new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +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/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/inflection/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/inflection/postgresql/query.sql b/internal/endtoend/testdata/inflection/postgresql/query.sql deleted file mode 100644 index d88250fdf6..0000000000 --- a/internal/endtoend/testdata/inflection/postgresql/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); - --- name: ListCampuses :many -SELECT * FROM campus; - --- name: ListStudents :many -SELECT * FROM students; diff --git a/internal/endtoend/testdata/inflection/postgresql/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/inflection/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/inflection/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..dc018924d5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Calorie struct { + ID string +} + +type Campus struct { + ID string +} + +type ProductMetadatum struct { + ID string +} + +type ProductMetum struct { + ID string +} + +type Student 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 new file mode 100644 index 0000000000..9dc173e9bc --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,145 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +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 +` + +func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listCalories) + 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 listCampuses = `-- name: ListCampuses :many +SELECT id FROM campus +` + +func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listCampuses) + 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 listMetadata = `-- name: ListMetadata :many +SELECT id FROM product_meta +` + +func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listMetadata) + 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 listStudents = `-- name: ListStudents :many +SELECT id FROM students +` + +func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listStudents) + 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/inflection/postgresql/stdlib/query.sql b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..abc0da2ef2 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql @@ -0,0 +1,14 @@ +-- name: ListCampuses :many +SELECT * FROM campus; + +-- name: ListStudents :many +SELECT * FROM students; + +-- name: ListMetadata :many +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 new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +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/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/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/inflection/sqlite/go/db.go b/internal/endtoend/testdata/inflection/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/inflection/sqlite/go/models.go b/internal/endtoend/testdata/inflection/sqlite/go/models.go new file mode 100644 index 0000000000..dc018924d5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Calorie struct { + ID string +} + +type Campus struct { + ID string +} + +type ProductMetadatum struct { + ID string +} + +type ProductMetum struct { + ID string +} + +type Student 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 new file mode 100644 index 0000000000..9dc173e9bc --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go @@ -0,0 +1,145 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +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 +` + +func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listCalories) + 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 listCampuses = `-- name: ListCampuses :many +SELECT id FROM campus +` + +func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listCampuses) + 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 listMetadata = `-- name: ListMetadata :many +SELECT id FROM product_meta +` + +func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listMetadata) + 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 listStudents = `-- name: ListStudents :many +SELECT id FROM students +` + +func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listStudents) + 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/inflection/sqlite/query.sql b/internal/endtoend/testdata/inflection/sqlite/query.sql new file mode 100644 index 0000000000..74e1aaf8c3 --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/query.sql @@ -0,0 +1,14 @@ +/* name: ListCampuses :many */ +SELECT * FROM campus; + +/* name: ListStudents :many */ +SELECT * FROM students; + +/* name: ListMetadata :many */ +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/sqlite/schema.sql b/internal/endtoend/testdata/inflection/sqlite/schema.sql new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/schema.sql @@ -0,0 +1,5 @@ +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/sqlc.json b/internal/endtoend/testdata/inflection/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/inflection/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/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..42c15bfccc --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Name string +} + +type Exclusions struct { + ID int32 + Name string +} + +type MyData 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 new file mode 100644 index 0000000000..a1f8824ce5 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteBarByID = `-- name: DeleteBarByID :one +DELETE FROM bars WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (Bar, error) { + row := q.db.QueryRow(ctx, deleteBarByID, id) + var i Bar + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const deleteExclusionByID = `-- name: DeleteExclusionByID :one +DELETE FROM exclusions WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteExclusionByID(ctx context.Context, id int32) (Exclusions, error) { + row := q.db.QueryRow(ctx, deleteExclusionByID, id) + var i Exclusions + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const deleteMyDataByID = `-- name: DeleteMyDataByID :one +DELETE FROM my_data WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteMyDataByID(ctx context.Context, id int32) (MyData, error) { + row := q.db.QueryRow(ctx, deleteMyDataByID, id) + var i MyData + err := row.Scan(&i.ID, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..f279a10738 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- 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/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ea5b797e08 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +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/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..6c17458e27 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,21 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "sql_package": "pgx/v4", + "out": "go", + "inflection_exclude_table_names": [ + "my_data", + "exclusions" + ] + } + } + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..42c15bfccc --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Name string +} + +type Exclusions struct { + ID int32 + Name string +} + +type MyData 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 new file mode 100644 index 0000000000..a1f8824ce5 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteBarByID = `-- name: DeleteBarByID :one +DELETE FROM bars WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (Bar, error) { + row := q.db.QueryRow(ctx, deleteBarByID, id) + var i Bar + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const deleteExclusionByID = `-- name: DeleteExclusionByID :one +DELETE FROM exclusions WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteExclusionByID(ctx context.Context, id int32) (Exclusions, error) { + row := q.db.QueryRow(ctx, deleteExclusionByID, id) + var i Exclusions + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const deleteMyDataByID = `-- name: DeleteMyDataByID :one +DELETE FROM my_data WHERE id = $1 RETURNING id, name +` + +func (q *Queries) DeleteMyDataByID(ctx context.Context, id int32) (MyData, error) { + row := q.db.QueryRow(ctx, deleteMyDataByID, id) + var i MyData + err := row.Scan(&i.ID, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..f279a10738 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- 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/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ea5b797e08 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +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/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..3d058c34c6 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,21 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "sql_package": "pgx/v5", + "out": "go", + "inflection_exclude_table_names": [ + "my_data", + "exclusions" + ] + } + } + } + ] +} diff --git a/internal/endtoend/testdata/insert_cte/go/db.go b/internal/endtoend/testdata/insert_cte/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/insert_cte/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_cte/go/models.go b/internal/endtoend/testdata/insert_cte/go/models.go deleted file mode 100644 index d514e4feaa..0000000000 --- a/internal/endtoend/testdata/insert_cte/go/models.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" - "time" -) - -type Td3Code struct { - ID int32 - TsCreated time.Time - TsUpdated time.Time - CreatedBy string - UpdatedBy string - Code sql.NullString - Hash sql.NullString - IsPrivate sql.NullBool -} - -type Td3TestCode struct { - ID int32 - TsCreated time.Time - TsUpdated time.Time - CreatedBy string - UpdatedBy string - TestID int32 - CodeHash string -} diff --git a/internal/endtoend/testdata/insert_cte/go/query.sql.go b/internal/endtoend/testdata/insert_cte/go/query.sql.go deleted file mode 100644 index edc69a6b35..0000000000 --- a/internal/endtoend/testdata/insert_cte/go/query.sql.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const insertCode = `-- name: InsertCode :one - -WITH cc AS ( - INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) - VALUES ($1, $1, $2, $3, false) - RETURNING hash -) -INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) -VALUES( - $1, $1, $4, (select hash from cc) -) -RETURNING id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash -` - -type InsertCodeParams struct { - CreatedBy string - Code sql.NullString - Hash sql.NullString - TestID int32 -} - -// FILE: query.sql -func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { - row := q.db.QueryRowContext(ctx, insertCode, - arg.CreatedBy, - arg.Code, - arg.Hash, - arg.TestID, - ) - var i Td3TestCode - err := row.Scan( - &i.ID, - &i.TsCreated, - &i.TsUpdated, - &i.CreatedBy, - &i.UpdatedBy, - &i.TestID, - &i.CodeHash, - ) - return i, err -} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go new file mode 100644 index 0000000000..fda938bb99 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Td3Code struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + Code sql.NullString + Hash sql.NullString + IsPrivate sql.NullBool +} + +type Td3TestCode struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} 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 new file mode 100644 index 0000000000..732bcac74a --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertCode = `-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type InsertCodeParams struct { + CreatedBy string + Code sql.NullString + Hash sql.NullString + TestID int32 +} + +func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { + row := q.db.QueryRow(ctx, insertCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i Td3TestCode + err := row.Scan( + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql b/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql new file mode 100644 index 0000000000..7e7483f128 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql @@ -0,0 +1,11 @@ +-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING *; diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go new file mode 100644 index 0000000000..5f27f6c6bd --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Td3Code struct { + ID int32 + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz + CreatedBy string + UpdatedBy string + Code pgtype.Text + Hash pgtype.Text + IsPrivate pgtype.Bool +} + +type Td3TestCode struct { + ID int32 + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} 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 new file mode 100644 index 0000000000..451bae46cb --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertCode = `-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type InsertCodeParams struct { + CreatedBy string + Code pgtype.Text + Hash pgtype.Text + TestID int32 +} + +func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { + row := q.db.QueryRow(ctx, insertCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i Td3TestCode + err := row.Scan( + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql b/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql new file mode 100644 index 0000000000..7e7483f128 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql @@ -0,0 +1,11 @@ +-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING *; diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/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/insert_cte/query.sql b/internal/endtoend/testdata/insert_cte/query.sql deleted file mode 100644 index c3673b24b1..0000000000 --- a/internal/endtoend/testdata/insert_cte/query.sql +++ /dev/null @@ -1,42 +0,0 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - --- name: InsertCode :one -WITH cc AS ( - INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) - VALUES ($1, $1, $2, $3, false) - RETURNING hash -) -INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) -VALUES( - $1, $1, $4, (select hash from cc) -) -RETURNING *; diff --git a/internal/endtoend/testdata/insert_cte/sqlc.json b/internal/endtoend/testdata/insert_cte/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/insert_cte/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/db.go b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_cte/stdlib/go/models.go b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go new file mode 100644 index 0000000000..fda938bb99 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Td3Code struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + Code sql.NullString + Hash sql.NullString + IsPrivate sql.NullBool +} + +type Td3TestCode struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go new file mode 100644 index 0000000000..383b87b276 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertCode = `-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type InsertCodeParams struct { + CreatedBy string + Code sql.NullString + Hash sql.NullString + TestID int32 +} + +func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { + row := q.db.QueryRowContext(ctx, insertCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i Td3TestCode + err := row.Scan( + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/insert_cte/stdlib/query.sql b/internal/endtoend/testdata/insert_cte/stdlib/query.sql new file mode 100644 index 0000000000..7e7483f128 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: InsertCode :one +WITH cc AS ( + INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) + VALUES ($1, $1, $2, $3, false) + RETURNING hash +) +INSERT INTO td3.test_codes(created_by, updated_by, test_id, code_hash) +VALUES( + $1, $1, $4, (select hash from cc) +) +RETURNING *; diff --git a/internal/endtoend/testdata/insert_cte/stdlib/schema.sql b/internal/endtoend/testdata/insert_cte/stdlib/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json b/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..0dcacbeefd --- /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.30.0 + +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..669b57b2df --- /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.30.0 +// 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..107afbe8b5 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: InsertWorkspace :exec +INSERT INTO workspace DEFAULT VALUES; \ No newline at end of file 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/mysql/go/models.go b/internal/endtoend/testdata/insert_select/mysql/go/models.go index b9f6dc7049..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 e4457b6470..cc635082ee 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -15,7 +17,7 @@ FROM bar WHERE ready = ? type InsertSelectParams struct { Meta string - Ready int32 + Ready bool } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { diff --git a/internal/endtoend/testdata/insert_select/mysql/query.sql b/internal/endtoend/testdata/insert_select/mysql/query.sql index 69aee7f0e9..880f083f9e 100644 --- a/internal/endtoend/testdata/insert_select/mysql/query.sql +++ b/internal/endtoend/testdata/insert_select/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - /* name: InsertSelect :exec */ INSERT INTO foo (name, meta) SELECT name, ? diff --git a/internal/endtoend/testdata/insert_select/mysql/schema.sql b/internal/endtoend/testdata/insert_select/mysql/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/mysql/sqlc.json b/internal/endtoend/testdata/insert_select/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_select/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_select/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/postgresql/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/insert_select/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_select/postgresql/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/go/models.go deleted file mode 100644 index b9f6dc7049..0000000000 --- a/internal/endtoend/testdata/insert_select/postgresql/go/models.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - Name string - Ready bool -} - -type Foo struct { - Name string - Meta string -} diff --git a/internal/endtoend/testdata/insert_select/postgresql/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/go/query.sql.go deleted file mode 100644 index fdc0572293..0000000000 --- a/internal/endtoend/testdata/insert_select/postgresql/go/query.sql.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const insertSelect = `-- name: InsertSelect :exec -INSERT INTO foo (name, meta) -SELECT name, $1 -FROM bar WHERE ready = $2 -` - -type InsertSelectParams struct { - Meta string - Ready bool -} - -func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..16bc8a120c --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Name string + Ready bool +} + +type Foo struct { + Name string + Meta string +} 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 new file mode 100644 index 0000000000..9e8dec1fb9 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2 +` + +type InsertSelectParams struct { + Meta string + Ready bool +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.Exec(ctx, insertSelect, arg.Meta, arg.Ready) + return err +} diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..8478c05f05 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql @@ -0,0 +1,4 @@ +-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2; diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..16bc8a120c --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Name string + Ready bool +} + +type Foo struct { + Name string + Meta string +} 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 new file mode 100644 index 0000000000..9e8dec1fb9 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2 +` + +type InsertSelectParams struct { + Meta string + Ready bool +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.Exec(ctx, insertSelect, arg.Meta, arg.Ready) + return err +} diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..8478c05f05 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql @@ -0,0 +1,4 @@ +-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2; diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/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/insert_select/postgresql/query.sql b/internal/endtoend/testdata/insert_select/postgresql/query.sql deleted file mode 100644 index 04bd65e84b..0000000000 --- a/internal/endtoend/testdata/insert_select/postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - --- name: InsertSelect :exec -INSERT INTO foo (name, meta) -SELECT name, $1 -FROM bar WHERE ready = $2; diff --git a/internal/endtoend/testdata/insert_select/postgresql/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/insert_select/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_select/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..16bc8a120c --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Name string + Ready bool +} + +type Foo struct { + Name string + Meta string +} 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 new file mode 100644 index 0000000000..ab34ae3502 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2 +` + +type InsertSelectParams struct { + Meta string + Ready bool +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) + return err +} diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..8478c05f05 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, $1 +FROM bar WHERE ready = $2; diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/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/insert_select/sqlite/go/db.go b/internal/endtoend/testdata/insert_select/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_select/sqlite/go/models.go b/internal/endtoend/testdata/insert_select/sqlite/go/models.go new file mode 100644 index 0000000000..16bc8a120c --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Name string + Ready bool +} + +type Foo struct { + Name string + Meta string +} diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go new file mode 100644 index 0000000000..cc635082ee --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO foo (name, meta) +SELECT name, ? +FROM bar WHERE ready = ? +` + +type InsertSelectParams struct { + Meta string + Ready bool +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) + return err +} diff --git a/internal/endtoend/testdata/insert_select/sqlite/query.sql b/internal/endtoend/testdata/insert_select/sqlite/query.sql new file mode 100644 index 0000000000..880f083f9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/query.sql @@ -0,0 +1,4 @@ +/* name: InsertSelect :exec */ +INSERT INTO foo (name, meta) +SELECT name, ? +FROM bar WHERE ready = ?; diff --git a/internal/endtoend/testdata/insert_select/sqlite/schema.sql b/internal/endtoend/testdata/insert_select/sqlite/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/sqlite/sqlc.json b/internal/endtoend/testdata/insert_select/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/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_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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..284ebb005e --- /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.30.0 + +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..aee709a672 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3311b32009 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/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/insert_select_invalid/mysql/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt new file mode 100644 index 0000000000..91d0b8a06c --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..fad60fef89 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: InsertFoo :exec +INSERT INTO foo (bar) +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..7448a74a95 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..fad60fef89 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: InsertFoo :exec +INSERT INTO foo (bar) +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/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/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..7448a74a95 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..fad60fef89 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: InsertFoo :exec +INSERT INTO foo (bar) +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/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/insert_select_invalid/postgresql/stdlib/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..95a26a4d4f --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: 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 new file mode 100644 index 0000000000..3311b32009 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/query.sql @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/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_invalid/sqlite/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt new file mode 100644 index 0000000000..20a7ac053a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: sqlite3: SQL logic error: 3 values for 1 columns diff --git a/internal/endtoend/testdata/insert_select_param/issue.md b/internal/endtoend/testdata/insert_select_param/issue.md new file mode 100644 index 0000000000..bbb421e88d --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1328 \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_param/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +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/insert_select_param/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..999d9b755d --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO authors (id, name, bio) +SELECT $1, name, bio +FROM authors +WHERE name = $2 +` + +type InsertSelectParams struct { + ID pgtype.Int8 + Name pgtype.Text +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.Exec(ctx, insertSelect, arg.ID, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql new file mode 100644 index 0000000000..ab990b0339 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: InsertSelect :exec +INSERT INTO authors (id, name, bio) +SELECT @id, name, bio +FROM authors +WHERE name = @name; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6684317695 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/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" \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/mysql/go/db.go b/internal/endtoend/testdata/insert_values/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/go/models.go b/internal/endtoend/testdata/insert_values/mysql/go/models.go index f5e6321432..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 41e1a6a125..48ad158166 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -8,6 +10,27 @@ import ( "database/sql" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES (?, ?) ` diff --git a/internal/endtoend/testdata/insert_values/mysql/query.sql b/internal/endtoend/testdata/insert_values/mysql/query.sql index 78a29ccd39..774165baa8 100644 --- a/internal/endtoend/testdata/insert_values/mysql/query.sql +++ b/internal/endtoend/testdata/insert_values/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO foo (a, b) VALUES (?, ?); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/mysql/schema.sql b/internal/endtoend/testdata/insert_values/mysql/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/mysql/sqlc.json b/internal/endtoend/testdata/insert_values/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_values/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_values/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_values/postgresql/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/insert_values/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_values/postgresql/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/go/models.go deleted file mode 100644 index f5e6321432..0000000000 --- a/internal/endtoend/testdata/insert_values/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString - B sql.NullInt32 -} diff --git a/internal/endtoend/testdata/insert_values/postgresql/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/go/query.sql.go deleted file mode 100644 index 3e1601dc44..0000000000 --- a/internal/endtoend/testdata/insert_values/postgresql/go/query.sql.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const insertValues = `-- name: InsertValues :exec -INSERT INTO foo (a, b) VALUES ($1, $2) -` - -type InsertValuesParams struct { - A sql.NullString - B sql.NullInt32 -} - -func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_values/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f2005088fc --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..87e661b275 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.Exec(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + +const insertValues = `-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..0c2b0d6ea4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_values/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..903f1becc4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..1d1700f3a7 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A pgtype.Text + B pgtype.Int4 + A_2 pgtype.Text + B_2 pgtype.Int4 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.Exec(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + +const insertValues = `-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..0c2b0d6ea4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/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/insert_values/postgresql/query.sql b/internal/endtoend/testdata/insert_values/postgresql/query.sql deleted file mode 100644 index b2ec168840..0000000000 --- a/internal/endtoend/testdata/insert_values/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a text, b integer); - --- name: InsertValues :exec -INSERT INTO foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values/postgresql/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/insert_values/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_values/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f2005088fc --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..1fc6cf6420 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + +const insertValues = `-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..0c2b0d6ea4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/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/insert_values/sqlite/go/db.go b/internal/endtoend/testdata/insert_values/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_values/sqlite/go/models.go b/internal/endtoend/testdata/insert_values/sqlite/go/models.go new file mode 100644 index 0000000000..dd3059b3f4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt64 +} diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go new file mode 100644 index 0000000000..020dbedda1 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt64 + A_2 sql.NullString + B_2 sql.NullInt64 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + +const insertValues = `-- name: InsertValues :exec +INSERT INTO foo (a, b) VALUES (?, ?) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt64 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values/sqlite/query.sql b/internal/endtoend/testdata/insert_values/sqlite/query.sql new file mode 100644 index 0000000000..774165baa8 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/query.sql @@ -0,0 +1,5 @@ +/* name: InsertValues :exec */ +INSERT INTO foo (a, b) VALUES (?, ?); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/sqlite/schema.sql b/internal/endtoend/testdata/insert_values/sqlite/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/sqlite/sqlc.json b/internal/endtoend/testdata/insert_values/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/insert_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_values_only/issue.md b/internal/endtoend/testdata/insert_values_only/issue.md new file mode 100644 index 0000000000..a7ea8fc1ac --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/938 \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_values_only/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..5e934e1313 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..a265e061b4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertStatus = `-- name: InsertStatus :exec +INSERT INTO status VALUES ($1, $2) +` + +type InsertStatusParams struct { + Column1 pgtype.Int4 + Column2 pgtype.Text +} + +func (q *Queries) InsertStatus(ctx context.Context, arg InsertStatusParams) error { + _, err := q.db.Exec(ctx, insertStatus, arg.Column1, arg.Column2) + return err +} diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql new file mode 100644 index 0000000000..97313e7b17 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: InsertStatus :exec +INSERT INTO status VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..fc8f305d1e --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE status +( + id integer, + name varchar(100) NOT NULL, + PRIMARY KEY(id) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/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/insert_values_public/mysql/go/db.go b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_values_public/mysql/go/models.go b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go new file mode 100644 index 0000000000..f2005088fc --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..e8bba2efbd --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertValues = `-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES (?, ?) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values_public/mysql/query.sql b/internal/endtoend/testdata/insert_values_public/mysql/query.sql new file mode 100644 index 0000000000..22caf7b339 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: InsertValues :exec */ +INSERT INTO public.foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/insert_values_public/mysql/schema.sql b/internal/endtoend/testdata/insert_values_public/mysql/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json b/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/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/insert_values_public/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_values_public/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f2005088fc --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..7661064e22 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertValues = `-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..9b6c822ab1 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_values_public/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..903f1becc4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..1f43dec81c --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertValues = `-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A pgtype.Text + B pgtype.Int4 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..9b6c822ab1 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/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/insert_values_public/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_values_public/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f2005088fc --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..3d43beeadb --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertValues = `-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2) +` + +type InsertValuesParams struct { + A sql.NullString + B sql.NullInt32 +} + +func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { + _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + return err +} diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..9b6c822ab1 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: InsertValues :exec +INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/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/interval/go/db.go b/internal/endtoend/testdata/interval/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/interval/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/interval/go/models.go b/internal/endtoend/testdata/interval/go/models.go deleted file mode 100644 index ff72c91a41..0000000000 --- a/internal/endtoend/testdata/interval/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar bool - Interval int64 -} diff --git a/internal/endtoend/testdata/interval/go/query.sql.go b/internal/endtoend/testdata/interval/go/query.sql.go deleted file mode 100644 index ccdae8a7b1..0000000000 --- a/internal/endtoend/testdata/interval/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const get = `-- name: Get :many -SELECT bar, "interval" FROM foo LIMIT $1 -` - -func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, get, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.Bar, &i.Interval); 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/interval/pgx/v4/exec.json b/internal/endtoend/testdata/interval/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/db.go b/internal/endtoend/testdata/interval/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/interval/pgx/v4/go/models.go b/internal/endtoend/testdata/interval/pgx/v4/go/models.go new file mode 100644 index 0000000000..9fec5373e2 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..db86257899 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const get = `-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1 +` + +func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { + rows, err := q.db.Query(ctx, get, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Interval); 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/interval/pgx/v4/query.sql b/internal/endtoend/testdata/interval/pgx/v4/query.sql new file mode 100644 index 0000000000..27cd9d79ec --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/pgx/v4/schema.sql b/internal/endtoend/testdata/interval/pgx/v4/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/pgx/v4/sqlc.json b/internal/endtoend/testdata/interval/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/interval/pgx/v5/exec.json b/internal/endtoend/testdata/interval/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/db.go b/internal/endtoend/testdata/interval/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/interval/pgx/v5/go/models.go b/internal/endtoend/testdata/interval/pgx/v5/go/models.go new file mode 100644 index 0000000000..95996c8d15 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar bool + Interval pgtype.Interval +} diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..db86257899 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const get = `-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1 +` + +func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { + rows, err := q.db.Query(ctx, get, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Interval); 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/interval/pgx/v5/query.sql b/internal/endtoend/testdata/interval/pgx/v5/query.sql new file mode 100644 index 0000000000..27cd9d79ec --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/pgx/v5/schema.sql b/internal/endtoend/testdata/interval/pgx/v5/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/pgx/v5/sqlc.json b/internal/endtoend/testdata/interval/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/interval/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/interval/query.sql b/internal/endtoend/testdata/interval/query.sql deleted file mode 100644 index ce0d11b319..0000000000 --- a/internal/endtoend/testdata/interval/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null, "interval" interval not null); - --- name: Get :many -SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/sqlc.json b/internal/endtoend/testdata/interval/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/interval/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/interval/stdlib/exec.json b/internal/endtoend/testdata/interval/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/stdlib/go/db.go b/internal/endtoend/testdata/interval/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/interval/stdlib/go/models.go b/internal/endtoend/testdata/interval/stdlib/go/models.go new file mode 100644 index 0000000000..9fec5373e2 --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5576d7614f --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const get = `-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1 +` + +func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, get, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Interval); 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/interval/stdlib/query.sql b/internal/endtoend/testdata/interval/stdlib/query.sql new file mode 100644 index 0000000000..27cd9d79ec --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Get :many +SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/stdlib/schema.sql b/internal/endtoend/testdata/interval/stdlib/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/stdlib/sqlc.json b/internal/endtoend/testdata/interval/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql new file mode 100644 index 0000000000..e92c21d811 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..e92c21d811 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/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/invalid_func_args/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/query.sql b/internal/endtoend/testdata/invalid_func_args/query.sql deleted file mode 100644 index 02ff72d1f3..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/query.sql +++ /dev/null @@ -1,2 +0,0 @@ -SELECT random(1); -SELECT position(); diff --git a/internal/endtoend/testdata/invalid_func_args/sqlc.json b/internal/endtoend/testdata/invalid_func_args/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/invalid_func_args/stderr.txt b/internal/endtoend/testdata/invalid_func_args/stderr.txt deleted file mode 100644 index df8159d449..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -# package querytest -query.sql:1:8: function random(unknown) does not exist -query.sql:2:8: function position() 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 new file mode 100644 index 0000000000..e92c21d811 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/schema.sql b/internal/endtoend/testdata/invalid_func_args/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..b036fba240 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql @@ -0,0 +1,4 @@ +-- name: ListAuthors :many +SELECT * +FROM authors +GROUP BY invalid_reference; 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 new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/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/invalid_group_by_reference/mysql/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt new file mode 100644 index 0000000000..d686d4f4d8 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql new file mode 100644 index 0000000000..8275f8cfe1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql @@ -0,0 +1,4 @@ +-- name: ListAuthors :many +SELECT * +FROM authors +GROUP BY invalid_reference; \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/schema.sql b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/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/invalid_group_by_reference/postgresql/sqlc.json b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/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/invalid_group_by_reference/postgresql/stderr/base.txt b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/base.txt new file mode 100644 index 0000000000..d686d4f4d8 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..d13cdbaf62 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:22: column "invalid_reference" does not exist 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 new file mode 100644 index 0000000000..b036fba240 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: ListAuthors :many +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 new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt new file mode 100644 index 0000000000..d255c11c94 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: sqlite3: SQL logic error: no such column: invalid_reference diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md b/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md new file mode 100644 index 0000000000..70cc5f22a5 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/381 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 new file mode 100644 index 0000000000..9d485b5f16 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + + "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 +} + +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/invalid_insert_unknown_column/postgresql/pgx/db/models.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..d3515f1ede --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} 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 new file mode 100644 index 0000000000..2ce1040c41 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, missing_column +) VALUES ( + $1, $2, true +) +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) + return i, err +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql new file mode 100644 index 0000000000..db75df36e8 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, missing_column +) VALUES ( + $1, $2, true +) +RETURNING *; diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/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/invalid_insert_unknown_column/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..7b7c623e56 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, + "packages": [ + { + "path": "db", + "engine": "postgresql", + "database": { + "managed": true + }, + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..60421d56bd --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package db +query.sql:3:14: column "missing_column" of relation "authors" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/query.sql b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql new file mode 100644 index 0000000000..349d2c2ccb --- /dev/null +++ b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql @@ -0,0 +1,6 @@ +-- name: ListAuthors :one +SELECT * +FROM authors +WHERE id = sqlc.arg(my_named_param) + OR bio = sqlc.arg(my_named_param) +LIMIT 1; 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 new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/invalid_named_params/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/invalid_named_params/mysql/stderr.txt b/internal/endtoend/testdata/invalid_named_params/mysql/stderr.txt new file mode 100644 index 0000000000..9e45d80fbf --- /dev/null +++ b/internal/endtoend/testdata/invalid_named_params/mysql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +error generating code: named param MyNamedParam has incompatible types: sql.NullString, int64 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql new file mode 100644 index 0000000000..8a798cbb8c --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql @@ -0,0 +1,11 @@ +-- name: baz :one +SELECT foo FROM bar WHERE baz = $4; + +-- name: bar :one +SELECT foo FROM bar WHERE baz = $1 AND baz = $3; + +-- name: foo :one +SELECT foo FROM bar; + +-- name: Named :many +SELECT id FROM bar WHERE id = $1 AND sqlc.arg(named) = true AND id = $5; diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql new file mode 100644 index 0000000000..8a798cbb8c --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql @@ -0,0 +1,11 @@ +-- name: baz :one +SELECT foo FROM bar WHERE baz = $4; + +-- name: bar :one +SELECT foo FROM bar WHERE baz = $1 AND baz = $3; + +-- name: foo :one +SELECT foo FROM bar; + +-- name: Named :many +SELECT id FROM bar WHERE id = $1 AND sqlc.arg(named) = true AND id = $5; diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params/query.sql b/internal/endtoend/testdata/invalid_params/query.sql deleted file mode 100644 index e65eb9970d..0000000000 --- a/internal/endtoend/testdata/invalid_params/query.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: baz :one -SELECT foo FROM bar WHERE baz = $4; - --- name: bar -SELECT foo FROM bar WHERE baz = $1 AND baz = $3; - --- name: foo :one -SELECT foo FROM bar; - --- name: Named :many -SELECT id FROM bar WHERE id = $1 AND sqlc.arg(named) = true AND id = $5; diff --git a/internal/endtoend/testdata/invalid_params/sqlc.json b/internal/endtoend/testdata/invalid_params/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/invalid_params/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/invalid_params/stderr.txt b/internal/endtoend/testdata/invalid_params/stderr.txt deleted file mode 100644 index f338b8d756..0000000000 --- a/internal/endtoend/testdata/invalid_params/stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# package querytest -query.sql:4:1: could not determine data type of parameter $1 -query.sql:7:1: could not determine data type of parameter $2 -query.sql:10:8: column "foo" does not exist -query.sql:13:1: query mixes positional parameters ($1) and named parameters (sqlc.arg or @arg) diff --git a/internal/endtoend/testdata/invalid_params/stdlib/query.sql b/internal/endtoend/testdata/invalid_params/stdlib/query.sql new file mode 100644 index 0000000000..8a798cbb8c --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: baz :one +SELECT foo FROM bar WHERE baz = $4; + +-- name: bar :one +SELECT foo FROM bar WHERE baz = $1 AND baz = $3; + +-- name: foo :one +SELECT foo FROM bar; + +-- name: Named :many +SELECT id FROM bar WHERE id = $1 AND sqlc.arg(named) = true AND id = $5; diff --git a/internal/endtoend/testdata/invalid_params/stdlib/schema.sql b/internal/endtoend/testdata/invalid_params/stdlib/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md b/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md new file mode 100644 index 0000000000..93fc67215f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/297 diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql new file mode 100644 index 0000000000..c00d547905 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: UpdateAuthor :exec +UPDATE authors +SET name = $1 +WHERE id = $1; diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..e37a99f69f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name boolean NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..14bbe813d1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..459c2d432f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package db +query.sql:3:12: column "name" is of type boolean but expression is of type bigint diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql new file mode 100644 index 0000000000..19aaf34061 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: InsertBarBaz :exec +INSERT INTO foo (bar, baz) VALUES ($1); + +-- name: InsertBar :exec +INSERT INTO foo (bar) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql new file mode 100644 index 0000000000..ef02b5e99c --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: InsertBarBaz :exec +INSERT INTO foo (bar, baz) VALUES ($1); + +-- name: InsertBar :exec +INSERT INTO foo (bar) VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/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/invalid_queries_bar/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/query.sql b/internal/endtoend/testdata/invalid_queries_bar/query.sql deleted file mode 100644 index 49d9d60f1f..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/query.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE foo (bar text not null, baz text not null); -INSERT INTO foo (bar, baz) VALUES ($1); -INSERT INTO foo (bar) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/invalid_queries_bar/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/invalid_queries_bar/stderr.txt b/internal/endtoend/testdata/invalid_queries_bar/stderr.txt deleted file mode 100644 index a496038cd1..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -# package querytest -query.sql:2:1: INSERT has more target columns than expressions -query.sql:3:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql b/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql new file mode 100644 index 0000000000..ef02b5e99c --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: InsertBarBaz :exec +INSERT INTO foo (bar, baz) VALUES ($1); + +-- name: InsertBar :exec +INSERT INTO foo (bar) VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql new file mode 100644 index 0000000000..06644a2cd3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql @@ -0,0 +1,20 @@ +-- name: ListFoos +SELECT id FROM foo; + +-- name: ListFoos :one :many +SELECT id FROM foo; + +-- name: ListFoos :two +SELECT id FROM foo; + +-- name: DeleteFoo :one +DELETE FROM foo WHERE id = $1; + +-- name: UpdateFoo :one +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/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt new file mode 100644 index 0000000000..8c745b7e3b --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt @@ -0,0 +1,8 @@ +# package querytest +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 +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 new file mode 100644 index 0000000000..06644a2cd3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql @@ -0,0 +1,20 @@ +-- name: ListFoos +SELECT id FROM foo; + +-- name: ListFoos :one :many +SELECT id FROM foo; + +-- name: ListFoos :two +SELECT id FROM foo; + +-- name: DeleteFoo :one +DELETE FROM foo WHERE id = $1; + +-- name: UpdateFoo :one +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/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/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/invalid_queries_foo/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt new file mode 100644 index 0000000000..8c745b7e3b --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt @@ -0,0 +1,8 @@ +# package querytest +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 +query.sql:20:1: query "InsertFoo" specifies parameter ":batchone" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/query.sql b/internal/endtoend/testdata/invalid_queries_foo/query.sql deleted file mode 100644 index ef84ae740c..0000000000 --- a/internal/endtoend/testdata/invalid_queries_foo/query.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE foo (id text not null); - --- name: ListFoos -SELECT id FROM foo; - --- name: ListFoos :one :many -SELECT id FROM foo; - --- name: ListFoos :two -SELECT id FROM foo; - --- name: DeleteFoo :one -DELETE FROM foo WHERE id = $1; - --- name: UpdateFoo :one -UPDATE foo SET id = $2 WHERE id = $1; - --- name: InsertFoo :one -INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/invalid_queries_foo/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/invalid_queries_foo/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/stderr.txt deleted file mode 100644 index cbe1df4446..0000000000 --- a/internal/endtoend/testdata/invalid_queries_foo/stderr.txt +++ /dev/null @@ -1,7 +0,0 @@ -# package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many -query.sql:10:1: invalid query type: :two -query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:19:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql b/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql new file mode 100644 index 0000000000..0e98fb622d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql @@ -0,0 +1,17 @@ +-- name: ListFoos +SELECT id FROM foo; + +-- name: ListFoos :one :many +SELECT id FROM foo; + +-- name: ListFoos :two +SELECT id FROM foo; + +-- name: DeleteFoo :one +DELETE FROM foo WHERE id = $1; + +-- name: UpdateFoo :one +UPDATE foo SET id = $2 WHERE id = $1; + +-- name: InsertFoo :one +INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt new file mode 100644 index 0000000000..06ec54327f --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt @@ -0,0 +1,7 @@ +# package querytest +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 diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql new file mode 100644 index 0000000000..52f5aae051 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: GetAuthor :one +SELECT * +FROM authors a +WHERE p.id = ? +LIMIT 1; 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 new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/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/invalid_table_alias/mysql/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt new file mode 100644 index 0000000000..1eddeaac99 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +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/postgresql/query.sql b/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql new file mode 100644 index 0000000000..f09a94b585 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: GetAuthor :one +SELECT * +FROM authors a +WHERE p.id = $1 +LIMIT 1; diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql b/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql new file mode 100644 index 0000000000..9c4b796adb --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql @@ -0,0 +1,6 @@ +-- https://github.com/sqlc-dev/sqlc/issues/437 +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json b/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/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/invalid_table_alias/postgresql/stderr/base.txt b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/base.txt new file mode 100644 index 0000000000..1eddeaac99 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:9: table alias "p" does not exist diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..2de34ae434 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:3: missing FROM-clause entry for table "p" 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 new file mode 100644 index 0000000000..52f5aae051 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: GetAuthor :one +SELECT * +FROM authors 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 new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt new file mode 100644 index 0000000000..97e43851e0 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: sqlite3: SQL logic error: no such column: p.id diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/issue.md b/internal/endtoend/testdata/invalid_update_unknown_column/issue.md new file mode 100644 index 0000000000..822c605060 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/884 \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql new file mode 100644 index 0000000000..59d42df34b --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: UpdateArticles :exec +UPDATE + public.articles +SET + is_deleted = TRUE +WHERE + id = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6f94b60c66 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE public.articles ( + id integer NOT NULL, + company integer NOT NULL, + name text NOT NULL, + sort_order integer DEFAULT 0 NOT NULL, + object_type smallint NOT NULL, + image text, + "group" integer, + notes text DEFAULT ''::text NOT NULL +); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/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" \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..8260c8f792 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:2: column "is_deleted" of relation "articles" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/ipaddr/go/db.go b/internal/endtoend/testdata/ipaddr/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/ipaddr/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/ipaddr/go/models.go b/internal/endtoend/testdata/ipaddr/go/models.go deleted file mode 100644 index c9b78920d4..0000000000 --- a/internal/endtoend/testdata/ipaddr/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "net" -) - -type Foo struct { - Bar bool - Inet net.IP - Cidr net.IP -} diff --git a/internal/endtoend/testdata/ipaddr/go/query.sql.go b/internal/endtoend/testdata/ipaddr/go/query.sql.go deleted file mode 100644 index 1bdc311a36..0000000000 --- a/internal/endtoend/testdata/ipaddr/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const get = `-- name: Get :many -SELECT bar, "inet", "cidr" FROM foo LIMIT $1 -` - -func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, get, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.Bar, &i.Inet, &i.Cidr); 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/ipaddr/query.sql b/internal/endtoend/testdata/ipaddr/query.sql deleted file mode 100644 index 11b6b5c820..0000000000 --- a/internal/endtoend/testdata/ipaddr/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null, "inet" inet not null, "cidr" cidr not null); - --- name: Get :many -SELECT bar, "inet", "cidr" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/ipaddr/sqlc.json b/internal/endtoend/testdata/ipaddr/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/ipaddr/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/join_alias/mysql/go/db.go b/internal/endtoend/testdata/join_alias/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/db.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/mysql/go/models.go b/internal/endtoend/testdata/join_alias/mysql/go/models.go index 70b32e79cd..4dae8de5db 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/models.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest @@ -7,10 +9,10 @@ import ( ) type Bar struct { - ID int64 + ID uint64 Title sql.NullString } type Foo struct { - ID int64 + ID uint64 } 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 0a23bbea3d..932153ec78 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -16,12 +18,12 @@ WHERE f.id = ? ` type AliasExpandRow struct { - ID int64 - ID_2 int64 + ID uint64 + ID_2 uint64 Title sql.NullString } -func (q *Queries) AliasExpand(ctx context.Context, id int64) ([]AliasExpandRow, error) { +func (q *Queries) AliasExpand(ctx context.Context, id uint64) ([]AliasExpandRow, error) { rows, err := q.db.QueryContext(ctx, aliasExpand, id) if err != nil { return nil, err @@ -52,11 +54,11 @@ WHERE f.id = ? ` type AliasJoinRow struct { - ID int64 + ID uint64 Title sql.NullString } -func (q *Queries) AliasJoin(ctx context.Context, id int64) ([]AliasJoinRow, error) { +func (q *Queries) AliasJoin(ctx context.Context, id uint64) ([]AliasJoinRow, error) { rows, err := q.db.QueryContext(ctx, aliasJoin, id) if err != nil { return nil, err diff --git a/internal/endtoend/testdata/join_alias/mysql/query.sql b/internal/endtoend/testdata/join_alias/mysql/query.sql index 32aa93eb77..9b087bcae7 100644 --- a/internal/endtoend/testdata/join_alias/mysql/query.sql +++ b/internal/endtoend/testdata/join_alias/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null); -CREATE TABLE bar (id serial not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/mysql/schema.sql b/internal/endtoend/testdata/join_alias/mysql/schema.sql new file mode 100644 index 0000000000..1eab1cf5f4 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/mysql/sqlc.json b/internal/endtoend/testdata/join_alias/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_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/join_alias/postgresql/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/join_alias/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/join_alias/postgresql/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/go/models.go deleted file mode 100644 index 072d9099f4..0000000000 --- a/internal/endtoend/testdata/join_alias/postgresql/go/models.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - ID int32 - Title sql.NullString -} - -type Foo struct { - ID int32 -} diff --git a/internal/endtoend/testdata/join_alias/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/go/query.sql.go deleted file mode 100644 index 0d8a76d09b..0000000000 --- a/internal/endtoend/testdata/join_alias/postgresql/go/query.sql.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const aliasExpand = `-- name: AliasExpand :many -SELECT f.id, b.id, title -FROM foo f -JOIN bar b ON b.id = f.id -WHERE f.id = $1 -` - -type AliasExpandRow struct { - ID int32 - ID_2 int32 - Title sql.NullString -} - -func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { - rows, err := q.db.QueryContext(ctx, aliasExpand, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []AliasExpandRow - for rows.Next() { - var i AliasExpandRow - if err := rows.Scan(&i.ID, &i.ID_2, &i.Title); 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 aliasJoin = `-- name: AliasJoin :many -SELECT f.id, b.title -FROM foo f -JOIN bar b ON b.id = f.id -WHERE f.id = $1 -` - -type AliasJoinRow struct { - ID int32 - Title sql.NullString -} - -func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { - rows, err := q.db.QueryContext(ctx, aliasJoin, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []AliasJoinRow - for rows.Next() { - var i AliasJoinRow - if err := rows.Scan(&i.ID, &i.Title); 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/join_alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..3ae25caf06 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Title sql.NullString +} + +type Foo struct { + ID int32 +} 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 new file mode 100644 index 0000000000..13a5ad6ceb --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const aliasExpand = `-- name: AliasExpand :many +SELECT f.id, b.id, title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasExpandRow struct { + ID int32 + ID_2 int32 + Title sql.NullString +} + +func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { + rows, err := q.db.Query(ctx, aliasExpand, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasExpandRow + for rows.Next() { + var i AliasExpandRow + if err := rows.Scan(&i.ID, &i.ID_2, &i.Title); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const aliasJoin = `-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasJoinRow struct { + ID int32 + Title sql.NullString +} + +func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { + rows, err := q.db.Query(ctx, aliasJoin, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasJoinRow + for rows.Next() { + var i AliasJoinRow + if err := rows.Scan(&i.ID, &i.Title); 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_alias/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..23f38254b4 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql @@ -0,0 +1,11 @@ +-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; + +-- name: AliasExpand :many +SELECT * +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..69068f3a7f --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 + Title pgtype.Text +} + +type Foo struct { + ID int32 +} 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 new file mode 100644 index 0000000000..5761c7cd02 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,77 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const aliasExpand = `-- name: AliasExpand :many +SELECT f.id, b.id, title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasExpandRow struct { + ID int32 + ID_2 int32 + Title pgtype.Text +} + +func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { + rows, err := q.db.Query(ctx, aliasExpand, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasExpandRow + for rows.Next() { + var i AliasExpandRow + if err := rows.Scan(&i.ID, &i.ID_2, &i.Title); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const aliasJoin = `-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasJoinRow struct { + ID int32 + Title pgtype.Text +} + +func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { + rows, err := q.db.Query(ctx, aliasJoin, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasJoinRow + for rows.Next() { + var i AliasJoinRow + if err := rows.Scan(&i.ID, &i.Title); 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_alias/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..23f38254b4 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql @@ -0,0 +1,11 @@ +-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; + +-- name: AliasExpand :many +SELECT * +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/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/join_alias/postgresql/query.sql b/internal/endtoend/testdata/join_alias/postgresql/query.sql deleted file mode 100644 index 69785fa1fd..0000000000 --- a/internal/endtoend/testdata/join_alias/postgresql/query.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE foo (id serial not null); -CREATE TABLE bar (id serial not null references foo(id), title text); - --- name: AliasJoin :many -SELECT f.id, b.title -FROM foo f -JOIN bar b ON b.id = f.id -WHERE f.id = $1; - --- name: AliasExpand :many -SELECT * -FROM foo f -JOIN bar b ON b.id = f.id -WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_alias/postgresql/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/join_alias/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..3ae25caf06 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Title sql.NullString +} + +type Foo struct { + ID int32 +} 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 new file mode 100644 index 0000000000..c304c38c04 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const aliasExpand = `-- name: AliasExpand :many +SELECT f.id, b.id, title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasExpandRow struct { + ID int32 + ID_2 int32 + Title sql.NullString +} + +func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { + rows, err := q.db.QueryContext(ctx, aliasExpand, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasExpandRow + for rows.Next() { + var i AliasExpandRow + if err := rows.Scan(&i.ID, &i.ID_2, &i.Title); 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 aliasJoin = `-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1 +` + +type AliasJoinRow struct { + ID int32 + Title sql.NullString +} + +func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { + rows, err := q.db.QueryContext(ctx, aliasJoin, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasJoinRow + for rows.Next() { + var i AliasJoinRow + if err := rows.Scan(&i.ID, &i.Title); 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/join_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..23f38254b4 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; + +-- name: AliasExpand :many +SELECT * +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/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/join_alias/sqlite/go/db.go b/internal/endtoend/testdata/join_alias/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_alias/sqlite/go/models.go b/internal/endtoend/testdata/join_alias/sqlite/go/models.go new file mode 100644 index 0000000000..5a3a4a1b05 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int64 + Title sql.NullString +} + +type Foo struct { + ID int64 +} diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go new file mode 100644 index 0000000000..8ac1da98d8 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const aliasExpand = `-- name: AliasExpand :many +SELECT f.id, b.id, title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = ? +` + +type AliasExpandRow struct { + ID int64 + ID_2 int64 + Title sql.NullString +} + +func (q *Queries) AliasExpand(ctx context.Context, id int64) ([]AliasExpandRow, error) { + rows, err := q.db.QueryContext(ctx, aliasExpand, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasExpandRow + for rows.Next() { + var i AliasExpandRow + if err := rows.Scan(&i.ID, &i.ID_2, &i.Title); 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 aliasJoin = `-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = ? +` + +type AliasJoinRow struct { + ID int64 + Title sql.NullString +} + +func (q *Queries) AliasJoin(ctx context.Context, id int64) ([]AliasJoinRow, error) { + rows, err := q.db.QueryContext(ctx, aliasJoin, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AliasJoinRow + for rows.Next() { + var i AliasJoinRow + if err := rows.Scan(&i.ID, &i.Title); 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/join_alias/sqlite/query.sql b/internal/endtoend/testdata/join_alias/sqlite/query.sql new file mode 100644 index 0000000000..9b087bcae7 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/query.sql @@ -0,0 +1,11 @@ +-- name: AliasJoin :many +SELECT f.id, b.title +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = ?; + +-- name: AliasExpand :many +SELECT * +FROM foo f +JOIN bar b ON b.id = f.id +WHERE f.id = ?; diff --git a/internal/endtoend/testdata/join_alias/sqlite/schema.sql b/internal/endtoend/testdata/join_alias/sqlite/schema.sql new file mode 100644 index 0000000000..b622f98fcb --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id integer not null); +CREATE TABLE bar (id integer not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/sqlite/sqlc.json b/internal/endtoend/testdata/join_alias/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_clauses_order/postgresql/go/models.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go new file mode 100644 index 0000000000..f069a6fbed --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type A struct { + ID int64 + A string +} + +type B struct { + ID int64 + B string + AID int64 +} + +type C struct { + ID int64 + C string + AID int64 +} + +type D struct { + ID int64 + D string + AID int64 +} + +type E struct { + ID int64 + E string + AID int64 +} 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 new file mode 100644 index 0000000000..ee33f2706a --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go @@ -0,0 +1,175 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const testInnerLeft = `-- name: TestInnerLeft :many +SELECT a.a, b.b, c.c +FROM a +INNER JOIN b ON b.a_id = a.id +LEFT JOIN c ON c.a_id = a.id +` + +type TestInnerLeftRow struct { + A string + B string + C sql.NullString +} + +func (q *Queries) TestInnerLeft(ctx context.Context) ([]TestInnerLeftRow, error) { + rows, err := q.db.QueryContext(ctx, testInnerLeft) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestInnerLeftRow + for rows.Next() { + var i TestInnerLeftRow + if err := rows.Scan(&i.A, &i.B, &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 testInnerLeftInnerLeft = `-- name: TestInnerLeftInnerLeft :many +SELECT a.a, b.b, c.c, d.d, e.e +FROM a +INNER JOIN b ON b.a_id = a.id +LEFT JOIN c ON c.a_id = a.id +INNER JOIN d ON d.a_id = a.id +LEFT JOIN e ON e.a_id = a.id +` + +type TestInnerLeftInnerLeftRow struct { + A string + B string + C sql.NullString + D string + E sql.NullString +} + +func (q *Queries) TestInnerLeftInnerLeft(ctx context.Context) ([]TestInnerLeftInnerLeftRow, error) { + rows, err := q.db.QueryContext(ctx, testInnerLeftInnerLeft) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestInnerLeftInnerLeftRow + for rows.Next() { + var i TestInnerLeftInnerLeftRow + if err := rows.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + &i.E, + ); 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 testLeftInner = `-- name: TestLeftInner :many +SELECT a.a, b.b, c.c +FROM a +LEFT JOIN b ON b.a_id = a.id +INNER JOIN c ON c.a_id = a.id +` + +type TestLeftInnerRow struct { + A string + B sql.NullString + C string +} + +func (q *Queries) TestLeftInner(ctx context.Context) ([]TestLeftInnerRow, error) { + rows, err := q.db.QueryContext(ctx, testLeftInner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestLeftInnerRow + for rows.Next() { + var i TestLeftInnerRow + if err := rows.Scan(&i.A, &i.B, &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 testLeftInnerLeftInner = `-- name: TestLeftInnerLeftInner :many +SELECT a.a, b.b, c.c, d.d, e.e +FROM a +LEFT JOIN b ON b.a_id = a.id +INNER JOIN c ON c.a_id = a.id +LEFT JOIN d ON d.a_id = a.id +INNER JOIN e ON e.a_id = a.id +` + +type TestLeftInnerLeftInnerRow struct { + A string + B sql.NullString + C string + D sql.NullString + E string +} + +func (q *Queries) TestLeftInnerLeftInner(ctx context.Context) ([]TestLeftInnerLeftInnerRow, error) { + rows, err := q.db.QueryContext(ctx, testLeftInnerLeftInner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestLeftInnerLeftInnerRow + for rows.Next() { + var i TestLeftInnerLeftInnerRow + if err := rows.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + &i.E, + ); 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/join_clauses_order/postgresql/query.sql b/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql new file mode 100644 index 0000000000..3980181178 --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql @@ -0,0 +1,27 @@ +-- name: TestLeftInner :many +SELECT a.a, b.b, c.c +FROM a +LEFT JOIN b ON b.a_id = a.id +INNER JOIN c ON c.a_id = a.id; + +-- name: TestInnerLeft :many +SELECT a.a, b.b, c.c +FROM a +INNER JOIN b ON b.a_id = a.id +LEFT JOIN c ON c.a_id = a.id; + +-- name: TestLeftInnerLeftInner :many +SELECT a.a, b.b, c.c, d.d, e.e +FROM a +LEFT JOIN b ON b.a_id = a.id +INNER JOIN c ON c.a_id = a.id +LEFT JOIN d ON d.a_id = a.id +INNER JOIN e ON e.a_id = a.id; + +-- name: TestInnerLeftInnerLeft :many +SELECT a.a, b.b, c.c, d.d, e.e +FROM a +INNER JOIN b ON b.a_id = a.id +LEFT JOIN c ON c.a_id = a.id +INNER JOIN d ON d.a_id = a.id +LEFT JOIN e ON e.a_id = a.id; diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql b/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql new file mode 100644 index 0000000000..890f94fc6f --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql @@ -0,0 +1,29 @@ +CREATE TABLE a ( + id BIGSERIAL PRIMARY KEY, + a TEXT NOT NULL +); + +CREATE TABLE b ( + id BIGSERIAL PRIMARY KEY, + b TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE c ( + id BIGSERIAL PRIMARY KEY, + c TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE d ( + id BIGSERIAL PRIMARY KEY, + d TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE e ( + id BIGSERIAL PRIMARY KEY, + e TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json b/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/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/join_from/mysql/go/db.go b/internal/endtoend/testdata/join_from/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/db.go +++ b/internal/endtoend/testdata/join_from/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/mysql/go/models.go b/internal/endtoend/testdata/join_from/mysql/go/models.go index c71c6a9097..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/models.go +++ b/internal/endtoend/testdata/join_from/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 92b7b86b54..67c067f458 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/mysql/query.sql b/internal/endtoend/testdata/join_from/mysql/query.sql index 588d859578..377aeaebab 100644 --- a/internal/endtoend/testdata/join_from/mysql/query.sql +++ b/internal/endtoend/testdata/join_from/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = ?; diff --git a/internal/endtoend/testdata/join_from/mysql/schema.sql b/internal/endtoend/testdata/join_from/mysql/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/mysql/sqlc.json b/internal/endtoend/testdata/join_from/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_from/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_from/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/join_from/postgresql/go/db.go b/internal/endtoend/testdata/join_from/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/join_from/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/join_from/postgresql/go/models.go b/internal/endtoend/testdata/join_from/postgresql/go/models.go deleted file mode 100644 index c71c6a9097..0000000000 --- a/internal/endtoend/testdata/join_from/postgresql/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - Login string -} - -type Foo struct { - Email string -} diff --git a/internal/endtoend/testdata/join_from/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/go/query.sql.go deleted file mode 100644 index 3fe6b069c9..0000000000 --- a/internal/endtoend/testdata/join_from/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const multiFrom = `-- name: MultiFrom :many -SELECT email FROM bar, foo WHERE login = $1 -` - -func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, multiFrom, login) - 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/join_from/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..024b8245df --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Login string +} + +type Foo struct { + Email 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 new file mode 100644 index 0000000000..c30f5d428d --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const multiFrom = `-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1 +` + +func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { + rows, err := q.db.Query(ctx, multiFrom, login) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c4eec21958 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..024b8245df --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Login string +} + +type Foo struct { + Email 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 new file mode 100644 index 0000000000..c30f5d428d --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const multiFrom = `-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1 +` + +func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { + rows, err := q.db.Query(ctx, multiFrom, login) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c4eec21958 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/join_from/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/join_from/postgresql/query.sql b/internal/endtoend/testdata/join_from/postgresql/query.sql deleted file mode 100644 index a8cefc9245..0000000000 --- a/internal/endtoend/testdata/join_from/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - --- name: MultiFrom :many -SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/join_from/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..024b8245df --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Login string +} + +type Foo struct { + Email 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 new file mode 100644 index 0000000000..ff1c5fd82d --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const multiFrom = `-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1 +` + +func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, multiFrom, login) + 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/join_from/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c4eec21958 --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_from/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/join_from/sqlite/go/db.go b/internal/endtoend/testdata/join_from/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_from/sqlite/go/models.go b/internal/endtoend/testdata/join_from/sqlite/go/models.go new file mode 100644 index 0000000000..024b8245df --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + Login string +} + +type Foo struct { + Email 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 new file mode 100644 index 0000000000..67c067f458 --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const multiFrom = `-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = ? +` + +func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, multiFrom, login) + 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/join_from/sqlite/query.sql b/internal/endtoend/testdata/join_from/sqlite/query.sql new file mode 100644 index 0000000000..377aeaebab --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: MultiFrom :many +SELECT email FROM bar, foo WHERE login = ?; diff --git a/internal/endtoend/testdata/join_from/sqlite/schema.sql b/internal/endtoend/testdata/join_from/sqlite/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/sqlite/sqlc.json b/internal/endtoend/testdata/join_from/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/join_full/postgresql/go/db.go b/internal/endtoend/testdata/join_full/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_full/postgresql/go/models.go b/internal/endtoend/testdata/join_full/postgresql/go/models.go new file mode 100644 index 0000000000..7453c9d172 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + BarID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go new file mode 100644 index 0000000000..3e92e19ac6 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fullJoin = `-- name: FullJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +FULL OUTER JOIN bar b ON b.id = f.bar_id +WHERE f.id = $1 +` + +type FullJoinRow struct { + ID sql.NullInt32 + BarID sql.NullInt32 + ID_2 sql.NullInt32 +} + +func (q *Queries) FullJoin(ctx context.Context, id int32) ([]FullJoinRow, error) { + rows, err := q.db.QueryContext(ctx, fullJoin, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FullJoinRow + for rows.Next() { + var i FullJoinRow + if err := rows.Scan(&i.ID, &i.BarID, &i.ID_2); 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/join_full/postgresql/query.sql b/internal/endtoend/testdata/join_full/postgresql/query.sql new file mode 100644 index 0000000000..d5ddf2b01d --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: FullJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +FULL OUTER JOIN bar b ON b.id = f.bar_id +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_full/postgresql/schema.sql b/internal/endtoend/testdata/join_full/postgresql/schema.sql new file mode 100644 index 0000000000..c7d2a76585 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null unique); +CREATE TABLE foo (id serial not null, bar_id int references bar(id)); + diff --git a/internal/endtoend/testdata/join_full/postgresql/sqlc.json b/internal/endtoend/testdata/join_full/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/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/join_group_by_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_group_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ae9173ef9e --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..aceacc4058 --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const columnAsGroupBy = `-- name: ColumnAsGroupBy :many +SELECT a.email AS id +FROM foo a JOIN foo b ON a.email = b.email +GROUP BY id +` + +func (q *Queries) ColumnAsGroupBy(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, columnAsGroupBy) + 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/join_group_by_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3d04553e16 --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: ColumnAsGroupBy :many +SELECT a.email AS id +FROM foo a JOIN foo b ON a.email = b.email +GROUP BY id; diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..da8ec19c5d --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (email text not null); + diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/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/join_inner/postgresql/go/db.go b/internal/endtoend/testdata/join_inner/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_inner/postgresql/go/models.go b/internal/endtoend/testdata/join_inner/postgresql/go/models.go new file mode 100644 index 0000000000..2d9d727572 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Event struct { + ID sql.NullInt32 +} + +type HandledEvent struct { + LastHandledID sql.NullInt32 + Handler sql.NullString +} diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go new file mode 100644 index 0000000000..6f5396e796 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go @@ -0,0 +1,73 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const selectAllJoined = `-- name: SelectAllJoined :many +select events.id from events + inner join handled_events + on events.ID > handled_events.last_handled_id +where handled_events.handler = $1 + for update of handled_events skip locked +` + +func (q *Queries) SelectAllJoined(ctx context.Context, handler sql.NullString) ([]sql.NullInt32, error) { + rows, err := q.db.QueryContext(ctx, selectAllJoined, handler) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullInt32 + for rows.Next() { + var id sql.NullInt32 + 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 selectAllJoinedAlias = `-- name: SelectAllJoinedAlias :many +select e.id from events e + inner join handled_events he + on e.ID > he.last_handled_id +where he.handler = $1 + for update of he skip locked +` + +func (q *Queries) SelectAllJoinedAlias(ctx context.Context, handler sql.NullString) ([]sql.NullInt32, error) { + rows, err := q.db.QueryContext(ctx, selectAllJoinedAlias, handler) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullInt32 + for rows.Next() { + var id sql.NullInt32 + 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/join_inner/postgresql/query.sql b/internal/endtoend/testdata/join_inner/postgresql/query.sql new file mode 100644 index 0000000000..dbea737cb8 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/query.sql @@ -0,0 +1,13 @@ +-- name: SelectAllJoinedAlias :many +select e.* from events e + inner join handled_events he + on e.ID > he.last_handled_id +where he.handler = $1 + for update of he skip locked; + +-- name: SelectAllJoined :many +select events.* from events + inner join handled_events + on events.ID > handled_events.last_handled_id +where handled_events.handler = $1 + for update of handled_events skip locked; diff --git a/internal/endtoend/testdata/join_inner/postgresql/schema.sql b/internal/endtoend/testdata/join_inner/postgresql/schema.sql new file mode 100644 index 0000000000..5283e3a992 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/schema.sql @@ -0,0 +1,12 @@ +create table events +( + ID int +); + +create table handled_events +( + last_handled_id int, + handler text +); + + diff --git a/internal/endtoend/testdata/join_inner/postgresql/sqlc.json b/internal/endtoend/testdata/join_inner/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/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/join_left/mysql/go/db.go b/internal/endtoend/testdata/join_left/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left/mysql/go/models.go b/internal/endtoend/testdata/join_left/mysql/go/models.go new file mode 100644 index 0000000000..3b3296b874 --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/go/models.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int32 + Name string + ParentID sql.NullInt32 +} + +type City struct { + CityID int32 + MayorID int32 +} + +type Mayor struct { + MayorID int32 + FullName string +} + +type Medium struct { + MediaID int32 + MediaCreatedAt time.Time + MediaHash string + MediaDirectory string + MediaAuthorID int32 + MediaWidth int32 + MediaHeight int32 +} + +type SuperAuthor struct { + SuperID int32 + SuperName string + SuperParentID sql.NullInt32 +} + +type User struct { + UserID int32 + CityID sql.NullInt32 +} + +type Users2 struct { + UserID int32 + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go new file mode 100644 index 0000000000..1fdd44a0bd --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go @@ -0,0 +1,433 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const allAuthors = `-- name: AllAuthors :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 allAuthorsAliases = `-- name: AllAuthorsAliases :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsAliasesRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliasesRow + for rows.Next() { + var i AllAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsAliases2Row struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliases2Row + for rows.Next() { + var i AllAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 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 +` + +type AllSuperAuthorsRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsRow + for rows.Next() { + var i AllSuperAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many +SELECT id, name, parent_id, super_id, super_name, super_parent_id +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id +` + +type AllSuperAuthorsAliasesRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliasesRow + for rows.Next() { + var i AllSuperAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many +SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id +` + +type AllSuperAuthorsAliases2Row struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliases2Row + for rows.Next() { + var i AllSuperAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 getMayors = `-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id) +` + +type GetMayorsRow struct { + UserID int32 + FullName string +} + +func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { + rows, err := q.db.QueryContext(ctx, getMayors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsRow + for rows.Next() { + var i GetMayorsRow + if err := rows.Scan(&i.UserID, &i.FullName); 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 getMayorsOptional = `-- name: GetMayorsOptional :many +SELECT + user_id, + cities.city_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +LEFT JOIN mayors USING (mayor_id) +` + +type GetMayorsOptionalRow struct { + UserID int32 + CityID sql.NullInt32 + FullName sql.NullString +} + +func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { + rows, err := q.db.QueryContext(ctx, getMayorsOptional) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsOptionalRow + for rows.Next() { + var i GetMayorsOptionalRow + if err := rows.Scan(&i.UserID, &i.CityID, &i.FullName); 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 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 u + LEFT JOIN media m + ON u.user_avatar_id = m.media_id +WHERE u.user_id != @user_id +` + +type GetSuggestedUsersByIDRow struct { + UserID int32 + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID sql.NullInt32 + MediaID sql.NullInt32 + MediaCreatedAt sql.NullTime + MediaHash sql.NullString + MediaDirectory sql.NullString + MediaAuthorID sql.NullInt32 + MediaWidth sql.NullInt32 + MediaHeight sql.NullInt32 +} + +func (q *Queries) GetSuggestedUsersByID(ctx context.Context) ([]GetSuggestedUsersByIDRow, error) { + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetSuggestedUsersByIDRow + for rows.Next() { + var i GetSuggestedUsersByIDRow + if err := rows.Scan( + &i.UserID, + &i.UserNickname, + &i.UserEmail, + &i.UserDisplayName, + &i.UserPassword, + &i.UserGoogleID, + &i.UserAppleID, + &i.UserBio, + &i.UserCreatedAt, + &i.UserAvatarID, + &i.MediaID, + &i.MediaCreatedAt, + &i.MediaHash, + &i.MediaDirectory, + &i.MediaAuthorID, + &i.MediaWidth, + &i.MediaHeight, + ); 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/join_left/mysql/query.sql b/internal/endtoend/testdata/join_left/mysql/query.sql new file mode 100644 index 0000000000..ff96bb9cc9 --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/query.sql @@ -0,0 +1,59 @@ +-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id); + +-- name: GetMayorsOptional :many +SELECT + 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 a + LEFT JOIN authors p + ON a.parent_id = p.id; + +-- name: AllAuthorsAliases :many +SELECT * +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id; + +-- name: AllAuthorsAliases2 :many +SELECT a.*, p.* +FROM authors a + LEFT JOIN authors 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; + +-- name: AllSuperAuthorsAliases :many +SELECT * +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id; + +-- name: AllSuperAuthorsAliases2 :many +SELECT a.*, sa.* +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id; + +-- name: GetSuggestedUsersByID :many +SELECT DISTINCT u.*, m.* +FROM users_2 u + LEFT JOIN media m + ON u.user_avatar_id = m.media_id +WHERE u.user_id != @user_id; diff --git a/internal/endtoend/testdata/join_left/mysql/schema.sql b/internal/endtoend/testdata/join_left/mysql/schema.sql new file mode 100644 index 0000000000..9b15eaea36 --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/schema.sql @@ -0,0 +1,55 @@ +-- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE users_2 ( + user_id INT PRIMARY KEY, + user_nickname VARCHAR(30) UNIQUE NOT NULL, + user_email VARCHAR(20) UNIQUE NOT NULL, + user_display_name TEXT NOT NULL, + user_password TEXT 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 +); + +CREATE TABLE media ( + media_id INT PRIMARY KEY, + media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + media_hash TEXT NOT NULL, + media_directory TEXT NOT NULL, + media_author_id INT NOT NULL, + media_width INT NOT NULL, + media_height INT NOT NULL +); + +ALTER TABLE users_2 +ADD FOREIGN KEY (user_avatar_id) +REFERENCES media(media_id) +ON DELETE SET DEFAULT +ON UPDATE CASCADE; diff --git a/internal/endtoend/testdata/join_left/mysql/sqlc.json b/internal/endtoend/testdata/join_left/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/join_left/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/join_left/postgresql/exec.json b/internal/endtoend/testdata/join_left/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/join_left/postgresql/go/db.go b/internal/endtoend/testdata/join_left/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left/postgresql/go/models.go b/internal/endtoend/testdata/join_left/postgresql/go/models.go new file mode 100644 index 0000000000..37edc6151f --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/go/models.go @@ -0,0 +1,62 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" + + "github.com/google/uuid" +) + +type Author struct { + ID int32 + Name string + ParentID sql.NullInt32 +} + +type City struct { + CityID int32 + MayorID int32 +} + +type Mayor struct { + MayorID int32 + FullName string +} + +type Medium struct { + MediaID uuid.UUID + MediaCreatedAt time.Time + MediaHash string + MediaDirectory string + MediaAuthorID uuid.UUID + MediaWidth int32 + MediaHeight int32 +} + +type SuperAuthor struct { + SuperID int32 + SuperName string + SuperParentID sql.NullInt32 +} + +type User struct { + UserID int32 + CityID sql.NullInt32 +} + +type Users2 struct { + UserID uuid.UUID + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID uuid.NullUUID +} diff --git a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go new file mode 100644 index 0000000000..5be30a8b98 --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go @@ -0,0 +1,439 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" + + "github.com/google/uuid" +) + +const allAuthors = `-- name: AllAuthors :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 allAuthorsAliases = `-- name: AllAuthorsAliases :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsAliasesRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliasesRow + for rows.Next() { + var i AllAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id +` + +type AllAuthorsAliases2Row struct { + ID int32 + Name string + ParentID sql.NullInt32 + ID_2 sql.NullInt32 + Name_2 sql.NullString + ParentID_2 sql.NullInt32 +} + +func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliases2Row + for rows.Next() { + var i AllAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 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 +` + +type AllSuperAuthorsRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsRow + for rows.Next() { + var i AllSuperAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many +SELECT id, name, parent_id, super_id, super_name, super_parent_id +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id +` + +type AllSuperAuthorsAliasesRow struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliasesRow + for rows.Next() { + var i AllSuperAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many +SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id +` + +type AllSuperAuthorsAliases2Row struct { + ID int32 + Name string + ParentID sql.NullInt32 + SuperID sql.NullInt32 + SuperName sql.NullString + SuperParentID sql.NullInt32 +} + +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliases2Row + for rows.Next() { + var i AllSuperAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 getMayors = `-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id) +` + +type GetMayorsRow struct { + UserID int32 + FullName string +} + +func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { + rows, err := q.db.QueryContext(ctx, getMayors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsRow + for rows.Next() { + var i GetMayorsRow + if err := rows.Scan(&i.UserID, &i.FullName); 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 getMayorsOptional = `-- name: GetMayorsOptional :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +LEFT JOIN mayors USING (mayor_id) +` + +type GetMayorsOptionalRow struct { + UserID int32 + FullName sql.NullString +} + +func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { + rows, err := q.db.QueryContext(ctx, getMayorsOptional) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsOptionalRow + for rows.Next() { + var i GetMayorsOptionalRow + if err := rows.Scan(&i.UserID, &i.FullName); 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 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 u + LEFT JOIN media m + ON u.user_avatar_id = m.media_id +WHERE u.user_id != $1 +LIMIT $2 +` + +type GetSuggestedUsersByIDParams struct { + UserID uuid.UUID + UserImit int32 +} + +type GetSuggestedUsersByIDRow struct { + UserID uuid.UUID + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID uuid.NullUUID + MediaID uuid.NullUUID + MediaCreatedAt sql.NullTime + MediaHash sql.NullString + MediaDirectory sql.NullString + MediaAuthorID uuid.NullUUID + MediaWidth sql.NullInt32 + MediaHeight sql.NullInt32 +} + +func (q *Queries) GetSuggestedUsersByID(ctx context.Context, arg GetSuggestedUsersByIDParams) ([]GetSuggestedUsersByIDRow, error) { + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID, arg.UserID, arg.UserImit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetSuggestedUsersByIDRow + for rows.Next() { + var i GetSuggestedUsersByIDRow + if err := rows.Scan( + &i.UserID, + &i.UserNickname, + &i.UserEmail, + &i.UserDisplayName, + &i.UserPassword, + &i.UserGoogleID, + &i.UserAppleID, + &i.UserBio, + &i.UserCreatedAt, + &i.UserAvatarID, + &i.MediaID, + &i.MediaCreatedAt, + &i.MediaHash, + &i.MediaDirectory, + &i.MediaAuthorID, + &i.MediaWidth, + &i.MediaHeight, + ); 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/join_left/postgresql/query.sql b/internal/endtoend/testdata/join_left/postgresql/query.sql new file mode 100644 index 0000000000..15e3d6e580 --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/query.sql @@ -0,0 +1,59 @@ +-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id); + +-- name: GetMayorsOptional :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +LEFT JOIN mayors USING (mayor_id); + +-- name: AllAuthors :many +SELECT * +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id; + +-- name: AllAuthorsAliases :many +SELECT * +FROM authors a + LEFT JOIN authors p + ON a.parent_id = p.id; + +-- name: AllAuthorsAliases2 :many +SELECT a.*, p.* +FROM authors a + LEFT JOIN authors 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; + +-- name: AllSuperAuthorsAliases :many +SELECT * +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id; + +-- name: AllSuperAuthorsAliases2 :many +SELECT a.*, sa.* +FROM authors a + LEFT JOIN super_authors sa + ON a.parent_id = sa.super_id; + +-- name: GetSuggestedUsersByID :many +SELECT DISTINCT u.*, m.* +FROM users_2 u + LEFT JOIN media m + ON u.user_avatar_id = m.media_id +WHERE u.user_id != @user_id +LIMIT @user_imit; diff --git a/internal/endtoend/testdata/join_left/postgresql/schema.sql b/internal/endtoend/testdata/join_left/postgresql/schema.sql new file mode 100644 index 0000000000..3cb9197a9c --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/schema.sql @@ -0,0 +1,53 @@ +--- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE "users_2" ( + "user_id" uuid PRIMARY KEY, + "user_nickname" VARCHAR(30) UNIQUE NOT NULL, + "user_email" TEXT 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_bio" VARCHAR(160) NOT NULL DEFAULT '', + "user_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), + "user_avatar_id" uuid UNIQUE NULL +); + +CREATE TABLE "media" ( + "media_id" uuid PRIMARY KEY, + "media_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), + "media_hash" TEXT NOT NULL, + "media_directory" TEXT NOT NULL, + "media_author_id" uuid NOT NULL, + "media_width" INT NOT NULL, + "media_height" INT NOT NULL +); + +ALTER TABLE "users_2" + ADD FOREIGN KEY ("user_avatar_id") REFERENCES "media" ("media_id") ON DELETE SET DEFAULT ON UPDATE CASCADE; diff --git a/internal/endtoend/testdata/join_left/postgresql/sqlc.json b/internal/endtoend/testdata/join_left/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/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/join_left/sqlite/go/db.go b/internal/endtoend/testdata/join_left/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left/sqlite/go/models.go b/internal/endtoend/testdata/join_left/sqlite/go/models.go new file mode 100644 index 0000000000..92f5ad97a9 --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/go/models.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int64 + Name string + ParentID sql.NullInt64 +} + +type City struct { + CityID int64 + MayorID int64 +} + +type Mayor struct { + MayorID int64 + FullName string +} + +type Medium struct { + MediaID int64 + MediaCreatedAt time.Time + MediaHash string + MediaDirectory string + MediaAuthorID int64 + MediaWidth int64 + MediaHeight int64 +} + +type SuperAuthor struct { + SuperID int64 + SuperName string + SuperParentID sql.NullInt64 +} + +type User struct { + UserID int64 + CityID sql.NullInt64 +} + +type Users2 struct { + UserID int64 + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID sql.NullInt64 +} diff --git a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6bdea7c263 --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go @@ -0,0 +1,464 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +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 +` + +type AllAuthorsRow struct { + ID int64 + Name string + ParentID sql.NullInt64 + ID_2 sql.NullInt64 + Name_2 sql.NullString + ParentID_2 sql.NullInt64 +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 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 +` + +type AllAuthorsAliasesRow struct { + ID int64 + Name string + ParentID sql.NullInt64 + ID_2 sql.NullInt64 + Name_2 sql.NullString + ParentID_2 sql.NullInt64 +} + +func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliasesRow + for rows.Next() { + var i AllAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 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 +` + +type AllAuthorsAliases2Row struct { + ID int64 + Name string + ParentID sql.NullInt64 + ID_2 sql.NullInt64 + Name_2 sql.NullString + ParentID_2 sql.NullInt64 +} + +func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsAliases2Row + for rows.Next() { + var i AllAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.ID_2, + &i.Name_2, + &i.ParentID_2, + ); 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 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 +` + +type AllSuperAuthorsRow struct { + ID int64 + Name string + ParentID sql.NullInt64 + SuperID sql.NullInt64 + SuperName sql.NullString + SuperParentID sql.NullInt64 +} + +func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsRow + for rows.Next() { + var i AllSuperAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 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 +` + +type AllSuperAuthorsAliasesRow struct { + ID int64 + Name string + ParentID sql.NullInt64 + SuperID sql.NullInt64 + SuperName sql.NullString + SuperParentID sql.NullInt64 +} + +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliasesRow + for rows.Next() { + var i AllSuperAuthorsAliasesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 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 +` + +type AllSuperAuthorsAliases2Row struct { + ID int64 + Name string + ParentID sql.NullInt64 + SuperID sql.NullInt64 + SuperName sql.NullString + SuperParentID sql.NullInt64 +} + +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllSuperAuthorsAliases2Row + for rows.Next() { + var i AllSuperAuthorsAliases2Row + if err := rows.Scan( + &i.ID, + &i.Name, + &i.ParentID, + &i.SuperID, + &i.SuperName, + &i.SuperParentID, + ); 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 getMayors = `-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id) +` + +type GetMayorsRow struct { + UserID int64 + FullName string +} + +func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { + rows, err := q.db.QueryContext(ctx, getMayors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsRow + for rows.Next() { + var i GetMayorsRow + if err := rows.Scan(&i.UserID, &i.FullName); 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 getMayorsOptional = `-- name: GetMayorsOptional :many +SELECT + user_id, + cities.city_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +LEFT JOIN mayors USING (mayor_id) +` + +type GetMayorsOptionalRow struct { + UserID int64 + CityID sql.NullInt64 + FullName sql.NullString +} + +func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { + rows, err := q.db.QueryContext(ctx, getMayorsOptional) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetMayorsOptionalRow + for rows.Next() { + var i GetMayorsOptionalRow + if err := rows.Scan(&i.UserID, &i.CityID, &i.FullName); 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 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 +` + +type GetSuggestedUsersByIDRow struct { + UserID int64 + UserNickname string + UserEmail string + UserDisplayName string + UserPassword sql.NullString + UserGoogleID sql.NullString + UserAppleID sql.NullString + UserBio string + UserCreatedAt time.Time + UserAvatarID sql.NullInt64 + MediaID sql.NullInt64 + MediaCreatedAt sql.NullTime + MediaHash sql.NullString + MediaDirectory sql.NullString + MediaAuthorID sql.NullInt64 + MediaWidth sql.NullInt64 + MediaHeight sql.NullInt64 +} + +func (q *Queries) GetSuggestedUsersByID(ctx context.Context, userID int64) ([]GetSuggestedUsersByIDRow, error) { + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID, userID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetSuggestedUsersByIDRow + for rows.Next() { + var i GetSuggestedUsersByIDRow + if err := rows.Scan( + &i.UserID, + &i.UserNickname, + &i.UserEmail, + &i.UserDisplayName, + &i.UserPassword, + &i.UserGoogleID, + &i.UserAppleID, + &i.UserBio, + &i.UserCreatedAt, + &i.UserAvatarID, + &i.MediaID, + &i.MediaCreatedAt, + &i.MediaHash, + &i.MediaDirectory, + &i.MediaAuthorID, + &i.MediaWidth, + &i.MediaHeight, + ); 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 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 +` + +func (q *Queries) GetSuggestedUsersByID2(ctx context.Context, userID int64) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID2, userID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var user_id int64 + if err := rows.Scan(&user_id); err != nil { + return nil, err + } + items = append(items, user_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/join_left/sqlite/query.sql b/internal/endtoend/testdata/join_left/sqlite/query.sql new file mode 100644 index 0000000000..d9ccaede83 --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/query.sql @@ -0,0 +1,66 @@ +-- name: GetMayors :many +SELECT + user_id, + mayors.full_name +FROM users +LEFT JOIN cities USING (city_id) +INNER JOIN mayors USING (mayor_id); + +-- name: GetMayorsOptional :many +SELECT + 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; + +-- name: AllAuthorsAliases :many +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; + +-- name: AllAuthorsAliases2 :many +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; + +-- name: AllSuperAuthorsAliases2 :many +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; + +-- 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; diff --git a/internal/endtoend/testdata/join_left/sqlite/schema.sql b/internal/endtoend/testdata/join_left/sqlite/schema.sql new file mode 100644 index 0000000000..e5b2db5a1b --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/schema.sql @@ -0,0 +1,50 @@ +-- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE users_2 ( + user_id INT PRIMARY KEY, + user_nickname VARCHAR(30) UNIQUE NOT NULL, + user_email TEXT UNIQUE NOT NULL, + user_display_name TEXT NOT NULL, + user_password TEXT , + user_google_id TEXT UNIQUE , + user_apple_id TEXT UNIQUE , + user_bio VARCHAR(160) NOT NULL DEFAULT '', + user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + user_avatar_id INT UNIQUE +); + +CREATE TABLE media ( + media_id INT PRIMARY KEY, + media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + media_hash TEXT NOT NULL, + media_directory TEXT NOT NULL, + media_author_id INT NOT NULL, + media_width INT NOT NULL, + media_height INT NOT NULL +); diff --git a/internal/endtoend/testdata/join_left/sqlite/sqlc.json b/internal/endtoend/testdata/join_left/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left_same_table/mysql/go/models.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go new file mode 100644 index 0000000000..fc10ae1ebe --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + ParentID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..50025f9f94 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const allAuthors = `-- name: AllAuthors :many +SELECT a.id, + a.name, + p.id as alias_id, + p.name as alias_name +FROM authors a + LEFT JOIN authors p + ON (authors.parent_id = p.id) +` + +type AllAuthorsRow struct { + ID int32 + Name string + AliasID sql.NullInt32 + AliasName sql.NullString +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.AliasID, + &i.AliasName, + ); 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/join_left_same_table/mysql/query.sql b/internal/endtoend/testdata/join_left_same_table/mysql/query.sql new file mode 100644 index 0000000000..26bd026ee5 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/query.sql @@ -0,0 +1,8 @@ +-- name: AllAuthors :many +SELECT a.id, + a.name, + p.id as alias_id, + p.name as alias_name +FROM authors a + LEFT JOIN authors p + ON (authors.parent_id = p.id); diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql b/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql new file mode 100644 index 0000000000..e5431317d9 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id INT(10) NOT NULL, + name VARCHAR(255) NOT NULL, + parent_id INT(10), + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json b/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/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/join_left_same_table/postgres/go/db.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left_same_table/postgres/go/models.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go new file mode 100644 index 0000000000..fc10ae1ebe --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + ParentID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..f72cc64440 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const allAuthors = `-- name: AllAuthors :many +SELECT a.id, + a.name, + p.id as alias_id, + p.name as alias_name +FROM authors a + LEFT JOIN authors p USING (parent_id) +` + +type AllAuthorsRow struct { + ID int32 + Name string + AliasID sql.NullInt32 + AliasName sql.NullString +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.AliasID, + &i.AliasName, + ); 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/join_left_same_table/postgres/query.sql b/internal/endtoend/testdata/join_left_same_table/postgres/query.sql new file mode 100644 index 0000000000..6fb2fced54 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/query.sql @@ -0,0 +1,7 @@ +-- name: AllAuthors :many +SELECT a.id, + a.name, + p.id as alias_id, + p.name as alias_name +FROM authors a + LEFT JOIN authors p USING (parent_id); diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql b/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql new file mode 100644 index 0000000000..b15882baf3 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json b/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/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/join_left_same_table/sqlite/go/db.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_left_same_table/sqlite/go/models.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go new file mode 100644 index 0000000000..7d416b37c4 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + ParentID sql.NullInt64 +} 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 new file mode 100644 index 0000000000..c25e22e249 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +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 (a.parent_id = p.id) +` + +type AllAuthorsRow struct { + ID int64 + Name string + AliasID sql.NullInt64 + AliasName sql.NullString +} + +func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, allAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []AllAuthorsRow + for rows.Next() { + var i AllAuthorsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.AliasID, + &i.AliasName, + ); 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/join_left_same_table/sqlite/query.sql b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql new file mode 100644 index 0000000000..79daa2dfd5 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql @@ -0,0 +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 (a.parent_id = p.id); diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql b/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql new file mode 100644 index 0000000000..4958ea64b6 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id INT NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT +); + diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json b/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..f2f59a2260 --- /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.30.0 + +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..2afea551ce --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..e4cf9d17ae --- /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.30.0 + +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..c6a217b08d --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_order_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ae9173ef9e --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..167045b212 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const columnAsOrderBy = `-- name: ColumnAsOrderBy :many +SELECT a.email AS id +FROM foo a JOIN foo b ON a.email = b.email +ORDER BY id +` + +func (q *Queries) ColumnAsOrderBy(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, columnAsOrderBy) + 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/join_order_by_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..7a47032a4c --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +-- name: ColumnAsOrderBy :many +SELECT a.email AS id +FROM foo a JOIN foo b ON a.email = b.email +ORDER BY id; diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..da8ec19c5d --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (email text not null); + diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/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/join_right/mysql/go/db.go b/internal/endtoend/testdata/join_right/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_right/mysql/go/models.go b/internal/endtoend/testdata/join_right/mysql/go/models.go new file mode 100644 index 0000000000..7453c9d172 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + 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 new file mode 100644 index 0000000000..9996f8c927 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const rightJoin = `-- name: RightJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +RIGHT JOIN bar b ON b.id = f.bar_id +WHERE f.id = ? +` + +type RightJoinRow struct { + ID sql.NullInt32 + BarID sql.NullInt32 + ID_2 int32 +} + +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 + } + defer rows.Close() + var items []RightJoinRow + for rows.Next() { + var i RightJoinRow + if err := rows.Scan(&i.ID, &i.BarID, &i.ID_2); 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/join_right/mysql/query.sql b/internal/endtoend/testdata/join_right/mysql/query.sql new file mode 100644 index 0000000000..cfdf82f973 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: RightJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +RIGHT JOIN bar b ON b.id = f.bar_id +WHERE f.id = ?; diff --git a/internal/endtoend/testdata/join_right/mysql/schema.sql b/internal/endtoend/testdata/join_right/mysql/schema.sql new file mode 100644 index 0000000000..f0f2cb1685 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/schema.sql @@ -0,0 +1,8 @@ +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/mysql/sqlc.json b/internal/endtoend/testdata/join_right/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/join_right/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/join_right/postgresql/go/db.go b/internal/endtoend/testdata/join_right/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_right/postgresql/go/models.go b/internal/endtoend/testdata/join_right/postgresql/go/models.go new file mode 100644 index 0000000000..7453c9d172 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + BarID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go new file mode 100644 index 0000000000..df23abc123 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const rightJoin = `-- name: RightJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +RIGHT JOIN bar b ON b.id = f.bar_id +WHERE f.id = $1 +` + +type RightJoinRow struct { + ID sql.NullInt32 + BarID sql.NullInt32 + ID_2 int32 +} + +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 + } + defer rows.Close() + var items []RightJoinRow + for rows.Next() { + var i RightJoinRow + if err := rows.Scan(&i.ID, &i.BarID, &i.ID_2); 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/join_right/postgresql/query.sql b/internal/endtoend/testdata/join_right/postgresql/query.sql new file mode 100644 index 0000000000..f7d9c48d2b --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: RightJoin :many +SELECT f.id, f.bar_id, b.id +FROM foo f +RIGHT JOIN bar b ON b.id = f.bar_id +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_right/postgresql/schema.sql b/internal/endtoend/testdata/join_right/postgresql/schema.sql new file mode 100644 index 0000000000..c7d2a76585 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null unique); +CREATE TABLE foo (id serial not null, bar_id int references bar(id)); + diff --git a/internal/endtoend/testdata/join_right/postgresql/sqlc.json b/internal/endtoend/testdata/join_right/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/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/join_table_name/mysql/go/db.go b/internal/endtoend/testdata/join_table_name/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/db.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 6d6345bfdf..8594c6e575 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/models.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/models.go @@ -1,14 +1,18 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () +import ( + "database/sql" +) type Bar struct { - ID int64 + ID int32 } type Foo struct { - ID int64 - Bar int64 + 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 2f49770ee4..df1c751314 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -15,13 +17,13 @@ WHERE bar.id = ? AND foo.id = ? ` type TableNameParams struct { - ID int64 - ID_2 int64 + ID int32 + ID_2 int32 } -func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int64, 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 int64 + var id int32 err := row.Scan(&id) return id, err } diff --git a/internal/endtoend/testdata/join_table_name/mysql/query.sql b/internal/endtoend/testdata/join_table_name/mysql/query.sql index 2196ed2375..8af0c45994 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/query.sql +++ b/internal/endtoend/testdata/join_table_name/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/mysql/schema.sql b/internal/endtoend/testdata/join_table_name/mysql/schema.sql new file mode 100644 index 0000000000..f54c3b485d --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/mysql/schema.sql @@ -0,0 +1,7 @@ +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/mysql/sqlc.json b/internal/endtoend/testdata/join_table_name/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/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/join_table_name/postgresql/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/join_table_name/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/join_table_name/postgresql/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/go/models.go deleted file mode 100644 index 99f581177b..0000000000 --- a/internal/endtoend/testdata/join_table_name/postgresql/go/models.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - ID int32 -} - -type Foo struct { - ID int32 - Bar sql.NullInt32 -} diff --git a/internal/endtoend/testdata/join_table_name/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/go/query.sql.go deleted file mode 100644 index 94970ef6e0..0000000000 --- a/internal/endtoend/testdata/join_table_name/postgresql/go/query.sql.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const tableName = `-- name: TableName :one -SELECT foo.id -FROM foo -JOIN bar ON foo.bar = bar.id -WHERE bar.id = $1 AND foo.id = $2 -` - -type TableNameParams struct { - ID int32 - ID_2 int32 -} - -func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { - row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) - var id int32 - err := row.Scan(&id) - return id, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_table_name/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..8594c6e575 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar sql.NullInt32 +} 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 new file mode 100644 index 0000000000..bf5d3b2013 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const tableName = `-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2 +` + +type TableNameParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { + row := q.db.QueryRow(ctx, tableName, arg.ID, arg.ID_2) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3d11146a24 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2; diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_table_name/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..c7e5e6a8d0 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar pgtype.Int4 +} 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 new file mode 100644 index 0000000000..bf5d3b2013 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const tableName = `-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2 +` + +type TableNameParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { + row := q.db.QueryRow(ctx, tableName, arg.ID, arg.ID_2) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3d11146a24 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2; diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/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/join_table_name/postgresql/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/query.sql deleted file mode 100644 index c9f0a8557b..0000000000 --- a/internal/endtoend/testdata/join_table_name/postgresql/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); - --- name: TableName :one -SELECT foo.id -FROM foo -JOIN bar ON foo.bar = bar.id -WHERE bar.id = $1 AND foo.id = $2; diff --git a/internal/endtoend/testdata/join_table_name/postgresql/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/join_table_name/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_table_name/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..8594c6e575 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar sql.NullInt32 +} 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 new file mode 100644 index 0000000000..2030d9898e --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const tableName = `-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2 +` + +type TableNameParams struct { + ID int32 + ID_2 int32 +} + +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { + row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3d11146a24 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = $1 AND foo.id = $2; diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/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/join_table_name/sqlite/go/db.go b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_table_name/sqlite/go/models.go b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go new file mode 100644 index 0000000000..10a2b6f6f5 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int64 +} + +type Foo struct { + ID int64 + Bar sql.NullInt64 +} 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 new file mode 100644 index 0000000000..23281c26f9 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const tableName = `-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = ? AND foo.id = ? +` + +type TableNameParams struct { + ID int64 + ID_2 int64 +} + +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int64, error) { + row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) + var id int64 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/join_table_name/sqlite/query.sql b/internal/endtoend/testdata/join_table_name/sqlite/query.sql new file mode 100644 index 0000000000..8af0c45994 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: TableName :one +SELECT foo.id +FROM foo +JOIN bar ON foo.bar = bar.id +WHERE bar.id = ? AND foo.id = ?; diff --git a/internal/endtoend/testdata/join_table_name/sqlite/schema.sql b/internal/endtoend/testdata/join_table_name/sqlite/schema.sql new file mode 100644 index 0000000000..fe600c9ec6 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id integer not null); +CREATE TABLE foo (id integer not null, bar integer references bar(id)); + diff --git a/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json b/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 70f10f712d..fae11cfa19 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/models.go @@ -1,18 +1,18 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + ID uint64 } type Baz struct { - ID int64 + ID uint64 } type Foo struct { - BarID int64 - BazID int64 + BarID 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 eb076ffcd0..f5b3386fc2 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/mysql/query.sql b/internal/endtoend/testdata/join_two_tables/mysql/query.sql index 8dcf3ae0d8..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/query.sql +++ b/internal/endtoend/testdata/join_two_tables/mysql/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/mysql/schema.sql b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql new file mode 100644 index 0000000000..d8b5e500cf --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql @@ -0,0 +1,4 @@ +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/mysql/sqlc.json b/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/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/join_two_tables/postgresql/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/join_two_tables/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/join_two_tables/postgresql/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/go/models.go deleted file mode 100644 index ede1f2cdc4..0000000000 --- a/internal/endtoend/testdata/join_two_tables/postgresql/go/models.go +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} - -type Baz struct { - ID int32 -} - -type Foo struct { - BarID int32 - BazID int32 -} diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/go/query.sql.go deleted file mode 100644 index eb076ffcd0..0000000000 --- a/internal/endtoend/testdata/join_two_tables/postgresql/go/query.sql.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const twoJoins = `-- name: TwoJoins :many -SELECT foo.bar_id, foo.baz_id -FROM foo -JOIN bar ON bar.id = bar_id -JOIN baz ON baz.id = baz_id -` - -func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, twoJoins) - 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.BazID); 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/join_two_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_two_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ad2b376d3a --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 +} + +type Baz struct { + ID int32 +} + +type Foo struct { + BarID int32 + BazID 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 new file mode 100644 index 0000000000..b2d903d310 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const twoJoins = `-- name: TwoJoins :many +SELECT foo.bar_id, foo.baz_id +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id +` + +func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, twoJoins) + 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.BazID); 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_two_tables/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..f38154c3d8 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: TwoJoins :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id; diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial 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/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_two_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..ad2b376d3a --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 +} + +type Baz struct { + ID int32 +} + +type Foo struct { + BarID int32 + BazID 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 new file mode 100644 index 0000000000..b2d903d310 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const twoJoins = `-- name: TwoJoins :many +SELECT foo.bar_id, foo.baz_id +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id +` + +func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, twoJoins) + 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.BazID); 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_two_tables/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..f38154c3d8 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: TwoJoins :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id; diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial 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/v5/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/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/join_two_tables/postgresql/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/query.sql deleted file mode 100644 index 8dcf3ae0d8..0000000000 --- a/internal/endtoend/testdata/join_two_tables/postgresql/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - --- name: TwoJoins :many -SELECT foo.* -FROM foo -JOIN bar ON bar.id = bar_id -JOIN baz ON baz.id = baz_id; diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/join_two_tables/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_two_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ad2b376d3a --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 +} + +type Baz struct { + ID int32 +} + +type Foo struct { + BarID int32 + BazID 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 new file mode 100644 index 0000000000..f5b3386fc2 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const twoJoins = `-- name: TwoJoins :many +SELECT foo.bar_id, foo.baz_id +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id +` + +func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, twoJoins) + 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.BazID); 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/join_two_tables/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..f38154c3d8 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: TwoJoins :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id; diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial 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/stdlib/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/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/join_two_tables/sqlite/go/db.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_two_tables/sqlite/go/models.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go new file mode 100644 index 0000000000..b723af0c72 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int64 +} + +type Baz struct { + ID int64 +} + +type Foo struct { + BarID int64 + BazID 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 new file mode 100644 index 0000000000..f5b3386fc2 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const twoJoins = `-- name: TwoJoins :many +SELECT foo.bar_id, foo.baz_id +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id +` + +func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, twoJoins) + 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.BazID); 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/join_two_tables/sqlite/query.sql b/internal/endtoend/testdata/join_two_tables/sqlite/query.sql new file mode 100644 index 0000000000..f38154c3d8 --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: TwoJoins :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = bar_id +JOIN baz ON baz.id = baz_id; diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql b/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql new file mode 100644 index 0000000000..381a08421f --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id integer not null, baz_id integer not null); +CREATE TABLE bar (id integer not null); +CREATE TABLE baz (id integer not null); + diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json b/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/join_update/issue.md b/internal/endtoend/testdata/join_update/issue.md new file mode 100644 index 0000000000..2b957486bc --- /dev/null +++ b/internal/endtoend/testdata/join_update/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1100 diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_update/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f762916256 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type GroupCalcTotal struct { + Npn pgtype.Text + GroupID pgtype.Text +} + +type NpnExternalMap struct { + ID pgtype.Text + Npn pgtype.Text +} + +type ProducerGroupAttribute struct { + NpnExternalMapID pgtype.Text + GroupID pgtype.Text +} 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 new file mode 100644 index 0000000000..29e6561e64 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :exec +UPDATE group_calc_totals gct +SET npn = nem.npn +FROM producer_group_attribute ga +JOIN npn_external_map nem ON ga.npn_external_map_id = nem.id +WHERE gct.group_id = ga.group_id +` + +func (q *Queries) Percentile(ctx context.Context) error { + _, err := q.db.Exec(ctx, percentile) + return err +} diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql new file mode 100644 index 0000000000..776517029d --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: Percentile :exec +UPDATE group_calc_totals gct +SET npn = nem.npn +FROM producer_group_attribute ga +JOIN npn_external_map nem ON ga.npn_external_map_id = nem.id +WHERE gct.group_id = ga.group_id; diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c91a086a71 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE group_calc_totals ( + npn text, + group_id text +); + +CREATE TABLE producer_group_attribute ( + npn_external_map_id text, + group_id text +); + +CREATE TABLE npn_external_map ( + id text, + npn text +); diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_update/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_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/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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..f4eaade85e --- /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.30.0 + +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..d3031ccddf --- /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.30.0 +// 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_validate_columns/issue.md b/internal/endtoend/testdata/join_validate_columns/issue.md new file mode 100644 index 0000000000..0050218dca --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1239 \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql new file mode 100644 index 0000000000..8fe51af829 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM authors JOIN books ON authors.id = book.author_id1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d322893016 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + author_id BIGSERIAL REFERENCES authors(id) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_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/join_validate_columns/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..0dfd315960 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:65: missing FROM-clause entry for table "book" \ No newline at end of file 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 9b195e5f1c..ae80c37712 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/models.go @@ -1,14 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + ID uint64 Owner string } type Foo struct { - Barid int64 + Barid uint64 } 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 ce42f6ae5b..cd4f274eb6 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -7,6 +9,76 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ? +` + +type JoinNoConstraintsParams struct { + ID uint64 + Owner string +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var barid uint64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ? +` + +type JoinParamWhereClauseParams struct { + ID uint64 + Owner string +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var barid uint64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo @@ -14,15 +86,15 @@ JOIN bar ON bar.id = barid WHERE owner = ? ` -func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int64, error) { +func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]uint64, error) { rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) if err != nil { return nil, err } defer rows.Close() - var items []int64 + var items []uint64 for rows.Next() { - var barid int64 + var barid uint64 if err := rows.Scan(&barid); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/mysql/query.sql b/internal/endtoend/testdata/join_where_clause/mysql/query.sql index edcf7c2a5c..bdff39a5ba 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/query.sql +++ b/internal/endtoend/testdata/join_where_clause/mysql/query.sql @@ -1,8 +1,17 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo JOIN bar ON bar.id = barid WHERE owner = ?; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ?; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ?; diff --git a/internal/endtoend/testdata/join_where_clause/mysql/schema.sql b/internal/endtoend/testdata/join_where_clause/mysql/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json b/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/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/join_where_clause/postgresql/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/join_where_clause/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/join_where_clause/postgresql/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/go/models.go deleted file mode 100644 index 55b92580ce..0000000000 --- a/internal/endtoend/testdata/join_where_clause/postgresql/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 - Owner string -} - -type Foo struct { - Barid int32 -} diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/go/query.sql.go deleted file mode 100644 index 18d6409f98..0000000000 --- a/internal/endtoend/testdata/join_where_clause/postgresql/go/query.sql.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const joinWhereClause = `-- name: JoinWhereClause :many -SELECT foo.barid -FROM foo -JOIN bar ON bar.id = barid -WHERE owner = $1 -` - -func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var barid int32 - if err := rows.Scan(&barid); err != nil { - return nil, err - } - items = append(items, barid) - } - 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/join_where_clause/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_where_clause/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..b133b28e36 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Owner string +} + +type Foo struct { + Barid int32 +} 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 new file mode 100644 index 0000000000..da6dc818c3 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinWhereClause = `-- name: JoinWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1 +` + +func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { + rows, err := q.db.Query(ctx, joinWhereClause, owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..776cd41ced --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql @@ -0,0 +1,17 @@ +-- name: JoinWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_where_clause/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..b133b28e36 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Owner string +} + +type Foo struct { + Barid int32 +} 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 new file mode 100644 index 0000000000..da6dc818c3 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinWhereClause = `-- name: JoinWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1 +` + +func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { + rows, err := q.db.Query(ctx, joinWhereClause, owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..776cd41ced --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql @@ -0,0 +1,17 @@ +-- name: JoinWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/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/join_where_clause/postgresql/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/query.sql deleted file mode 100644 index 885042098d..0000000000 --- a/internal/endtoend/testdata/join_where_clause/postgresql/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - --- name: JoinWhereClause :many -SELECT foo.* -FROM foo -JOIN bar ON bar.id = barid -WHERE owner = $1; diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/join_where_clause/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_where_clause/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..b133b28e36 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Owner string +} + +type Foo struct { + Barid int32 +} 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 new file mode 100644 index 0000000000..a3035e456d --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,110 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinWhereClause = `-- name: JoinWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1 +` + +func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + 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/join_where_clause/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..776cd41ced --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql @@ -0,0 +1,17 @@ +-- name: JoinWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/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/join_where_clause/sqlite/go/db.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/join_where_clause/sqlite/go/models.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go new file mode 100644 index 0000000000..ec6bbfe120 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int64 + Owner string +} + +type Foo struct { + Barid int64 +} 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 new file mode 100644 index 0000000000..46b1bcbdfa --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go @@ -0,0 +1,110 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ? +` + +type JoinNoConstraintsParams struct { + ID int64 + Owner string +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var barid int64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ? +` + +type JoinParamWhereClauseParams struct { + ID int64 + Owner string +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var barid int64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinWhereClause = `-- name: JoinWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = ? +` + +func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var barid int64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + 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/join_where_clause/sqlite/query.sql b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql new file mode 100644 index 0000000000..2b5ae53b00 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql @@ -0,0 +1,17 @@ +-- name: JoinWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = barid +WHERE owner = ?; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ?; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ?; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql b/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql new file mode 100644 index 0000000000..e2e8f9da90 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid integer not null); +CREATE TABLE bar (id integer not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json b/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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..e27ad3e735 --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/json/mysql/go/db.go +++ b/internal/endtoend/testdata/json/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/mysql/go/models.go b/internal/endtoend/testdata/json/mysql/go/models.go index 4570584e83..ce2b99dec7 100644 --- a/internal/endtoend/testdata/json/mysql/go/models.go +++ b/internal/endtoend/testdata/json/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 c28c12d633..4301cd3454 100644 --- a/internal/endtoend/testdata/json/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/json/mysql/go/query.sql.go @@ -1,12 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // 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 b0234e866a..927e597562 100644 --- a/internal/endtoend/testdata/json/mysql/query.sql +++ b/internal/endtoend/testdata/json/mysql/query.sql @@ -1,7 +1,5 @@ -CREATE TABLE foo ( - a json not null, - b json -); - -- name: SelectFoo :exec SELECT * FROM foo; + +-- name: BulkInsert :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/json/mysql/schema.sql b/internal/endtoend/testdata/json/mysql/schema.sql new file mode 100644 index 0000000000..8f3d639f50 --- /dev/null +++ b/internal/endtoend/testdata/json/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + a json not null, + b json +); + diff --git a/internal/endtoend/testdata/json/mysql/sqlc.json b/internal/endtoend/testdata/json/mysql/sqlc.json index 445bbd1589..b1127e200f 100644 --- a/internal/endtoend/testdata/json/mysql/sqlc.json +++ b/internal/endtoend/testdata/json/mysql/sqlc.json @@ -4,8 +4,9 @@ { "path": "go", "engine": "mysql", + "sql_driver": "github.com/go-sql-driver/mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json/postgresql/go/db.go b/internal/endtoend/testdata/json/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/json/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/json/postgresql/go/models.go deleted file mode 100644 index bac200d0ea..0000000000 --- a/internal/endtoend/testdata/json/postgresql/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "encoding/json" -) - -type Foo struct { - A json.RawMessage - B json.RawMessage - C json.RawMessage - D json.RawMessage -} diff --git a/internal/endtoend/testdata/json/postgresql/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/go/query.sql.go deleted file mode 100644 index 3dd9e4ac38..0000000000 --- a/internal/endtoend/testdata/json/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectFoo = `-- name: SelectFoo :exec -SELECT a, b, c, d FROM foo -` - -func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, selectFoo) - return err -} diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..e2a09cd7aa --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type Foo struct { + A pgtype.JSON + B pgtype.JSONB + C pgtype.JSON + D pgtype.JSONB +} 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 new file mode 100644 index 0000000000..907ec22cd8 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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/json/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..a8629cc2ae --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/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/json/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..5157c6524c --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Foo struct { + A []byte + B []byte + C []byte + D []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 new file mode 100644 index 0000000000..907ec22cd8 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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/json/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..a8629cc2ae --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/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/json/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/json/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/json/postgresql/query.sql b/internal/endtoend/testdata/json/postgresql/query.sql deleted file mode 100644 index b3aa769979..0000000000 --- a/internal/endtoend/testdata/json/postgresql/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE foo ( - a json not null, - b jsonb not null, - c json, - d jsonb -); - --- name: SelectFoo :exec -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/sqlc.json b/internal/endtoend/testdata/json/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/json/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..b8d447e7d8 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "encoding/json" + + "github.com/sqlc-dev/pqtype" +) + +type Foo struct { + A json.RawMessage + B json.RawMessage + C pqtype.NullRawMessage + D pqtype.NullRawMessage +} diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..7144c0f706 --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, b, c, d FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, selectFoo) + return err +} diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..a8629cc2ae --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/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/json/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/json/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/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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..d28bfc19ea --- /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.30.0 + +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..2c13c0ffa9 --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/json_build/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/json_build/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_build/go/models.go b/internal/endtoend/testdata/json_build/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/json_build/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/go/query.sql.go b/internal/endtoend/testdata/json_build/go/query.sql.go deleted file mode 100644 index 5be6c2aae8..0000000000 --- a/internal/endtoend/testdata/json_build/go/query.sql.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "encoding/json" -) - -const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one -SELECT - json_build_array(), - json_build_array(1), - json_build_array(1, 2), - json_build_array(1, 2, 'foo'), - json_build_array(1, 2, 'foo', 4) -` - -type SelectJSONBuildArrayRow struct { - JsonBuildArray json.RawMessage - JsonBuildArray_2 json.RawMessage - JsonBuildArray_3 json.RawMessage - JsonBuildArray_4 json.RawMessage - JsonBuildArray_5 json.RawMessage -} - -func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBuildArray) - var i SelectJSONBuildArrayRow - err := row.Scan( - &i.JsonBuildArray, - &i.JsonBuildArray_2, - &i.JsonBuildArray_3, - &i.JsonBuildArray_4, - &i.JsonBuildArray_5, - ) - return i, err -} - -const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one -SELECT - json_build_object(), - json_build_object('foo'), - json_build_object('foo', 1), - json_build_object('foo', 1, 2), - json_build_object('foo', 1, 2, 'bar') -` - -type SelectJSONBuildObjectRow struct { - JsonBuildObject json.RawMessage - JsonBuildObject_2 json.RawMessage - JsonBuildObject_3 json.RawMessage - JsonBuildObject_4 json.RawMessage - JsonBuildObject_5 json.RawMessage -} - -func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBuildObject) - var i SelectJSONBuildObjectRow - err := row.Scan( - &i.JsonBuildObject, - &i.JsonBuildObject_2, - &i.JsonBuildObject_3, - &i.JsonBuildObject_4, - &i.JsonBuildObject_5, - ) - return i, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_build/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..d075c6b1b7 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,132 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgtype" +) + +const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBBuildArrayRow struct { + JsonbBuildArray pgtype.JSONB + JsonbBuildArray_2 pgtype.JSONB + JsonbBuildArray_3 pgtype.JSONB + JsonbBuildArray_4 pgtype.JSONB + JsonbBuildArray_5 pgtype.JSONB +} + +func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { + row := q.db.QueryRow(ctx, selectJSONBBuildArray) + var i SelectJSONBBuildArrayRow + err := row.Scan( + &i.JsonbBuildArray, + &i.JsonbBuildArray_2, + &i.JsonbBuildArray_3, + &i.JsonbBuildArray_4, + &i.JsonbBuildArray_5, + ) + return i, err +} + +const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBBuildObjectRow struct { + JsonbBuildObject pgtype.JSONB + JsonbBuildObject_2 pgtype.JSONB + JsonbBuildObject_3 pgtype.JSONB + JsonbBuildObject_4 pgtype.JSONB + JsonbBuildObject_5 pgtype.JSONB +} + +func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { + row := q.db.QueryRow(ctx, selectJSONBBuildObject) + var i SelectJSONBBuildObjectRow + err := row.Scan( + &i.JsonbBuildObject, + &i.JsonbBuildObject_2, + &i.JsonbBuildObject_3, + &i.JsonbBuildObject_4, + &i.JsonbBuildObject_5, + ) + return i, err +} + +const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBuildArrayRow struct { + JsonBuildArray pgtype.JSON + JsonBuildArray_2 pgtype.JSON + JsonBuildArray_3 pgtype.JSON + JsonBuildArray_4 pgtype.JSON + JsonBuildArray_5 pgtype.JSON +} + +func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { + row := q.db.QueryRow(ctx, selectJSONBuildArray) + var i SelectJSONBuildArrayRow + err := row.Scan( + &i.JsonBuildArray, + &i.JsonBuildArray_2, + &i.JsonBuildArray_3, + &i.JsonBuildArray_4, + &i.JsonBuildArray_5, + ) + return i, err +} + +const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBuildObjectRow struct { + JsonBuildObject pgtype.JSON + JsonBuildObject_2 pgtype.JSON + JsonBuildObject_3 pgtype.JSON + JsonBuildObject_4 pgtype.JSON + JsonBuildObject_5 pgtype.JSON +} + +func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { + row := q.db.QueryRow(ctx, selectJSONBuildObject) + var i SelectJSONBuildObjectRow + err := row.Scan( + &i.JsonBuildObject, + &i.JsonBuildObject_2, + &i.JsonBuildObject_3, + &i.JsonBuildObject_4, + &i.JsonBuildObject_5, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..160eab53ff --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/query.sql @@ -0,0 +1,31 @@ +-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4); + +-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4); diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_build/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..1d1a952ec1 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,130 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBBuildArrayRow struct { + JsonbBuildArray []byte + JsonbBuildArray_2 []byte + JsonbBuildArray_3 []byte + JsonbBuildArray_4 []byte + JsonbBuildArray_5 []byte +} + +func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { + row := q.db.QueryRow(ctx, selectJSONBBuildArray) + var i SelectJSONBBuildArrayRow + err := row.Scan( + &i.JsonbBuildArray, + &i.JsonbBuildArray_2, + &i.JsonbBuildArray_3, + &i.JsonbBuildArray_4, + &i.JsonbBuildArray_5, + ) + return i, err +} + +const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBBuildObjectRow struct { + JsonbBuildObject []byte + JsonbBuildObject_2 []byte + JsonbBuildObject_3 []byte + JsonbBuildObject_4 []byte + JsonbBuildObject_5 []byte +} + +func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { + row := q.db.QueryRow(ctx, selectJSONBBuildObject) + var i SelectJSONBBuildObjectRow + err := row.Scan( + &i.JsonbBuildObject, + &i.JsonbBuildObject_2, + &i.JsonbBuildObject_3, + &i.JsonbBuildObject_4, + &i.JsonbBuildObject_5, + ) + return i, err +} + +const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBuildArrayRow struct { + JsonBuildArray []byte + JsonBuildArray_2 []byte + JsonBuildArray_3 []byte + JsonBuildArray_4 []byte + JsonBuildArray_5 []byte +} + +func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { + row := q.db.QueryRow(ctx, selectJSONBuildArray) + var i SelectJSONBuildArrayRow + err := row.Scan( + &i.JsonBuildArray, + &i.JsonBuildArray_2, + &i.JsonBuildArray_3, + &i.JsonBuildArray_4, + &i.JsonBuildArray_5, + ) + return i, err +} + +const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBuildObjectRow struct { + JsonBuildObject []byte + JsonBuildObject_2 []byte + JsonBuildObject_3 []byte + JsonBuildObject_4 []byte + JsonBuildObject_5 []byte +} + +func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { + row := q.db.QueryRow(ctx, selectJSONBuildObject) + var i SelectJSONBuildObjectRow + err := row.Scan( + &i.JsonBuildObject, + &i.JsonBuildObject_2, + &i.JsonBuildObject_3, + &i.JsonBuildObject_4, + &i.JsonBuildObject_5, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..160eab53ff --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/query.sql @@ -0,0 +1,31 @@ +-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4); + +-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4); diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/json_build/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/json_build/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_build/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..65c574c522 --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,131 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "encoding/json" +) + +const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBBuildArrayRow struct { + JsonbBuildArray json.RawMessage + JsonbBuildArray_2 json.RawMessage + JsonbBuildArray_3 json.RawMessage + JsonbBuildArray_4 json.RawMessage + JsonbBuildArray_5 json.RawMessage +} + +func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { + row := q.db.QueryRowContext(ctx, selectJSONBBuildArray) + var i SelectJSONBBuildArrayRow + err := row.Scan( + &i.JsonbBuildArray, + &i.JsonbBuildArray_2, + &i.JsonbBuildArray_3, + &i.JsonbBuildArray_4, + &i.JsonbBuildArray_5, + ) + return i, err +} + +const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBBuildObjectRow struct { + JsonbBuildObject json.RawMessage + JsonbBuildObject_2 json.RawMessage + JsonbBuildObject_3 json.RawMessage + JsonbBuildObject_4 json.RawMessage + JsonbBuildObject_5 json.RawMessage +} + +func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { + row := q.db.QueryRowContext(ctx, selectJSONBBuildObject) + var i SelectJSONBBuildObjectRow + err := row.Scan( + &i.JsonbBuildObject, + &i.JsonbBuildObject_2, + &i.JsonbBuildObject_3, + &i.JsonbBuildObject_4, + &i.JsonbBuildObject_5, + ) + return i, err +} + +const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4) +` + +type SelectJSONBuildArrayRow struct { + JsonBuildArray json.RawMessage + JsonBuildArray_2 json.RawMessage + JsonBuildArray_3 json.RawMessage + JsonBuildArray_4 json.RawMessage + JsonBuildArray_5 json.RawMessage +} + +func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { + row := q.db.QueryRowContext(ctx, selectJSONBuildArray) + var i SelectJSONBuildArrayRow + err := row.Scan( + &i.JsonBuildArray, + &i.JsonBuildArray_2, + &i.JsonBuildArray_3, + &i.JsonBuildArray_4, + &i.JsonBuildArray_5, + ) + return i, err +} + +const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar') +` + +type SelectJSONBuildObjectRow struct { + JsonBuildObject json.RawMessage + JsonBuildObject_2 json.RawMessage + JsonBuildObject_3 json.RawMessage + JsonBuildObject_4 json.RawMessage + JsonBuildObject_5 json.RawMessage +} + +func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { + row := q.db.QueryRowContext(ctx, selectJSONBuildObject) + var i SelectJSONBuildObjectRow + err := row.Scan( + &i.JsonBuildObject, + &i.JsonBuildObject_2, + &i.JsonBuildObject_3, + &i.JsonBuildObject_4, + &i.JsonBuildObject_5, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_build/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..160eab53ff --- /dev/null +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/query.sql @@ -0,0 +1,31 @@ +-- name: SelectJSONBuildObject :one +SELECT + json_build_object(), + json_build_object('foo'), + json_build_object('foo', 1), + json_build_object('foo', 1, 2), + json_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBuildArray :one +SELECT + json_build_array(), + json_build_array(1), + json_build_array(1, 2), + json_build_array(1, 2, 'foo'), + json_build_array(1, 2, 'foo', 4); + +-- name: SelectJSONBBuildObject :one +SELECT + jsonb_build_object(), + jsonb_build_object('foo'), + jsonb_build_object('foo', 1), + jsonb_build_object('foo', 1, 2), + jsonb_build_object('foo', 1, 2, 'bar'); + +-- name: SelectJSONBBuildArray :one +SELECT + jsonb_build_array(), + jsonb_build_array(1), + jsonb_build_array(1, 2), + jsonb_build_array(1, 2, 'foo'), + jsonb_build_array(1, 2, 'foo', 4); diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_build/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/json_build/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/json_build/query.sql b/internal/endtoend/testdata/json_build/query.sql deleted file mode 100644 index 7b8321b25e..0000000000 --- a/internal/endtoend/testdata/json_build/query.sql +++ /dev/null @@ -1,15 +0,0 @@ --- name: SelectJSONBuildObject :one -SELECT - json_build_object(), - json_build_object('foo'), - json_build_object('foo', 1), - json_build_object('foo', 1, 2), - json_build_object('foo', 1, 2, 'bar'); - --- name: SelectJSONBuildArray :one -SELECT - json_build_array(), - json_build_array(1), - json_build_array(1, 2), - json_build_array(1, 2, 'foo'), - json_build_array(1, 2, 'foo', 4); diff --git a/internal/endtoend/testdata/json_build/sqlc.json b/internal/endtoend/testdata/json_build/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/json_build/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/json_param_type/issue.md b/internal/endtoend/testdata/json_param_type/issue.md new file mode 100644 index 0000000000..a04d7dab14 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/743 \ No newline at end of file diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_param_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..07bd3e462b --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2d57f3dd61 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const findByAddress = `-- name: FindByAddress :one +SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = $1 LIMIT 1 +` + +func (q *Queries) FindByAddress(ctx context.Context, metadata pgtype.Text) (User, error) { + row := q.db.QueryRow(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/postgresql/pgx/query.sql b/internal/endtoend/testdata/json_param_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..61da05b8ec --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: FindByAddress :one +SELECT * FROM "user" WHERE "metadata"->>'address1' = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..9d2499cf7c --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE "user" ( + "id" INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + "metadata" JSONB +); diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/json_param_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/json_param_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" \ No newline at end of file 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..91b6d74f4c --- /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.30.0 + +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..c73e37a1fa --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_tags/camel_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..b19a4d2547 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"firstName"` + LastName sql.NullString `json:"lastName"` + Age sql.NullInt16 `json:"age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/camel_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..45ed536eb2 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "camel" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_tags/camel_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..39d7af1488 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + FirstName pgtype.Text `json:"firstName"` + LastName pgtype.Text `json:"lastName"` + Age pgtype.Int2 `json:"age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/camel_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..9f8193e0ae --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/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_json_tags": true, + "json_tags_case_style": "camel" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_tags/camel_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..b19a4d2547 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"firstName"` + LastName sql.NullString `json:"lastName"` + Age sql.NullInt16 `json:"age"` +} 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 new file mode 100644 index 0000000000..3d8e6df6d4 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/camel_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..c83c1ec113 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "camel" + } + ] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_tags/pascal_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..e233ecddc1 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"FirstName"` + LastName sql.NullString `json:"LastName"` + Age sql.NullInt16 `json:"Age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/pascal_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..a0701ce8b4 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "pascal" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_tags/pascal_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..796a5df392 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + FirstName pgtype.Text `json:"FirstName"` + LastName pgtype.Text `json:"LastName"` + Age pgtype.Int2 `json:"Age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/pascal_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..43a61e223e --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/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_json_tags": true, + "json_tags_case_style": "pascal" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_tags/pascal_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..e233ecddc1 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"FirstName"` + LastName sql.NullString `json:"LastName"` + Age sql.NullInt16 `json:"Age"` +} 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 new file mode 100644 index 0000000000..3d8e6df6d4 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/pascal_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..55f529acba --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "pascal" + } + ] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_tags/snake_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4b2e4b0bda --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"first_name"` + LastName sql.NullString `json:"last_name"` + Age sql.NullInt16 `json:"age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/snake_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..813fde0b3d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "snake" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_tags/snake_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..e162102cc6 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + FirstName pgtype.Text `json:"first_name"` + LastName pgtype.Text `json:"last_name"` + Age pgtype.Int2 `json:"age"` +} 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 new file mode 100644 index 0000000000..6cd8cea48d --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/snake_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..d592761750 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/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_json_tags": true, + "json_tags_case_style": "snake" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_tags/snake_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4b2e4b0bda --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + FirstName sql.NullString `json:"first_name"` + LastName sql.NullString `json:"last_name"` + Age sql.NullInt16 `json:"age"` +} 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 new file mode 100644 index 0000000000..3d8e6df6d4 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.FirstName, &i.LastName, &i.Age); 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/json_tags/snake_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..4b2a25b8ec --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "snake" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..f3dde5226d --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type JobPostLocationType string + +const ( + JobPostLocationTypeRemote JobPostLocationType = "remote" + JobPostLocationTypeInOffice JobPostLocationType = "in_office" + JobPostLocationTypeHybrid JobPostLocationType = "hybrid" +) + +func (e *JobPostLocationType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = JobPostLocationType(s) + case string: + *e = JobPostLocationType(s) + default: + return fmt.Errorf("unsupported scan type for JobPostLocationType: %T", src) + } + return nil +} + +type NullJobPostLocationType struct { + JobPostLocationType JobPostLocationType `json:"jobPostLocationType"` + Valid bool `json:"valid"` // Valid is true if JobPostLocationType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullJobPostLocationType) Scan(value interface{}) error { + if value == nil { + ns.JobPostLocationType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.JobPostLocationType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullJobPostLocationType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.JobPostLocationType), nil +} + +type Author struct { + ID int64 `json:"id"` + Type NullJobPostLocationType `json:"type"` + Name string `json:"name"` + Bio sql.NullString `json:"bio"` +} 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 new file mode 100644 index 0000000000..56bf7b7aab --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, type, 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.Type, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..592b1925a5 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..b8f4852685 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "db", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "camel" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_tags_null_enum/none/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..d0b81a55dc --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type JobPostLocationType string + +const ( + JobPostLocationTypeRemote JobPostLocationType = "remote" + JobPostLocationTypeInOffice JobPostLocationType = "in_office" + JobPostLocationTypeHybrid JobPostLocationType = "hybrid" +) + +func (e *JobPostLocationType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = JobPostLocationType(s) + case string: + *e = JobPostLocationType(s) + default: + return fmt.Errorf("unsupported scan type for JobPostLocationType: %T", src) + } + return nil +} + +type NullJobPostLocationType struct { + JobPostLocationType JobPostLocationType `json:"job_post_location_type"` + Valid bool `json:"valid"` // Valid is true if JobPostLocationType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullJobPostLocationType) Scan(value interface{}) error { + if value == nil { + ns.JobPostLocationType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.JobPostLocationType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullJobPostLocationType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.JobPostLocationType), nil +} + +type Author struct { + ID int64 `json:"id"` + Type NullJobPostLocationType `json:"type"` + Name string `json:"name"` + Bio sql.NullString `json:"bio"` +} 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 new file mode 100644 index 0000000000..56bf7b7aab --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, type, 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.Type, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..592b1925a5 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..0736391022 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "db", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "none" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..09ebb453dc --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type JobPostLocationType string + +const ( + JobPostLocationTypeRemote JobPostLocationType = "remote" + JobPostLocationTypeInOffice JobPostLocationType = "in_office" + JobPostLocationTypeHybrid JobPostLocationType = "hybrid" +) + +func (e *JobPostLocationType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = JobPostLocationType(s) + case string: + *e = JobPostLocationType(s) + default: + return fmt.Errorf("unsupported scan type for JobPostLocationType: %T", src) + } + return nil +} + +type NullJobPostLocationType struct { + JobPostLocationType JobPostLocationType `json:"JobPostLocationType"` + Valid bool `json:"Valid"` // Valid is true if JobPostLocationType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullJobPostLocationType) Scan(value interface{}) error { + if value == nil { + ns.JobPostLocationType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.JobPostLocationType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullJobPostLocationType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.JobPostLocationType), nil +} + +type Author struct { + ID int64 `json:"ID"` + Type NullJobPostLocationType `json:"Type"` + Name string `json:"Name"` + Bio sql.NullString `json:"Bio"` +} 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 new file mode 100644 index 0000000000..56bf7b7aab --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, type, 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.Type, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..592b1925a5 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..59e3fcda3e --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "db", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "pascal" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..d0b81a55dc --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type JobPostLocationType string + +const ( + JobPostLocationTypeRemote JobPostLocationType = "remote" + JobPostLocationTypeInOffice JobPostLocationType = "in_office" + JobPostLocationTypeHybrid JobPostLocationType = "hybrid" +) + +func (e *JobPostLocationType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = JobPostLocationType(s) + case string: + *e = JobPostLocationType(s) + default: + return fmt.Errorf("unsupported scan type for JobPostLocationType: %T", src) + } + return nil +} + +type NullJobPostLocationType struct { + JobPostLocationType JobPostLocationType `json:"job_post_location_type"` + Valid bool `json:"valid"` // Valid is true if JobPostLocationType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullJobPostLocationType) Scan(value interface{}) error { + if value == nil { + ns.JobPostLocationType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.JobPostLocationType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullJobPostLocationType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.JobPostLocationType), nil +} + +type Author struct { + ID int64 `json:"id"` + Type NullJobPostLocationType `json:"type"` + Name string `json:"name"` + Bio sql.NullString `json:"bio"` +} 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 new file mode 100644 index 0000000000..56bf7b7aab --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, type, 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.Type, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..592b1925a5 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..4d30bb4ddd --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "db", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "json_tags_case_style": "snake" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_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 new file mode 100644 index 0000000000..d0b81a55dc --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type JobPostLocationType string + +const ( + JobPostLocationTypeRemote JobPostLocationType = "remote" + JobPostLocationTypeInOffice JobPostLocationType = "in_office" + JobPostLocationTypeHybrid JobPostLocationType = "hybrid" +) + +func (e *JobPostLocationType) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = JobPostLocationType(s) + case string: + *e = JobPostLocationType(s) + default: + return fmt.Errorf("unsupported scan type for JobPostLocationType: %T", src) + } + return nil +} + +type NullJobPostLocationType struct { + JobPostLocationType JobPostLocationType `json:"job_post_location_type"` + Valid bool `json:"valid"` // Valid is true if JobPostLocationType is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullJobPostLocationType) Scan(value interface{}) error { + if value == nil { + ns.JobPostLocationType, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.JobPostLocationType.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullJobPostLocationType) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.JobPostLocationType), nil +} + +type Author struct { + ID int64 `json:"id"` + Type NullJobPostLocationType `json:"type"` + Name string `json:"name"` + Bio sql.NullString `json:"bio"` +} 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 new file mode 100644 index 0000000000..56bf7b7aab --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, type, 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.Type, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..592b1925a5 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..e65ee32fa1 --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json @@ -0,0 +1,17 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "go", + "package": "db", + "emit_json_tags": true + } + } + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..5157c6524c --- /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.30.0 + +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..b26d65ae1c --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..3980b20cad --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "encoding/json" +) + +type Foo struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D 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..448182e3dd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "encoding/json" +) + +const insertFoo = `-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + ?1, + ?2, + ?3, + ?4 +) RETURNING a, json(b), c, json(d) +` + +type InsertFooParams struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D 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, + ) + return err +} + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, json(b), c, json(d) 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..6959bd1a70 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/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/sqlite/schema.sql b/internal/endtoend/testdata/jsonb/sqlite/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/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/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/go/db.go b/internal/endtoend/testdata/limit/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/limit/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/limit/go/models.go b/internal/endtoend/testdata/limit/go/models.go deleted file mode 100644 index c7700695cd..0000000000 --- a/internal/endtoend/testdata/limit/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar bool -} diff --git a/internal/endtoend/testdata/limit/go/query.sql.go b/internal/endtoend/testdata/limit/go/query.sql.go deleted file mode 100644 index 9904813c6b..0000000000 --- a/internal/endtoend/testdata/limit/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const limitMe = `-- name: LimitMe :many -SELECT bar FROM foo LIMIT $1 -` - -func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, limitMe, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var bar bool - 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/limit/mysql/go/db.go b/internal/endtoend/testdata/limit/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/limit/mysql/go/models.go b/internal/endtoend/testdata/limit/mysql/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5af60506f4 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/go/query.sql.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const limitMe = `-- name: LimitMe :exec +UPDATE foo SET bar='baz' LIMIT ? +` + +func (q *Queries) LimitMe(ctx context.Context, limit int32) error { + _, err := q.db.ExecContext(ctx, limitMe, limit) + return err +} + +const limitMeToo = `-- name: LimitMeToo :exec +DELETE FROM foo LIMIT ? +` + +func (q *Queries) LimitMeToo(ctx context.Context, limit int32) error { + _, err := q.db.ExecContext(ctx, limitMeToo, limit) + return err +} diff --git a/internal/endtoend/testdata/limit/mysql/query.sql b/internal/endtoend/testdata/limit/mysql/query.sql new file mode 100644 index 0000000000..44f8b7d2e7 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: LimitMe :exec +UPDATE foo SET bar='baz' LIMIT ?; + +-- name: LimitMeToo :exec +DELETE FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/limit/mysql/schema.sql b/internal/endtoend/testdata/limit/mysql/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/mysql/sqlc.json b/internal/endtoend/testdata/limit/mysql/sqlc.json new file mode 100644 index 0000000000..6c2a9842c8 --- /dev/null +++ b/internal/endtoend/testdata/limit/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/limit/pgx/v4/exec.json b/internal/endtoend/testdata/limit/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/db.go b/internal/endtoend/testdata/limit/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/limit/pgx/v4/go/models.go b/internal/endtoend/testdata/limit/pgx/v4/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d40cf94a08 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const limitMe = `-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1 +` + +func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { + rows, err := q.db.Query(ctx, limitMe, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var bar bool + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/limit/pgx/v4/query.sql b/internal/endtoend/testdata/limit/pgx/v4/query.sql new file mode 100644 index 0000000000..a190c5bb10 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/pgx/v4/schema.sql b/internal/endtoend/testdata/limit/pgx/v4/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/pgx/v4/sqlc.json b/internal/endtoend/testdata/limit/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/limit/pgx/v5/exec.json b/internal/endtoend/testdata/limit/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/db.go b/internal/endtoend/testdata/limit/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/limit/pgx/v5/go/models.go b/internal/endtoend/testdata/limit/pgx/v5/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d40cf94a08 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const limitMe = `-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1 +` + +func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { + rows, err := q.db.Query(ctx, limitMe, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var bar bool + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/limit/pgx/v5/query.sql b/internal/endtoend/testdata/limit/pgx/v5/query.sql new file mode 100644 index 0000000000..a190c5bb10 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/pgx/v5/schema.sql b/internal/endtoend/testdata/limit/pgx/v5/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/pgx/v5/sqlc.json b/internal/endtoend/testdata/limit/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/limit/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/limit/query.sql b/internal/endtoend/testdata/limit/query.sql deleted file mode 100644 index 73ab623ad4..0000000000 --- a/internal/endtoend/testdata/limit/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null); - --- name: LimitMe :many -SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/sqlc.json b/internal/endtoend/testdata/limit/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/limit/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/limit/sqlite/go/db.go b/internal/endtoend/testdata/limit/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/limit/sqlite/go/models.go b/internal/endtoend/testdata/limit/sqlite/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3612dc12ef --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const limitMe = `-- name: LimitMe :many +SELECT bar FROM foo LIMIT ? +` + +func (q *Queries) LimitMe(ctx context.Context, limit int64) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, limitMe, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var bar bool + 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/limit/sqlite/query.sql b/internal/endtoend/testdata/limit/sqlite/query.sql new file mode 100644 index 0000000000..8514c9b476 --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: LimitMe :many +SELECT bar FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/limit/sqlite/schema.sql b/internal/endtoend/testdata/limit/sqlite/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/sqlite/sqlc.json b/internal/endtoend/testdata/limit/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/limit/stdlib/exec.json b/internal/endtoend/testdata/limit/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/stdlib/go/db.go b/internal/endtoend/testdata/limit/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/limit/stdlib/go/models.go b/internal/endtoend/testdata/limit/stdlib/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..ab53cad1b7 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const limitMe = `-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1 +` + +func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, limitMe, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var bar bool + 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/limit/stdlib/query.sql b/internal/endtoend/testdata/limit/stdlib/query.sql new file mode 100644 index 0000000000..a190c5bb10 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: LimitMe :many +SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/stdlib/schema.sql b/internal/endtoend/testdata/limit/stdlib/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/stdlib/sqlc.json b/internal/endtoend/testdata/limit/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/lower/go/db.go b/internal/endtoend/testdata/lower/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/lower/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/lower/go/models.go b/internal/endtoend/testdata/lower/go/models.go deleted file mode 100644 index d90fb10d47..0000000000 --- a/internal/endtoend/testdata/lower/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar string - Bat string -} diff --git a/internal/endtoend/testdata/lower/go/query.sql.go b/internal/endtoend/testdata/lower/go/query.sql.go deleted file mode 100644 index 4fa4b26227..0000000000 --- a/internal/endtoend/testdata/lower/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const lower = `-- name: Lower :many -SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 -` - -type LowerParams struct { - Bar string - Bat string -} - -func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, lower, arg.Bar, arg.Bat) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var bar string - 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/lower/pgx/v4/go/db.go b/internal/endtoend/testdata/lower/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/lower/pgx/v4/go/models.go b/internal/endtoend/testdata/lower/pgx/v4/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2159e93436 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lower = `-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 +` + +type LowerParams struct { + Bar string + Bat string +} + +func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { + rows, err := q.db.Query(ctx, lower, arg.Bar, arg.Bat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/lower/pgx/v4/query.sql b/internal/endtoend/testdata/lower/pgx/v4/query.sql new file mode 100644 index 0000000000..5d7c35b728 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/pgx/v4/schema.sql b/internal/endtoend/testdata/lower/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/pgx/v4/sqlc.json b/internal/endtoend/testdata/lower/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/db.go b/internal/endtoend/testdata/lower/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/lower/pgx/v5/go/models.go b/internal/endtoend/testdata/lower/pgx/v5/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2159e93436 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lower = `-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 +` + +type LowerParams struct { + Bar string + Bat string +} + +func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { + rows, err := q.db.Query(ctx, lower, arg.Bar, arg.Bat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/lower/pgx/v5/query.sql b/internal/endtoend/testdata/lower/pgx/v5/query.sql new file mode 100644 index 0000000000..5d7c35b728 --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/pgx/v5/schema.sql b/internal/endtoend/testdata/lower/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/pgx/v5/sqlc.json b/internal/endtoend/testdata/lower/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/lower/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/lower/query.sql b/internal/endtoend/testdata/lower/query.sql deleted file mode 100644 index 4808f19817..0000000000 --- a/internal/endtoend/testdata/lower/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar text not null, bat text not null); - --- name: Lower :many -SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/sqlc.json b/internal/endtoend/testdata/lower/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/lower/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/lower/stdlib/go/db.go b/internal/endtoend/testdata/lower/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/lower/stdlib/go/models.go b/internal/endtoend/testdata/lower/stdlib/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3bedc86ba3 --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lower = `-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 +` + +type LowerParams struct { + Bar string + Bat string +} + +func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { + rows, err := q.db.QueryContext(ctx, lower, arg.Bar, arg.Bat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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/lower/stdlib/query.sql b/internal/endtoend/testdata/lower/stdlib/query.sql new file mode 100644 index 0000000000..5d7c35b728 --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Lower :many +SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/stdlib/schema.sql b/internal/endtoend/testdata/lower/stdlib/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/stdlib/sqlc.json b/internal/endtoend/testdata/lower/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/lower_switched_order/go/db.go b/internal/endtoend/testdata/lower_switched_order/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/lower_switched_order/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/lower_switched_order/go/models.go b/internal/endtoend/testdata/lower_switched_order/go/models.go deleted file mode 100644 index d90fb10d47..0000000000 --- a/internal/endtoend/testdata/lower_switched_order/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar string - Bat string -} diff --git a/internal/endtoend/testdata/lower_switched_order/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/go/query.sql.go deleted file mode 100644 index a0e3acf02a..0000000000 --- a/internal/endtoend/testdata/lower_switched_order/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many -SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) -` - -type LowerSwitchedOrderParams struct { - Bar string - Lower string -} - -func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var bar string - 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/lower_switched_order/pgx/v4/go/db.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/lower_switched_order/pgx/v4/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..bd5949f23b --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) +` + +type LowerSwitchedOrderParams struct { + Bar string + Lower string +} + +func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { + rows, err := q.db.Query(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql new file mode 100644 index 0000000000..f4a9b8339a --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json b/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/lower_switched_order/pgx/v5/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..bd5949f23b --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) +` + +type LowerSwitchedOrderParams struct { + Bar string + Lower string +} + +func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { + rows, err := q.db.Query(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql new file mode 100644 index 0000000000..f4a9b8339a --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json b/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/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/lower_switched_order/query.sql b/internal/endtoend/testdata/lower_switched_order/query.sql deleted file mode 100644 index 791ac10dc9..0000000000 --- a/internal/endtoend/testdata/lower_switched_order/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar text not null, bat text not null); - --- name: LowerSwitchedOrder :many -SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/sqlc.json b/internal/endtoend/testdata/lower_switched_order/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/lower_switched_order/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/lower_switched_order/stdlib/go/models.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go new file mode 100644 index 0000000000..061b030b06 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..79959a216a --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) +` + +type LowerSwitchedOrderParams struct { + Bar string + Lower string +} + +func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { + rows, err := q.db.QueryContext(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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/lower_switched_order/stdlib/query.sql b/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql new file mode 100644 index 0000000000..f4a9b8339a --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: LowerSwitchedOrder :many +SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql b/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json b/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/macaddr/go/db.go b/internal/endtoend/testdata/macaddr/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/macaddr/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/macaddr/go/models.go b/internal/endtoend/testdata/macaddr/go/models.go deleted file mode 100644 index 0681470ceb..0000000000 --- a/internal/endtoend/testdata/macaddr/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "net" -) - -type Foo struct { - Bar bool - Addr net.HardwareAddr -} diff --git a/internal/endtoend/testdata/macaddr/go/query.sql.go b/internal/endtoend/testdata/macaddr/go/query.sql.go deleted file mode 100644 index ce14bdd56d..0000000000 --- a/internal/endtoend/testdata/macaddr/go/query.sql.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "net" -) - -const get = `-- name: Get :many -SELECT bar, addr FROM foo LIMIT $1 -` - -func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, get, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.Bar, &i.Addr); 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 getAddr = `-- name: GetAddr :many -SELECT addr FROM foo LIMIT $1 -` - -func (q *Queries) GetAddr(ctx context.Context, limit int32) ([]net.HardwareAddr, error) { - rows, err := q.db.QueryContext(ctx, getAddr, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []net.HardwareAddr - for rows.Next() { - var addr net.HardwareAddr - if err := rows.Scan(&addr); err != nil { - return nil, err - } - items = append(items, addr) - } - 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/macaddr/query.sql b/internal/endtoend/testdata/macaddr/query.sql deleted file mode 100644 index 4b0fa2203e..0000000000 --- a/internal/endtoend/testdata/macaddr/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE foo (bar bool not null, addr macaddr not null); - --- name: Get :many -SELECT bar, addr FROM foo LIMIT $1; - --- name: GetAddr :many -SELECT addr FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/macaddr/sqlc.json b/internal/endtoend/testdata/macaddr/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/macaddr/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/materialized_views/go/db.go b/internal/endtoend/testdata/materialized_views/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/materialized_views/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/materialized_views/go/models.go b/internal/endtoend/testdata/materialized_views/go/models.go deleted file mode 100644 index 41ff924fa5..0000000000 --- a/internal/endtoend/testdata/materialized_views/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Author struct { - ID int64 - Name string - Bio sql.NullString - Gender sql.NullInt32 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/materialized_views/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..6399c72cfb --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Gender sql.NullInt32 +} + +type AuthorsName struct { + Name string +} 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 new file mode 100644 index 0000000000..23244b5220 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(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, + &i.Gender, + ); 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/materialized_views/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..86636e2655 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/materialized_views/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..c5fd0c2555 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text + Gender pgtype.Int4 +} + +type AuthorsName struct { + Name string +} 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 new file mode 100644 index 0000000000..23244b5220 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(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, + &i.Gender, + ); 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/materialized_views/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..86636e2655 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/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/materialized_views/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/materialized_views/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..6399c72cfb --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Gender sql.NullInt32 +} + +type AuthorsName struct { + Name string +} 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 new file mode 100644 index 0000000000..b177d0f16c --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +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, + &i.Gender, + ); 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/materialized_views/postgresql/stdlib/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..86636e2655 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/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/materialized_views/query.sql b/internal/endtoend/testdata/materialized_views/query.sql deleted file mode 100644 index f14191f894..0000000000 --- a/internal/endtoend/testdata/materialized_views/query.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio TEXT -); - -ALTER TABLE authors ADD COLUMN gender INTEGER NULL; - -CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; - -SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/sqlc.json b/internal/endtoend/testdata/materialized_views/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/materialized_views/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/mathmatical_operator/go/db.go b/internal/endtoend/testdata/mathmatical_operator/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/mathmatical_operator/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/mathmatical_operator/go/models.go b/internal/endtoend/testdata/mathmatical_operator/go/models.go deleted file mode 100644 index ca9cda8055..0000000000 --- a/internal/endtoend/testdata/mathmatical_operator/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Num int32 -} diff --git a/internal/endtoend/testdata/mathmatical_operator/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/go/query.sql.go deleted file mode 100644 index 65975c6b00..0000000000 --- a/internal/endtoend/testdata/mathmatical_operator/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const math = `-- name: Math :many -SELECT num, num / 1024 as division FROM foo -` - -type MathRow struct { - Num int32 - Division int32 -} - -func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { - rows, err := q.db.QueryContext(ctx, math) - if err != nil { - return nil, err - } - defer rows.Close() - var items []MathRow - for rows.Next() { - var i MathRow - if err := rows.Scan(&i.Num, &i.Division); 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/mathmatical_operator/pgx/v4/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/mathmatical_operator/pgx/v4/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go new file mode 100644 index 0000000000..8a66a8cf24 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c3215c16c3 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const math = `-- name: Math :many +SELECT num, num / 1024 as division FROM foo +` + +type MathRow struct { + Num int32 + Division int32 +} + +func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { + rows, err := q.db.Query(ctx, math) + if err != nil { + return nil, err + } + defer rows.Close() + var items []MathRow + for rows.Next() { + var i MathRow + if err := rows.Scan(&i.Num, &i.Division); 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/mathmatical_operator/pgx/v4/query.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql new file mode 100644 index 0000000000..a3655a3db6 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Math :many +SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/mathmatical_operator/pgx/v5/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go new file mode 100644 index 0000000000..8a66a8cf24 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c3215c16c3 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const math = `-- name: Math :many +SELECT num, num / 1024 as division FROM foo +` + +type MathRow struct { + Num int32 + Division int32 +} + +func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { + rows, err := q.db.Query(ctx, math) + if err != nil { + return nil, err + } + defer rows.Close() + var items []MathRow + for rows.Next() { + var i MathRow + if err := rows.Scan(&i.Num, &i.Division); 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/mathmatical_operator/pgx/v5/query.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql new file mode 100644 index 0000000000..a3655a3db6 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Math :many +SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/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/mathmatical_operator/query.sql b/internal/endtoend/testdata/mathmatical_operator/query.sql deleted file mode 100644 index 2ec3121d2a..0000000000 --- a/internal/endtoend/testdata/mathmatical_operator/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (num integer not null); - --- name: Math :many -SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/mathmatical_operator/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mathmatical_operator/stdlib/go/models.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go new file mode 100644 index 0000000000..8a66a8cf24 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..22bc5eedce --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const math = `-- name: Math :many +SELECT num, num / 1024 as division FROM foo +` + +type MathRow struct { + Num int32 + Division int32 +} + +func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { + rows, err := q.db.QueryContext(ctx, math) + if err != nil { + return nil, err + } + defer rows.Close() + var items []MathRow + for rows.Next() { + var i MathRow + if err := rows.Scan(&i.Num, &i.Division); 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/mathmatical_operator/stdlib/query.sql b/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql new file mode 100644 index 0000000000..a3655a3db6 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Math :many +SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql b/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..6e9823127b --- /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.30.0 + +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..5366bac847 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/missing_semicolon/mysql/go/models.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go new file mode 100644 index 0000000000..ec1cb8d670 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go new file mode 100644 index 0000000000..eec817e3eb --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const setAuthor = `-- name: SetAuthor :exec +UPDATE authors +SET name = ? +WHERE id = ? +` + +type SetAuthorParams struct { + Name string + ID int32 +} + +func (q *Queries) SetAuthor(ctx context.Context, arg SetAuthorParams) error { + _, err := q.db.ExecContext(ctx, setAuthor, arg.Name, arg.ID) + return err +} diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/query.sql b/internal/endtoend/testdata/missing_semicolon/mysql/query.sql new file mode 100644 index 0000000000..47500d575e --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/query.sql @@ -0,0 +1,4 @@ +-- name: SetAuthor :exec +UPDATE authors +SET name = ? +WHERE id = ? diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql b/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql new file mode 100644 index 0000000000..4c11a9c067 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql @@ -0,0 +1,7 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1198 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json b/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/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/missing_semicolon/pgx/v4/query.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql new file mode 100644 index 0000000000..80c83545ce --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: FirstQuery :many +SELECT * FROM foo; + +-- name: SecondQuery :many +SELECT * FROM foo WHERE email = $1 diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql new file mode 100644 index 0000000000..e2b1d89074 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json b/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt b/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt new file mode 100644 index 0000000000..7544904cf6 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql new file mode 100644 index 0000000000..80c83545ce --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: FirstQuery :many +SELECT * FROM foo; + +-- name: SecondQuery :many +SELECT * FROM foo WHERE email = $1 diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql new file mode 100644 index 0000000000..28f5b2d13e --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json b/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/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/missing_semicolon/pgx/v5/stderr.txt b/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt new file mode 100644 index 0000000000..7544904cf6 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/query.sql b/internal/endtoend/testdata/missing_semicolon/query.sql deleted file mode 100644 index cdd62d5ad7..0000000000 --- a/internal/endtoend/testdata/missing_semicolon/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE foo (email text not null); - --- name: FirstQuery :many -SELECT * FROM foo; - --- name: SecondQuery :many -SELECT * FROM foo WHERE email = $1 diff --git a/internal/endtoend/testdata/missing_semicolon/sqlc.json b/internal/endtoend/testdata/missing_semicolon/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/missing_semicolon/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/missing_semicolon/stderr.txt b/internal/endtoend/testdata/missing_semicolon/stderr.txt deleted file mode 100644 index 5cd2f160b8..0000000000 --- a/internal/endtoend/testdata/missing_semicolon/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:7:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql b/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql new file mode 100644 index 0000000000..80c83545ce --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: FirstQuery :many +SELECT * FROM foo; + +-- name: SecondQuery :many +SELECT * FROM foo WHERE email = $1 diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql b/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql new file mode 100644 index 0000000000..28f5b2d13e --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json b/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt b/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt new file mode 100644 index 0000000000..7544904cf6 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/db.go b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mix_param_types/mysql/go/models.go b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go new file mode 100644 index 0000000000..ec9de5f49c --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID uint64 + Name string + Phone 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 new file mode 100644 index 0000000000..5b7a32b9bd --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: test.sql + +package querytest + +import ( + "context" +) + +const countOne = `-- name: CountOne :one +SELECT count(1) FROM bar WHERE id = ? AND name <> ? +` + +type CountOneParams struct { + ID uint64 + Name string +} + +func (q *Queries) CountOne(ctx context.Context, arg CountOneParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countOne, arg.ID, arg.Name) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countThree = `-- name: CountThree :one +SELECT count(1) FROM bar WHERE id > ? AND phone <> ? AND name <> ? +` + +type CountThreeParams struct { + ID uint64 + Phone string + Name string +} + +func (q *Queries) CountThree(ctx context.Context, arg CountThreeParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countThree, arg.ID, arg.Phone, arg.Name) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countTwo = `-- name: CountTwo :one +SELECT count(1) FROM bar WHERE id = ? AND name <> ? +` + +type CountTwoParams struct { + ID uint64 + Name string +} + +func (q *Queries) CountTwo(ctx context.Context, arg CountTwoParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countTwo, arg.ID, arg.Name) + var count int64 + err := row.Scan(&count) + return count, err +} 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 new file mode 100644 index 0000000000..3e8d09d00d --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "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 new file mode 100644 index 0000000000..e23f1dcb70 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/test.sql @@ -0,0 +1,8 @@ +-- name: CountOne :one +SELECT count(1) FROM bar WHERE id = sqlc.arg(id) AND name <> ?; + +-- name: CountTwo :one +SELECT count(1) FROM bar WHERE id = ? AND name <> sqlc.arg(name); + +-- name: CountThree :one +SELECT count(1) FROM bar WHERE id > ? AND phone <> sqlc.arg(phone) AND name <> ?; diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/exec.json b/internal/endtoend/testdata/mix_param_types/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/mix_param_types/postgresql/go/models.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go new file mode 100644 index 0000000000..2f0803b319 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 + Name string + Phone 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 new file mode 100644 index 0000000000..be9a12710b --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: test.sql + +package querytest + +import ( + "context" +) + +const countOne = `-- name: CountOne :one +SELECT count(1) FROM bar WHERE id = $2 AND name <> $1 LIMIT $3 +` + +type CountOneParams struct { + Name string + ID int32 + Limit int32 +} + +func (q *Queries) CountOne(ctx context.Context, arg CountOneParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countOne, arg.Name, arg.ID, arg.Limit) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countThree = `-- name: CountThree :one +SELECT count(1) FROM bar WHERE id > $2 AND phone <> $3 AND name <> $1 +` + +type CountThreeParams struct { + Name string + ID int32 + Phone string +} + +func (q *Queries) CountThree(ctx context.Context, arg CountThreeParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countThree, arg.Name, arg.ID, arg.Phone) + var count int64 + err := row.Scan(&count) + return count, err +} + +const countTwo = `-- name: CountTwo :one +SELECT count(1) FROM bar WHERE id = $1 AND name <> $2 +` + +type CountTwoParams struct { + ID int32 + Name string +} + +func (q *Queries) CountTwo(ctx context.Context, arg CountTwoParams) (int64, error) { + row := q.db.QueryRowContext(ctx, countTwo, arg.ID, arg.Name) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql b/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql new file mode 100644 index 0000000000..9e554c159e --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id serial not null, + name text not null, + phone text not null +); \ No newline at end of file diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json b/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json new file mode 100644 index 0000000000..2bb3f0dcff --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "test.sql", + "engine": "postgresql" + } + ] +} diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/test.sql b/internal/endtoend/testdata/mix_param_types/postgresql/test.sql new file mode 100644 index 0000000000..6811d1f136 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/test.sql @@ -0,0 +1,8 @@ +-- name: CountOne :one +SELECT count(1) FROM bar WHERE id = sqlc.arg(id) AND name <> $1 LIMIT sqlc.arg('limit'); + +-- name: CountTwo :one +SELECT count(1) FROM bar WHERE id = $1 AND name <> sqlc.arg(name); + +-- name: CountThree :one +SELECT count(1) FROM bar WHERE id > $2 AND phone <> sqlc.arg(phone) AND name <> $1; diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/multidimension_array/pgx/v4/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go new file mode 100644 index 0000000000..8c3cca3813 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..62e96a3e2f --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { + rows, err := q.db.Query(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][][]string + for rows.Next() { + var tags [][]string + if err := rows.Scan(&tags); err != nil { + return nil, err + } + items = append(items, tags) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql b/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql b/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json b/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/multidimension_array/pgx/v5/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go new file mode 100644 index 0000000000..8c3cca3813 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..62e96a3e2f --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { + rows, err := q.db.Query(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][][]string + for rows.Next() { + var tags [][]string + if err := rows.Scan(&tags); err != nil { + return nil, err + } + items = append(items, tags) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql b/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql b/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json b/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json new file mode 100644 index 0000000000..d5f0a3ddb1 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/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" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/multidimension_array/stdlib/go/models.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go new file mode 100644 index 0000000000..8c3cca3813 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..67d3ebc82e --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/lib/pq" +) + +const textArray = `-- name: TextArray :many +SELECT tags FROM bar +` + +func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { + rows, err := q.db.QueryContext(ctx, textArray) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][][]string + for rows.Next() { + var tags [][]string + if err := rows.Scan(pq.Array(&tags)); err != nil { + return nil, err + } + items = append(items, tags) + } + 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/multidimension_array/stdlib/query.sql b/internal/endtoend/testdata/multidimension_array/stdlib/query.sql new file mode 100644 index 0000000000..4c6b35329a --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: TextArray :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql b/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json b/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/multischema/go/db.go b/internal/endtoend/testdata/multischema/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/multischema/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/multischema/go/models.go b/internal/endtoend/testdata/multischema/go/models.go deleted file mode 100644 index 99f581177b..0000000000 --- a/internal/endtoend/testdata/multischema/go/models.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - ID int32 -} - -type Foo struct { - ID int32 - Bar sql.NullInt32 -} diff --git a/internal/endtoend/testdata/multischema/go/query.sql.go b/internal/endtoend/testdata/multischema/go/query.sql.go deleted file mode 100644 index 9c5abd9822..0000000000 --- a/internal/endtoend/testdata/multischema/go/query.sql.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listBar = `-- name: ListBar :many -SELECT id FROM 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 listFoo = `-- name: ListFoo :many -SELECT id, bar FROM foo -` - -func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.ID, &i.Bar); 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/multischema/pgx/v4/go/db.go b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/multischema/pgx/v4/go/models.go b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go new file mode 100644 index 0000000000..8594c6e575 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar sql.NullInt32 +} diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..ed5475c882 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id, bar FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ID, &i.Bar); 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/multischema/pgx/v4/query.sql b/internal/endtoend/testdata/multischema/pgx/v4/query.sql new file mode 100644 index 0000000000..926eec234b --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/query.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/sql/ignore.txt b/internal/endtoend/testdata/multischema/pgx/v4/sql/ignore.txt similarity index 100% rename from internal/endtoend/testdata/multischema/sql/ignore.txt rename to internal/endtoend/testdata/multischema/pgx/v4/sql/ignore.txt diff --git a/internal/endtoend/testdata/multischema/pgx/v4/sql/query.sql b/internal/endtoend/testdata/multischema/pgx/v4/sql/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/sql/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/multischema/pgx/v4/sqlc.json b/internal/endtoend/testdata/multischema/pgx/v4/sqlc.json new file mode 100644 index 0000000000..5f9f40e7ed --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v4/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": [ + "query.sql", + "sql" + ], + "queries": [ + "query.sql", + "sql" + ] + } + ] +} diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/multischema/pgx/v5/go/models.go b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go new file mode 100644 index 0000000000..c7e5e6a8d0 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar pgtype.Int4 +} diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..ed5475c882 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM bar +` + +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id, bar FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ID, &i.Bar); 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/multischema/pgx/v5/query.sql b/internal/endtoend/testdata/multischema/pgx/v5/query.sql new file mode 100644 index 0000000000..926eec234b --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/query.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/pgx/v5/sql/ignore.txt b/internal/endtoend/testdata/multischema/pgx/v5/sql/ignore.txt new file mode 100644 index 0000000000..f4c35ce580 --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/sql/ignore.txt @@ -0,0 +1,3 @@ +Hello! + +This file should be ignored diff --git a/internal/endtoend/testdata/multischema/pgx/v5/sql/query.sql b/internal/endtoend/testdata/multischema/pgx/v5/sql/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/sql/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/multischema/pgx/v5/sqlc.json b/internal/endtoend/testdata/multischema/pgx/v5/sqlc.json new file mode 100644 index 0000000000..28fc49bfac --- /dev/null +++ b/internal/endtoend/testdata/multischema/pgx/v5/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": [ + "query.sql", + "sql" + ], + "queries": [ + "query.sql", + "sql" + ] + } + ] +} diff --git a/internal/endtoend/testdata/multischema/query.sql b/internal/endtoend/testdata/multischema/query.sql deleted file mode 100644 index 10ea52a108..0000000000 --- a/internal/endtoend/testdata/multischema/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); - --- name: ListBar :many -SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/stdlib/go/db.go b/internal/endtoend/testdata/multischema/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/multischema/stdlib/go/models.go b/internal/endtoend/testdata/multischema/stdlib/go/models.go new file mode 100644 index 0000000000..8594c6e575 --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 +} + +type Foo struct { + ID int32 + Bar sql.NullInt32 +} diff --git a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go new file mode 100644 index 0000000000..3d3efab77e --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM 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 listFoo = `-- name: ListFoo :many +SELECT id, bar FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.ID, &i.Bar); 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/multischema/stdlib/query.sql b/internal/endtoend/testdata/multischema/stdlib/query.sql new file mode 100644 index 0000000000..926eec234b --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/query.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + +-- name: ListBar :many +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/stdlib/sql/ignore.txt b/internal/endtoend/testdata/multischema/stdlib/sql/ignore.txt new file mode 100644 index 0000000000..f4c35ce580 --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/sql/ignore.txt @@ -0,0 +1,3 @@ +Hello! + +This file should be ignored diff --git a/internal/endtoend/testdata/multischema/stdlib/sql/query.sql b/internal/endtoend/testdata/multischema/stdlib/sql/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/multischema/stdlib/sql/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/multischema/sqlc.json b/internal/endtoend/testdata/multischema/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/multischema/sqlc.json rename to internal/endtoend/testdata/multischema/stdlib/sqlc.json 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..2db334d743 --- /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.30.0 + +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..2b59679ee3 --- /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.30.0 +// 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_reference_manual/README.md b/internal/endtoend/testdata/mysql_reference_manual/README.md new file mode 100644 index 0000000000..95a4cbfc24 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/README.md @@ -0,0 +1,2 @@ +All queries and examples in this directory come from the [MySQL Reference +Manual](https://dev.mysql.com/doc/refman/8.0/en/). 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 new file mode 100644 index 0000000000..ddfc73984f --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package aggregate_functions + +import ( + "context" + "database/sql" +) + +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 +} + +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_reference_manual/aggregate_functions/go/group_concat.sql.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go new file mode 100644 index 0000000000..9e1e338714 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: group_concat.sql + +package aggregate_functions + +import ( + "context" + "database/sql" +) + +const groupConcat = `-- name: GroupConcat :many +SELECT student_name, GROUP_CONCAT(test_score) +FROM student +GROUP BY student_name +` + +type GroupConcatRow struct { + StudentName sql.NullString + GroupConcat sql.NullString +} + +func (q *Queries) GroupConcat(ctx context.Context) ([]GroupConcatRow, error) { + rows, err := q.db.QueryContext(ctx, groupConcat) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupConcatRow + for rows.Next() { + var i GroupConcatRow + if err := rows.Scan(&i.StudentName, &i.GroupConcat); 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 groupConcatOrderBy = `-- name: GroupConcatOrderBy :many +SELECT student_name, + GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ') +FROM student +GROUP BY student_name +` + +type GroupConcatOrderByRow struct { + StudentName sql.NullString + GroupConcat sql.NullString +} + +func (q *Queries) GroupConcatOrderBy(ctx context.Context) ([]GroupConcatOrderByRow, error) { + rows, err := q.db.QueryContext(ctx, groupConcatOrderBy) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupConcatOrderByRow + for rows.Next() { + var i GroupConcatOrderByRow + if err := rows.Scan(&i.StudentName, &i.GroupConcat); 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_reference_manual/aggregate_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go new file mode 100644 index 0000000000..06e67d8176 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package aggregate_functions + +import ( + "database/sql" +) + +type Student struct { + StudentName sql.NullString + 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 new file mode 100644 index 0000000000..443253851d --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql @@ -0,0 +1,10 @@ +-- name: GroupConcat :many +SELECT student_name, GROUP_CONCAT(test_score) +FROM student +GROUP BY student_name; + +-- name: GroupConcatOrderBy :many +SELECT student_name, + GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ') +FROM student +GROUP BY student_name; diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_add.sql b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_add.sql new file mode 100644 index 0000000000..299f20d80d --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_add.sql @@ -0,0 +1,24 @@ +-- https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add + +-- name: DateAddOneDay :one +SELECT DATE_ADD('2018-05-01',INTERVAL 1 DAY); + +-- name: DateAddOneSecond :one +SELECT DATE_ADD('2020-12-31 23:59:59', + INTERVAL 1 SECOND); + +-- name: DateAddTimestampOneSecond :one +SELECT DATE_ADD('2018-12-31 23:59:59', + INTERVAL 1 DAY); + +-- name: DateAddMinuteSecond :one +SELECT DATE_ADD('2100-12-31 23:59:59', + INTERVAL '1:1' MINUTE_SECOND); + +-- name: DateAddDayHour :one +SELECT DATE_ADD('1900-01-01 00:00:00', + INTERVAL '-1 10' DAY_HOUR); + +-- name: DateAddSecondMicrosecond :one +SELECT DATE_ADD('1992-12-31 23:59:59.000002', + INTERVAL '1.999999' SECOND_MICROSECOND); diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_sub.sql b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_sub.sql new file mode 100644 index 0000000000..0e1af3f38b --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/date_sub.sql @@ -0,0 +1,9 @@ +-- name: DateSubOneYear :one +SELECT DATE_SUB('2018-05-01',INTERVAL 1 YEAR); + +-- name: DateSubDaySecond :one +SELECT DATE_SUB('2025-01-01 00:00:00', + INTERVAL '1 1:1:1' DAY_SECOND); + +-- name: DateSub31Days :one +SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY); 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 new file mode 100644 index 0000000000..9bc096b936 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go @@ -0,0 +1,84 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: date_add.sql + +package date_and_time_functions + +import ( + "context" + "time" +) + +const dateAddDayHour = `-- name: DateAddDayHour :one +SELECT DATE_ADD('1900-01-01 00:00:00', + INTERVAL '-1 10' DAY_HOUR) +` + +func (q *Queries) DateAddDayHour(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddDayHour) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} + +const dateAddMinuteSecond = `-- name: DateAddMinuteSecond :one +SELECT DATE_ADD('2100-12-31 23:59:59', + INTERVAL '1:1' MINUTE_SECOND) +` + +func (q *Queries) DateAddMinuteSecond(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddMinuteSecond) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} + +const dateAddOneDay = `-- name: DateAddOneDay :one + +SELECT DATE_ADD('2018-05-01',INTERVAL 1 DAY) +` + +// https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add +func (q *Queries) DateAddOneDay(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddOneDay) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} + +const dateAddOneSecond = `-- name: DateAddOneSecond :one +SELECT DATE_ADD('2020-12-31 23:59:59', + INTERVAL 1 SECOND) +` + +func (q *Queries) DateAddOneSecond(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddOneSecond) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} + +const dateAddSecondMicrosecond = `-- name: DateAddSecondMicrosecond :one +SELECT DATE_ADD('1992-12-31 23:59:59.000002', + INTERVAL '1.999999' SECOND_MICROSECOND) +` + +func (q *Queries) DateAddSecondMicrosecond(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddSecondMicrosecond) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} + +const dateAddTimestampOneSecond = `-- name: DateAddTimestampOneSecond :one +SELECT DATE_ADD('2018-12-31 23:59:59', + INTERVAL 1 DAY) +` + +func (q *Queries) DateAddTimestampOneSecond(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateAddTimestampOneSecond) + var date_add time.Time + err := row.Scan(&date_add) + return date_add, err +} 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 new file mode 100644 index 0000000000..377778fa75 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: date_sub.sql + +package date_and_time_functions + +import ( + "context" + "time" +) + +const dateSub31Days = `-- name: DateSub31Days :one +SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY) +` + +func (q *Queries) DateSub31Days(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateSub31Days) + var date_sub time.Time + err := row.Scan(&date_sub) + return date_sub, err +} + +const dateSubDaySecond = `-- name: DateSubDaySecond :one +SELECT DATE_SUB('2025-01-01 00:00:00', + INTERVAL '1 1:1:1' DAY_SECOND) +` + +func (q *Queries) DateSubDaySecond(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateSubDaySecond) + var date_sub time.Time + err := row.Scan(&date_sub) + return date_sub, err +} + +const dateSubOneYear = `-- name: DateSubOneYear :one +SELECT DATE_SUB('2018-05-01',INTERVAL 1 YEAR) +` + +func (q *Queries) DateSubOneYear(ctx context.Context) (time.Time, error) { + row := q.db.QueryRowContext(ctx, dateSubOneYear) + var date_sub time.Time + err := row.Scan(&date_sub) + return date_sub, err +} 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 new file mode 100644 index 0000000000..9606d2d4af --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package date_and_time_functions + +import ( + "context" + "database/sql" +) + +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 +} + +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_reference_manual/date_and_time_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go new file mode 100644 index 0000000000..9cda7d328c --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package date_and_time_functions + +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 new file mode 100644 index 0000000000..71c8ff5aa8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "packages": [ + { + "name": "date_and_time_functions", + "path": "date_and_time_functions/go", + "schema": "schema.sql", + "queries": "date_and_time_functions", + "engine": "mysql" + }, + { + "name": "aggregate_functions", + "path": "aggregate_functions/go", + "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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..d0a2f2e91d --- /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.30.0 + +package querytest + +type Foo struct { + ID int32 + Embedding interface{} +} 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..8ac54a83c4 --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/named_param/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/named_param/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/named_param/go/models.go b/internal/endtoend/testdata/named_param/go/models.go deleted file mode 100644 index 36b40a056b..0000000000 --- a/internal/endtoend/testdata/named_param/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Name string - Bio string -} diff --git a/internal/endtoend/testdata/named_param/go/query.sql.go b/internal/endtoend/testdata/named_param/go/query.sql.go deleted file mode 100644 index 6092e23930..0000000000 --- a/internal/endtoend/testdata/named_param/go/query.sql.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const atParams = `-- name: AtParams :many -SELECT name FROM foo WHERE name = $1 AND $2::bool -` - -type AtParamsParams struct { - Slug string - Filter bool -} - -func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, atParams, arg.Slug, arg.Filter) - 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 funcParams = `-- name: FuncParams :many -SELECT name FROM foo WHERE name = $1 AND $2::bool -` - -type FuncParamsParams struct { - Slug string - Filter bool -} - -func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParams, arg.Slug, arg.Filter) - 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 insertAtParams = `-- name: InsertAtParams :one -INSERT INTO foo(name, bio) values ($1, $2) returning name -` - -type InsertAtParamsParams struct { - Name string - Bio string -} - -func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertAtParams, arg.Name, arg.Bio) - var name string - err := row.Scan(&name) - return name, err -} - -const insertFuncParams = `-- name: InsertFuncParams :one -INSERT INTO foo(name, bio) values ($1, $2) returning name -` - -type InsertFuncParamsParams struct { - Name string - Bio string -} - -func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertFuncParams, arg.Name, arg.Bio) - var name string - err := row.Scan(&name) - return name, err -} - -const update = `-- name: Update :one -UPDATE foo -SET - name = CASE WHEN $1::bool - THEN $2::text - ELSE name - END -RETURNING name, bio -` - -type UpdateParams struct { - SetName bool - Name string -} - -func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { - row := q.db.QueryRowContext(ctx, update, arg.SetName, arg.Name) - var i Foo - err := row.Scan(&i.Name, &i.Bio) - return i, err -} diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/db.go b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/named_param/pgx/v4/go/models.go b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go new file mode 100644 index 0000000000..7d01ec0654 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..a6e9fe3018 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go @@ -0,0 +1,122 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const atParams = `-- name: AtParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type AtParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { + rows, err := q.db.Query(ctx, atParams, arg.Slug, arg.Filter) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const funcParams = `-- name: FuncParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type FuncParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParams, arg.Slug, arg.Filter) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertAtParams = `-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertAtParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { + row := q.db.QueryRow(ctx, insertAtParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const insertFuncParams = `-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertFuncParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { + row := q.db.QueryRow(ctx, insertFuncParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const update = `-- name: Update :one +UPDATE foo +SET + name = CASE WHEN $1::bool + THEN $2::text + ELSE name + END +RETURNING name, bio +` + +type UpdateParams struct { + SetName bool + Name string +} + +func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { + row := q.db.QueryRow(ctx, update, arg.SetName, arg.Name) + var i Foo + err := row.Scan(&i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/named_param/pgx/v4/query.sql b/internal/endtoend/testdata/named_param/pgx/v4/query.sql new file mode 100644 index 0000000000..9a2c906b98 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/query.sql @@ -0,0 +1,21 @@ +-- name: FuncParams :many +SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; + +-- name: AtParams :many +SELECT name FROM foo WHERE name = @slug AND @filter::bool; + +-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values (sqlc.arg('name'), sqlc.arg('bio')) returning name; + +-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values (@name, @bio) returning name; + + +-- name: Update :one +UPDATE foo +SET + name = CASE WHEN @set_name::bool + THEN @name::text + ELSE name + END +RETURNING *; diff --git a/internal/endtoend/testdata/named_param/pgx/v4/schema.sql b/internal/endtoend/testdata/named_param/pgx/v4/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json b/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/db.go b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/named_param/pgx/v5/go/models.go b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go new file mode 100644 index 0000000000..7d01ec0654 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..a6e9fe3018 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go @@ -0,0 +1,122 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const atParams = `-- name: AtParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type AtParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { + rows, err := q.db.Query(ctx, atParams, arg.Slug, arg.Filter) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const funcParams = `-- name: FuncParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type FuncParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParams, arg.Slug, arg.Filter) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertAtParams = `-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertAtParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { + row := q.db.QueryRow(ctx, insertAtParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const insertFuncParams = `-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertFuncParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { + row := q.db.QueryRow(ctx, insertFuncParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const update = `-- name: Update :one +UPDATE foo +SET + name = CASE WHEN $1::bool + THEN $2::text + ELSE name + END +RETURNING name, bio +` + +type UpdateParams struct { + SetName bool + Name string +} + +func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { + row := q.db.QueryRow(ctx, update, arg.SetName, arg.Name) + var i Foo + err := row.Scan(&i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/named_param/pgx/v5/query.sql b/internal/endtoend/testdata/named_param/pgx/v5/query.sql new file mode 100644 index 0000000000..9a2c906b98 --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/query.sql @@ -0,0 +1,21 @@ +-- name: FuncParams :many +SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; + +-- name: AtParams :many +SELECT name FROM foo WHERE name = @slug AND @filter::bool; + +-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values (sqlc.arg('name'), sqlc.arg('bio')) returning name; + +-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values (@name, @bio) returning name; + + +-- name: Update :one +UPDATE foo +SET + name = CASE WHEN @set_name::bool + THEN @name::text + ELSE name + END +RETURNING *; diff --git a/internal/endtoend/testdata/named_param/pgx/v5/schema.sql b/internal/endtoend/testdata/named_param/pgx/v5/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json b/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/named_param/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/named_param/query.sql b/internal/endtoend/testdata/named_param/query.sql deleted file mode 100644 index ae58c40879..0000000000 --- a/internal/endtoend/testdata/named_param/query.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE foo (name text not null, bio text not null); - --- name: FuncParams :many -SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; - --- name: AtParams :many -SELECT name FROM foo WHERE name = @slug AND @filter::bool; - --- name: InsertFuncParams :one -INSERT INTO foo(name, bio) values (sqlc.arg('name'), sqlc.arg('bio')) returning name; - --- name: InsertAtParams :one -INSERT INTO foo(name, bio) values (@name, @bio) returning name; - - --- name: Update :one -UPDATE foo -SET - name = CASE WHEN @set_name::bool - THEN @name::text - ELSE name - END -RETURNING *; diff --git a/internal/endtoend/testdata/named_param/sqlc.json b/internal/endtoend/testdata/named_param/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/named_param/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/named_param/sqlite/go/db.go b/internal/endtoend/testdata/named_param/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/named_param/sqlite/go/models.go b/internal/endtoend/testdata/named_param/sqlite/go/models.go new file mode 100644 index 0000000000..7d01ec0654 --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f08b57bc1d --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go @@ -0,0 +1,96 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const atParams = `-- name: AtParams :many +SELECT name FROM foo WHERE name = ?1 +` + +func (q *Queries) AtParams(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, atParams, slug) + 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 funcParams = `-- name: FuncParams :many +SELECT name FROM foo WHERE name = ?1 +` + +func (q *Queries) FuncParams(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParams, slug) + 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 insertAtParams = `-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values (?1, ?2) returning name +` + +type InsertAtParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { + row := q.db.QueryRowContext(ctx, insertAtParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const insertFuncParams = `-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values (?1, ?2) returning name +` + +type InsertFuncParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { + row := q.db.QueryRowContext(ctx, insertFuncParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} diff --git a/internal/endtoend/testdata/named_param/sqlite/query.sql b/internal/endtoend/testdata/named_param/sqlite/query.sql new file mode 100644 index 0000000000..7e19464c4f --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/query.sql @@ -0,0 +1,11 @@ +-- name: FuncParams :many +SELECT name FROM foo WHERE name = sqlc.arg('slug'); + +-- name: AtParams :many +SELECT name FROM foo WHERE name = @slug; + +-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values (sqlc.arg('name'), sqlc.arg('bio')) returning name; + +-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values (@name, @bio) returning name; diff --git a/internal/endtoend/testdata/named_param/sqlite/schema.sql b/internal/endtoend/testdata/named_param/sqlite/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/sqlite/sqlc.json b/internal/endtoend/testdata/named_param/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/named_param/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/named_param/stdlib/go/db.go b/internal/endtoend/testdata/named_param/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/named_param/stdlib/go/models.go b/internal/endtoend/testdata/named_param/stdlib/go/models.go new file mode 100644 index 0000000000..7d01ec0654 --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..0d66297a35 --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const atParams = `-- name: AtParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type AtParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { + rows, err := q.db.QueryContext(ctx, atParams, arg.Slug, arg.Filter) + 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 funcParams = `-- name: FuncParams :many +SELECT name FROM foo WHERE name = $1 AND $2::bool +` + +type FuncParamsParams struct { + Slug string + Filter bool +} + +func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParams, arg.Slug, arg.Filter) + 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 insertAtParams = `-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertAtParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { + row := q.db.QueryRowContext(ctx, insertAtParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const insertFuncParams = `-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values ($1, $2) returning name +` + +type InsertFuncParamsParams struct { + Name string + Bio string +} + +func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { + row := q.db.QueryRowContext(ctx, insertFuncParams, arg.Name, arg.Bio) + var name string + err := row.Scan(&name) + return name, err +} + +const update = `-- name: Update :one +UPDATE foo +SET + name = CASE WHEN $1::bool + THEN $2::text + ELSE name + END +RETURNING name, bio +` + +type UpdateParams struct { + SetName bool + Name string +} + +func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { + row := q.db.QueryRowContext(ctx, update, arg.SetName, arg.Name) + var i Foo + err := row.Scan(&i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/named_param/stdlib/query.sql b/internal/endtoend/testdata/named_param/stdlib/query.sql new file mode 100644 index 0000000000..9a2c906b98 --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/query.sql @@ -0,0 +1,21 @@ +-- name: FuncParams :many +SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; + +-- name: AtParams :many +SELECT name FROM foo WHERE name = @slug AND @filter::bool; + +-- name: InsertFuncParams :one +INSERT INTO foo(name, bio) values (sqlc.arg('name'), sqlc.arg('bio')) returning name; + +-- name: InsertAtParams :one +INSERT INTO foo(name, bio) values (@name, @bio) returning name; + + +-- name: Update :one +UPDATE foo +SET + name = CASE WHEN @set_name::bool + THEN @name::text + ELSE name + END +RETURNING *; diff --git a/internal/endtoend/testdata/named_param/stdlib/schema.sql b/internal/endtoend/testdata/named_param/stdlib/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/stdlib/sqlc.json b/internal/endtoend/testdata/named_param/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/nested_select/issue.md b/internal/endtoend/testdata/nested_select/issue.md new file mode 100644 index 0000000000..2c10d6d8fe --- /dev/null +++ b/internal/endtoend/testdata/nested_select/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/708 diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json b/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/nested_select/postgresql/pgx/go/models.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..b3f22ae1ba --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Test struct { + ID int64 + UpdateTime int64 + Count 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 new file mode 100644 index 0000000000..06698dbad4 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const nestedSelect = `-- name: NestedSelect :one +SELECT latest.id, t.count +FROM ( + SELECT id, max(update_time) AS update_time + FROM test + WHERE id = ANY ($1::bigint[]) + -- ERROR HERE on update_time + AND update_time >= $2 + GROUP BY id +) latest +INNER JOIN test t USING (id, update_time) +` + +type NestedSelectParams struct { + IDs []int64 + StartTime pgtype.Int8 +} + +type NestedSelectRow struct { + ID int64 + Count int64 +} + +func (q *Queries) NestedSelect(ctx context.Context, arg NestedSelectParams) (NestedSelectRow, error) { + row := q.db.QueryRow(ctx, nestedSelect, arg.IDs, arg.StartTime) + var i NestedSelectRow + err := row.Scan(&i.ID, &i.Count) + return i, err +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql b/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql new file mode 100644 index 0000000000..755521fa4a --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql @@ -0,0 +1,11 @@ +-- name: NestedSelect :one +SELECT latest.id, t.count +FROM ( + SELECT id, max(update_time) AS update_time + FROM test + WHERE id = ANY (sqlc.arg('IDs')::bigint[]) + -- ERROR HERE on update_time + AND update_time >= sqlc.arg('StartTime') + GROUP BY id +) latest +INNER JOIN test t USING (id, update_time); diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql b/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..02f5f8203c --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE test ( + id bigint NOT NULL, + update_time bigint NOT NULL, + count bigint NOT NULL +); diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/nested_select/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..2f12715923 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/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/nextval/postgresql/go/db.go b/internal/endtoend/testdata/nextval/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/nextval/postgresql/go/models.go b/internal/endtoend/testdata/nextval/postgresql/go/models.go new file mode 100644 index 0000000000..c48d0a0de2 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..6ea5eba838 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getNextID = `-- name: GetNextID :one +SELECT pk, pk FROM + (SELECT nextval('authors_id_seq') as pk) AS alias +` + +type GetNextIDRow struct { + Pk int64 + Pk_2 int64 +} + +func (q *Queries) GetNextID(ctx context.Context) (GetNextIDRow, error) { + row := q.db.QueryRowContext(ctx, getNextID) + var i GetNextIDRow + err := row.Scan(&i.Pk, &i.Pk_2) + return i, err +} diff --git a/internal/endtoend/testdata/nextval/postgresql/query.sql b/internal/endtoend/testdata/nextval/postgresql/query.sql new file mode 100644 index 0000000000..606ac1eb0a --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/query.sql @@ -0,0 +1,4 @@ +-- name: GetNextID :one +SELECT pk, pk FROM + (SELECT nextval('authors_id_seq') as pk) AS alias; + diff --git a/internal/endtoend/testdata/nextval/postgresql/schema.sql b/internal/endtoend/testdata/nextval/postgresql/schema.sql new file mode 100644 index 0000000000..2ab37c05c5 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/schema.sql @@ -0,0 +1,5 @@ +-- Simple table +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/nextval/postgresql/sqlc.json b/internal/endtoend/testdata/nextval/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/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/notifylisten/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/notifylisten/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..c2f9fa6a26 --- /dev/null +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listenTest = `-- name: ListenTest :exec +LISTEN test +` + +func (q *Queries) ListenTest(ctx context.Context) error { + _, err := q.db.Exec(ctx, listenTest) + return err +} + +const notifyTest = `-- name: NotifyTest :exec +NOTIFY test +` + +func (q *Queries) NotifyTest(ctx context.Context) error { + _, err := q.db.Exec(ctx, notifyTest) + return err +} + +const notifyWithMessage = `-- name: NotifyWithMessage :exec +NOTIFY test, 'msg' +` + +func (q *Queries) NotifyWithMessage(ctx context.Context) error { + _, err := q.db.Exec(ctx, notifyWithMessage) + return err +} diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..721da0aa1b --- /dev/null +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: NotifyTest :exec +NOTIFY test; + +-- name: NotifyWithMessage :exec +NOTIFY test, 'msg'; + +-- name: ListenTest :exec +LISTEN test; diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/notifylisten/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/null_if_type/issue.md b/internal/endtoend/testdata/null_if_type/issue.md new file mode 100644 index 0000000000..c83cc42660 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/133 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/null_if_type/postgresql/pganalyzer/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go new file mode 100644 index 0000000000..8074a524af --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +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 new file mode 100644 index 0000000000..4256706b67 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getRestrictedId = `-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author +` + +func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (int64, error) { + row := q.db.QueryRowContext(ctx, getRestrictedId, id) + var restricted_id int64 + err := row.Scan(&restricted_id) + return restricted_id, err +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql new file mode 100644 index 0000000000..fc800b4f6d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql @@ -0,0 +1,5 @@ +-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author; diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql new file mode 100644 index 0000000000..c1afecad09 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE author ( + id bigserial NOT NULL +); diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json new file mode 100644 index 0000000000..a682c52d42 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/null_if_type/postgresql/stdlib/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go new file mode 100644 index 0000000000..8074a524af --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +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 new file mode 100644 index 0000000000..f22d8f38bf --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getRestrictedId = `-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author +` + +func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (bool, error) { + row := q.db.QueryRowContext(ctx, getRestrictedId, id) + var restricted_id bool + err := row.Scan(&restricted_id) + return restricted_id, err +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..fc800b4f6d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author; diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c1afecad09 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE author ( + id bigserial NOT NULL +); diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..a682c52d42 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/db/db.go b/internal/endtoend/testdata/omit_sqlc_version/db/db.go similarity index 100% rename from internal/endtoend/testdata/data_type_boolean/postgresql/db/db.go rename to internal/endtoend/testdata/omit_sqlc_version/db/db.go 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_unused_structs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4f415e7078 --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go @@ -0,0 +1,325 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql/driver" + "fmt" +) + +type ArrayEnum string + +const ( + ArrayEnumO ArrayEnum = "o" + ArrayEnumP ArrayEnum = "p" +) + +func (e *ArrayEnum) Scan(src interface{}) 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 interface{}) 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 ( + QueryParamEnumTableEnumG QueryParamEnumTableEnum = "g" + QueryParamEnumTableEnumH QueryParamEnumTableEnum = "h" +) + +func (e *QueryParamEnumTableEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QueryParamEnumTableEnum(s) + case string: + *e = QueryParamEnumTableEnum(s) + default: + return fmt.Errorf("unsupported scan type for QueryParamEnumTableEnum: %T", src) + } + return nil +} + +type NullQueryParamEnumTableEnum struct { + QueryParamEnumTableEnum QueryParamEnumTableEnum + Valid bool // Valid is true if QueryParamEnumTableEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQueryParamEnumTableEnum) Scan(value interface{}) error { + if value == nil { + ns.QueryParamEnumTableEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QueryParamEnumTableEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQueryParamEnumTableEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QueryParamEnumTableEnum), nil +} + +type QueryParamStructEnumTableEnum string + +const ( + QueryParamStructEnumTableEnumI QueryParamStructEnumTableEnum = "i" + QueryParamStructEnumTableEnumJ QueryParamStructEnumTableEnum = "j" +) + +func (e *QueryParamStructEnumTableEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QueryParamStructEnumTableEnum(s) + case string: + *e = QueryParamStructEnumTableEnum(s) + default: + return fmt.Errorf("unsupported scan type for QueryParamStructEnumTableEnum: %T", src) + } + return nil +} + +type NullQueryParamStructEnumTableEnum struct { + QueryParamStructEnumTableEnum QueryParamStructEnumTableEnum + Valid bool // Valid is true if QueryParamStructEnumTableEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQueryParamStructEnumTableEnum) Scan(value interface{}) error { + if value == nil { + ns.QueryParamStructEnumTableEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QueryParamStructEnumTableEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQueryParamStructEnumTableEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QueryParamStructEnumTableEnum), nil +} + +type QueryReturnEnumTableEnum string + +const ( + QueryReturnEnumTableEnumK QueryReturnEnumTableEnum = "k" + QueryReturnEnumTableEnumL QueryReturnEnumTableEnum = "l" +) + +func (e *QueryReturnEnumTableEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QueryReturnEnumTableEnum(s) + case string: + *e = QueryReturnEnumTableEnum(s) + default: + return fmt.Errorf("unsupported scan type for QueryReturnEnumTableEnum: %T", src) + } + return nil +} + +type NullQueryReturnEnumTableEnum struct { + QueryReturnEnumTableEnum QueryReturnEnumTableEnum + Valid bool // Valid is true if QueryReturnEnumTableEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQueryReturnEnumTableEnum) Scan(value interface{}) error { + if value == nil { + ns.QueryReturnEnumTableEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QueryReturnEnumTableEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQueryReturnEnumTableEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QueryReturnEnumTableEnum), nil +} + +type QueryReturnFullTableEnum string + +const ( + QueryReturnFullTableEnumE QueryReturnFullTableEnum = "e" + QueryReturnFullTableEnumF QueryReturnFullTableEnum = "f" +) + +func (e *QueryReturnFullTableEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QueryReturnFullTableEnum(s) + case string: + *e = QueryReturnFullTableEnum(s) + default: + return fmt.Errorf("unsupported scan type for QueryReturnFullTableEnum: %T", src) + } + return nil +} + +type NullQueryReturnFullTableEnum struct { + QueryReturnFullTableEnum QueryReturnFullTableEnum + Valid bool // Valid is true if QueryReturnFullTableEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQueryReturnFullTableEnum) Scan(value interface{}) error { + if value == nil { + ns.QueryReturnFullTableEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QueryReturnFullTableEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQueryReturnFullTableEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QueryReturnFullTableEnum), nil +} + +type QueryReturnStructEnumTableEnum string + +const ( + QueryReturnStructEnumTableEnumK QueryReturnStructEnumTableEnum = "k" + QueryReturnStructEnumTableEnumL QueryReturnStructEnumTableEnum = "l" +) + +func (e *QueryReturnStructEnumTableEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QueryReturnStructEnumTableEnum(s) + case string: + *e = QueryReturnStructEnumTableEnum(s) + default: + return fmt.Errorf("unsupported scan type for QueryReturnStructEnumTableEnum: %T", src) + } + return nil +} + +type NullQueryReturnStructEnumTableEnum struct { + QueryReturnStructEnumTableEnum QueryReturnStructEnumTableEnum + Valid bool // Valid is true if QueryReturnStructEnumTableEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQueryReturnStructEnumTableEnum) Scan(value interface{}) error { + if value == nil { + ns.QueryReturnStructEnumTableEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QueryReturnStructEnumTableEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQueryReturnStructEnumTableEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QueryReturnStructEnumTableEnum), nil +} + +type QuerySqlcEmbedEnum string + +const ( + QuerySqlcEmbedEnumM QuerySqlcEmbedEnum = "m" + QuerySqlcEmbedEnumN QuerySqlcEmbedEnum = "n" +) + +func (e *QuerySqlcEmbedEnum) Scan(src interface{}) 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 interface{}) 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 + Value NullQueryParamEnumTableEnum +} + +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 new file mode 100644 index 0000000000..ac93669dd0 --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,136 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +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 +` + +func (q *Queries) query_param_enum_table(ctx context.Context, value NullQueryParamEnumTableEnum) (QueryParamEnumTable, error) { + row := q.db.QueryRowContext(ctx, query_param_enum_table, value) + var i QueryParamEnumTable + err := row.Scan(&i.ID, &i.Other, &i.Value) + return i, err +} + +const query_param_struct_enum_table = `-- name: query_param_struct_enum_table :one +SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2 +` + +type query_param_struct_enum_tableParams struct { + ID int32 + Value NullQueryParamStructEnumTableEnum +} + +func (q *Queries) query_param_struct_enum_table(ctx context.Context, arg query_param_struct_enum_tableParams) (int32, error) { + row := q.db.QueryRowContext(ctx, query_param_struct_enum_table, arg.ID, arg.Value) + var id int32 + err := row.Scan(&id) + return id, err +} + +const query_return_enum_table = `-- name: query_return_enum_table :one +SELECT value FROM query_return_enum_table WHERE id = $1 +` + +func (q *Queries) query_return_enum_table(ctx context.Context, id int32) (NullQueryReturnEnumTableEnum, error) { + row := q.db.QueryRowContext(ctx, query_return_enum_table, id) + var value NullQueryReturnEnumTableEnum + err := row.Scan(&value) + return value, err +} + +const query_return_full_table = `-- name: query_return_full_table :many +SELECT id, value FROM query_return_full_table +` + +func (q *Queries) query_return_full_table(ctx context.Context) ([]QueryReturnFullTable, error) { + rows, err := q.db.QueryContext(ctx, query_return_full_table) + if err != nil { + return nil, err + } + defer rows.Close() + var items []QueryReturnFullTable + for rows.Next() { + var i QueryReturnFullTable + if err := rows.Scan(&i.ID, &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_return_struct_enum_table = `-- name: query_return_struct_enum_table :one +SELECT value, another FROM query_return_struct_enum_table WHERE id = $1 +` + +type query_return_struct_enum_tableRow struct { + Value NullQueryReturnStructEnumTableEnum + Another sql.NullInt32 +} + +func (q *Queries) query_return_struct_enum_table(ctx context.Context, id int32) (query_return_struct_enum_tableRow, error) { + row := q.db.QueryRowContext(ctx, query_return_struct_enum_table, id) + var i query_return_struct_enum_tableRow + 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 new file mode 100644 index 0000000000..60104c8e9d --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql @@ -0,0 +1,20 @@ +-- name: query_return_full_table :many +SELECT * FROM query_return_full_table; + +-- name: query_param_enum_table :one +SELECT * FROM query_param_enum_table WHERE value = $1; + +-- name: query_param_struct_enum_table :one +SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2; + +-- name: query_return_enum_table :one +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; + +-- 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 new file mode 100644 index 0000000000..4ce59218b6 --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql @@ -0,0 +1,69 @@ +CREATE TYPE unused_enum AS ENUM ( + 'a', 'b' +); + +CREATE TYPE unused_table_enum AS ENUM ( + 'c', 'd' +); +CREATE TABLE unused_table ( + id INTEGER PRIMARY KEY, + value unused_table_enum +); + +CREATE TYPE query_return_full_table_enum AS ENUM ( + 'e', 'f' +); +CREATE TABLE query_return_full_table ( + id INTEGER PRIMARY KEY, + value query_return_full_table_enum +); + +CREATE TYPE query_param_enum_table_enum AS ENUM ( + 'g', 'h' +); +CREATE TABLE query_param_enum_table ( + id INTEGER PRIMARY KEY, + other query_param_enum_table_enum NOT NULL, + value query_param_enum_table_enum +); + +CREATE TYPE query_param_struct_enum_table_enum AS ENUM ( + 'i', 'j' +); +CREATE TABLE query_param_struct_enum_table ( + id INTEGER PRIMARY KEY, + value query_param_struct_enum_table_enum +); + +CREATE TYPE query_return_enum_table_enum AS ENUM ( + 'k', 'l' +); +CREATE TABLE query_return_enum_table ( + id INTEGER PRIMARY KEY, + value query_return_enum_table_enum +); + +CREATE TYPE query_return_struct_enum_table_enum AS ENUM ( + 'k', 'l' +); +CREATE TABLE query_return_struct_enum_table ( + id INTEGER PRIMARY KEY, + value query_return_struct_enum_table_enum, + another INTEGER +); + +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/omit_unused_structs/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..a48c4d4206 --- /dev/null +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "omit_unused_structs": true + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/on_duplicate_key_update/mysql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go new file mode 100644 index 0000000000..5041799d54 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..367c21685e --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const upsertAuthor = `-- name: UpsertAuthor :exec +INSERT INTO authors (name, bio) +VALUES (?, ?) +ON DUPLICATE KEY + UPDATE bio = ? +` + +type UpsertAuthorParams struct { + Name string + Bio sql.NullString + Bio_2 sql.NullString +} + +func (q *Queries) UpsertAuthor(ctx context.Context, arg UpsertAuthorParams) error { + _, err := q.db.ExecContext(ctx, upsertAuthor, arg.Name, arg.Bio, arg.Bio_2) + return err +} + +const upsertAuthorNamed = `-- name: UpsertAuthorNamed :exec +INSERT INTO authors (name, bio) +VALUES (?, ?) +ON DUPLICATE KEY + UPDATE bio = ? +` + +type UpsertAuthorNamedParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) UpsertAuthorNamed(ctx context.Context, arg UpsertAuthorNamedParams) error { + _, err := q.db.ExecContext(ctx, upsertAuthorNamed, arg.Name, arg.Bio, arg.Bio) + return err +} diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql b/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql new file mode 100644 index 0000000000..7c54c4377a --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql @@ -0,0 +1,11 @@ +-- name: UpsertAuthor :exec +INSERT INTO authors (name, bio) +VALUES (?, ?) +ON DUPLICATE KEY + UPDATE bio = ?; + +-- name: UpsertAuthorNamed :exec +INSERT INTO authors (name, bio) +VALUES (?, sqlc.arg(bio)) +ON DUPLICATE KEY + UPDATE bio = sqlc.arg(bio); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql b/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql new file mode 100644 index 0000000000..581ecfe16b --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json b/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json new file mode 100644 index 0000000000..df106217e2 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version":"1", + "packages":[ + { + "path":"db", + "engine":"mysql", + "schema":"schema.sql", + "queries":"query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/on_duplicate_key_update/postgresql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go new file mode 100644 index 0000000000..5041799d54 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..8fd1d5c050 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const upsertAuthor = `-- name: UpsertAuthor :exec +INSERT INTO authors (name, bio) +VALUES ($1, $2) +ON CONFLICT (name) DO UPDATE +SET bio = $2 +` + +type UpsertAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) UpsertAuthor(ctx context.Context, arg UpsertAuthorParams) error { + _, err := q.db.ExecContext(ctx, upsertAuthor, arg.Name, arg.Bio) + return err +} + +const upsertAuthorNamed = `-- name: UpsertAuthorNamed :exec +INSERT INTO authors (name, bio) +VALUES ($1, $2) +ON CONFLICT (name) DO UPDATE +SET bio = $2 +` + +type UpsertAuthorNamedParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) UpsertAuthorNamed(ctx context.Context, arg UpsertAuthorNamedParams) error { + _, err := q.db.ExecContext(ctx, upsertAuthorNamed, arg.Name, arg.Bio) + return err +} diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql new file mode 100644 index 0000000000..ad29e0e517 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql @@ -0,0 +1,11 @@ +-- name: UpsertAuthor :exec +INSERT INTO authors (name, bio) +VALUES ($1, $2) +ON CONFLICT (name) DO UPDATE +SET bio = $2; + +-- name: UpsertAuthorNamed :exec +INSERT INTO authors (name, bio) +VALUES ($1, sqlc.arg(bio)) +ON CONFLICT (name) DO UPDATE +SET bio = sqlc.arg(bio); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/schema.sql b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/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/on_duplicate_key_update/postgresql/sqlc.json b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json new file mode 100644 index 0000000000..58a7ee25ea --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version":"1", + "packages":[ + { + "path":"db", + "engine":"postgresql", + "schema":"schema.sql", + "queries":"query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/operator_string_concat/postgresql/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/go/models.go deleted file mode 100644 index 26e4b59bd0..0000000000 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Demo struct { - Txt string -} diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/go/query.sql.go deleted file mode 100644 index 09723227f6..0000000000 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/go/query.sql.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const test = `-- name: Test :one -select txt from Demo -where txt ~~ '%' || $1 || '%' -` - -func (q *Queries) Test(ctx context.Context, val string) (string, error) { - row := q.db.QueryRowContext(ctx, test, val) - var txt string - err := row.Scan(&txt) - return txt, err -} - -const test2 = `-- name: Test2 :one -select txt from Demo -where txt like '%' || $1 || '%' -` - -func (q *Queries) Test2(ctx context.Context, val sql.NullString) (string, error) { - row := q.db.QueryRowContext(ctx, test2, val) - var txt string - err := row.Scan(&txt) - return txt, err -} - -const test3 = `-- name: Test3 :one -select txt from Demo -where txt like concat('%', $1, '%') -` - -func (q *Queries) Test3(ctx context.Context, val interface{}) (string, error) { - row := q.db.QueryRowContext(ctx, test3, val) - var txt string - err := row.Scan(&txt) - return txt, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/operator_string_concat/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..fe6b295344 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..9888f6ea6e --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const test2 = `-- name: Test2 :one +select txt from Demo +where txt like '%' || $1::text || '%' +` + +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { + row := q.db.QueryRow(ctx, test2, val) + var txt string + err := row.Scan(&txt) + return txt, err +} + +const test3 = `-- name: Test3 :one +select txt from Demo +where txt like concat('%', $1::text, '%') +` + +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { + row := q.db.QueryRow(ctx, test3, val) + var txt string + err := row.Scan(&txt) + return txt, err +} diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3133d4c299 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql @@ -0,0 +1,7 @@ +-- name: Test2 :one +select * from Demo +where txt like '%' || sqlc.arg('val')::text || '%'; + +-- name: Test3 :one +select * from Demo +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/operator_string_concat/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..fe6b295344 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..9888f6ea6e --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const test2 = `-- name: Test2 :one +select txt from Demo +where txt like '%' || $1::text || '%' +` + +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { + row := q.db.QueryRow(ctx, test2, val) + var txt string + err := row.Scan(&txt) + return txt, err +} + +const test3 = `-- name: Test3 :one +select txt from Demo +where txt like concat('%', $1::text, '%') +` + +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { + row := q.db.QueryRow(ctx, test3, val) + var txt string + err := row.Scan(&txt) + return txt, err +} diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3133d4c299 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql @@ -0,0 +1,7 @@ +-- name: Test2 :one +select * from Demo +where txt like '%' || sqlc.arg('val')::text || '%'; + +-- name: Test3 :one +select * from Demo +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/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/operator_string_concat/postgresql/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/query.sql deleted file mode 100644 index 5b794bdf7e..0000000000 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/query.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE demo (txt text not null); - --- name: Test :one -select * from Demo -where txt ~~ '%' || sqlc.arg('val') || '%'; - --- name: Test2 :one -select * from Demo -where txt like '%' || sqlc.arg('val') || '%'; - --- name: Test3 :one -select * from Demo -where txt like concat('%', sqlc.arg('val'), '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/operator_string_concat/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..fe6b295344 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..666e58b093 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const test2 = `-- name: Test2 :one +select txt from Demo +where txt like '%' || $1::text || '%' +` + +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { + row := q.db.QueryRowContext(ctx, test2, val) + var txt string + err := row.Scan(&txt) + return txt, err +} + +const test3 = `-- name: Test3 :one +select txt from Demo +where txt like concat('%', $1::text, '%') +` + +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { + row := q.db.QueryRowContext(ctx, test3, val) + var txt string + err := row.Scan(&txt) + return txt, err +} diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3133d4c299 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql @@ -0,0 +1,7 @@ +-- name: Test2 :one +select * from Demo +where txt like '%' || sqlc.arg('val')::text || '%'; + +-- name: Test3 :one +select * from Demo +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/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/order_by_binds/mysql/go/db.go b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/order_by_binds/mysql/go/models.go b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..7163ee84fa --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +SELECT id, name, bio FROM authors +WHERE id > ? +ORDER BY CASE WHEN ? = 'name' THEN name END +` + +type ListAuthorsColumnSortParams struct { + MinID int64 + SortColumn interface{} +} + +func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + 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 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 > ? +ORDER BY name ASC +` + +func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + 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/order_by_binds/mysql/query.sql b/internal/endtoend/testdata/order_by_binds/mysql/query.sql new file mode 100644 index 0000000000..c43763c838 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/query.sql @@ -0,0 +1,13 @@ +-- name: ListAuthorsColumnSort :many +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) +ORDER BY name ASC; diff --git a/internal/endtoend/testdata/order_by_binds/mysql/schema.sql b/internal/endtoend/testdata/order_by_binds/mysql/schema.sql new file mode 100644 index 0000000000..c3dfc1bf35 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json b/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/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/order_by_binds/pganalyze/exec.json b/internal/endtoend/testdata/order_by_binds/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/order_by_binds/pganalyze/go/models.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..5c98fff301 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go @@ -0,0 +1,74 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +SELECT id, name, bio FROM authors +WHERE id > $1 +ORDER BY CASE WHEN $2 = 'name' THEN name END +` + +type ListAuthorsColumnSortParams struct { + MinID int64 + SortColumn sql.NullString +} + +func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + 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 +ORDER BY name ASC +` + +func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + 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/order_by_binds/pganalyze/query.sql b/internal/endtoend/testdata/order_by_binds/pganalyze/query.sql new file mode 100644 index 0000000000..e662d8f06a --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/query.sql @@ -0,0 +1,9 @@ +-- name: ListAuthorsColumnSort :many +SELECT * FROM authors +WHERE id > sqlc.arg(min_id) +ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; + +-- name: ListAuthorsNameSort :many +SELECT * FROM authors +WHERE id > sqlc.arg(min_id) +ORDER BY name ASC; diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql b/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql new file mode 100644 index 0000000000..f388f86c34 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/sqlc.json b/internal/endtoend/testdata/order_by_binds/pganalyze/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/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/order_by_binds/postgresql/exec.json b/internal/endtoend/testdata/order_by_binds/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/order_by_binds/postgresql/go/models.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..fcf89ac330 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +SELECT id, name, bio FROM authors +WHERE id > $1 +ORDER BY CASE WHEN $2 = 'name' THEN name END +` + +type ListAuthorsColumnSortParams struct { + MinID int64 + SortColumn interface{} +} + +func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + 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 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 +ORDER BY name ASC +` + +func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + 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/order_by_binds/postgresql/query.sql b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql new file mode 100644 index 0000000000..961d3f4e71 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql @@ -0,0 +1,13 @@ +-- name: ListAuthorsColumnSort :many +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) +ORDER BY name ASC; diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql b/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql new file mode 100644 index 0000000000..f388f86c34 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json b/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/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/order_by_non_existing_column/postgresql/query.sql b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql new file mode 100644 index 0000000000..ba81cfdbc5 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: ListAuthors :many +SELECT id FROM authors +ORDER BY adfadsf; \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql new file mode 100644 index 0000000000..acba948a66 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql @@ -0,0 +1,5 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id INT +); + diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml new file mode 100644 index 0000000000..9ae3fc0cae --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml @@ -0,0 +1,7 @@ +version: 1 +packages: + - path: "go" + name: "querytest" + engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt new file mode 100644 index 0000000000..5d9a674dc6 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..55cbb71463 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:10: column "adfadsf" does not exist diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/db.go b/internal/endtoend/testdata/order_by_union/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/order_by_union/mysql/go/models.go b/internal/endtoend/testdata/order_by_union/mysql/go/models.go new file mode 100644 index 0000000000..d0c134974d --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + Name string + Bio sql.NullString +} + +type Person struct { + FirstName string +} 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 new file mode 100644 index 0000000000..dc796d7d62 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthorsUnion = `-- name: ListAuthorsUnion :many +SELECT name as foo FROM authors +UNION +SELECT first_name as foo FROM people +ORDER BY foo +` + +func (q *Queries) ListAuthorsUnion(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsUnion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var foo string + if err := rows.Scan(&foo); err != nil { + return nil, err + } + items = append(items, foo) + } + 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/order_by_union/mysql/query.sql b/internal/endtoend/testdata/order_by_union/mysql/query.sql new file mode 100644 index 0000000000..bd034ef5d5 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: ListAuthorsUnion :many +SELECT name as foo FROM authors +UNION +SELECT first_name as foo FROM people +ORDER BY foo; diff --git a/internal/endtoend/testdata/order_by_union/mysql/schema.sql b/internal/endtoend/testdata/order_by_union/mysql/schema.sql new file mode 100644 index 0000000000..3cdb3a9eb3 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE authors ( + name text NOT NULL, + bio text +); + +CREATE TABLE people ( + first_name text NOT NULL +); + diff --git a/internal/endtoend/testdata/order_by_union/mysql/sqlc.json b/internal/endtoend/testdata/order_by_union/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/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/order_by_union/postgresql/go/db.go b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/order_by_union/postgresql/go/models.go b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go new file mode 100644 index 0000000000..18e0bf75dc --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Person struct { + FirstName string +} 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 new file mode 100644 index 0000000000..dc796d7d62 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthorsUnion = `-- name: ListAuthorsUnion :many +SELECT name as foo FROM authors +UNION +SELECT first_name as foo FROM people +ORDER BY foo +` + +func (q *Queries) ListAuthorsUnion(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsUnion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var foo string + if err := rows.Scan(&foo); err != nil { + return nil, err + } + items = append(items, foo) + } + 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/order_by_union/postgresql/query.sql b/internal/endtoend/testdata/order_by_union/postgresql/query.sql new file mode 100644 index 0000000000..bd034ef5d5 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: ListAuthorsUnion :many +SELECT name as foo FROM authors +UNION +SELECT first_name as foo FROM people +ORDER BY foo; diff --git a/internal/endtoend/testdata/order_by_union/postgresql/schema.sql b/internal/endtoend/testdata/order_by_union/postgresql/schema.sql new file mode 100644 index 0000000000..2d646fd23e --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE people ( + first_name text NOT NULL +); + diff --git a/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json b/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/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/output_file_names/pgx/v4/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go new file mode 100644 index 0000000000..a3d8e17818 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch_gen.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v4" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const usersB = `-- name: UsersB :batchmany +SELECT id FROM "user" +WHERE id = $1 +` + +type UsersBBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { + batch := &pgx.Batch{} + for _, a := range id { + vals := []interface{}{ + a, + } + batch.Queue(usersB, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &UsersBBatchResults{br, len(id), false} +} + +func (b *UsersBBatchResults) Query(f func(int, []int64, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []int64 + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return err + } + items = append(items, id) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *UsersBBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..9481f2fc5e --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom_gen.go + +package querytest + +import ( + "context" +) + +// iteratorForUsersC implements pgx.CopyFromSource. +type iteratorForUsersC struct { + rows []int64 + skippedFirstNextCall bool +} + +func (r *iteratorForUsersC) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForUsersC) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForUsersC) Err() error { + return nil +} + +func (q *Queries) UsersC(ctx context.Context, id []int64) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user"}, []string{"id"}, &iteratorForUsersC{rows: id}) +} 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 new file mode 100644 index 0000000000..8149ab98c1 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) + 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/output_file_names/pgx/v4/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..0fba399be7 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + User(ctx context.Context) ([]int64, error) + UsersB(ctx context.Context, id []int64) *UsersBBatchResults + UsersC(ctx context.Context, id []int64) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql b/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql new file mode 100644 index 0000000000..0b14d20ac6 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql @@ -0,0 +1,12 @@ +-- name: User :many +SELECT "user".* FROM "user"; + +-- name: UsersB :batchmany +SELECT * FROM "user" +WHERE id = $1; + +-- name: UsersC :copyfrom +INSERT INTO "user" +(id) +VALUES +($1); diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql b/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json b/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json new file mode 100644 index 0000000000..b92274a549 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true, + "output_batch_file_name": "batch_gen.go", + "output_db_file_name": "db_gen.go", + "output_models_file_name": "models_gen.go", + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_gen.go" + } + ] +} 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 new file mode 100644 index 0000000000..a59e22a66c --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch_gen.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const usersB = `-- name: UsersB :batchmany +SELECT id FROM "user" +WHERE id = $1 +` + +type UsersBBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { + batch := &pgx.Batch{} + for _, a := range id { + vals := []interface{}{ + a, + } + batch.Queue(usersB, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &UsersBBatchResults{br, len(id), false} +} + +func (b *UsersBBatchResults) Query(f func(int, []int64, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + var items []int64 + if b.closed { + if f != nil { + f(t, items, ErrBatchAlreadyClosed) + } + continue + } + err := func() error { + rows, err := b.br.Query() + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return err + } + items = append(items, id) + } + return rows.Err() + }() + if f != nil { + f(t, items, err) + } + } +} + +func (b *UsersBBatchResults) Close() error { + b.closed = true + return b.br.Close() +} 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 new file mode 100644 index 0000000000..9481f2fc5e --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom_gen.go + +package querytest + +import ( + "context" +) + +// iteratorForUsersC implements pgx.CopyFromSource. +type iteratorForUsersC struct { + rows []int64 + skippedFirstNextCall bool +} + +func (r *iteratorForUsersC) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForUsersC) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForUsersC) Err() error { + return nil +} + +func (q *Queries) UsersC(ctx context.Context, id []int64) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user"}, []string{"id"}, &iteratorForUsersC{rows: id}) +} 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 new file mode 100644 index 0000000000..32b197ce0c --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) + 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/output_file_names/pgx/v5/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..0fba399be7 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + User(ctx context.Context) ([]int64, error) + UsersB(ctx context.Context, id []int64) *UsersBBatchResults + UsersC(ctx context.Context, id []int64) (int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql b/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql new file mode 100644 index 0000000000..7d59a79cb6 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql @@ -0,0 +1,12 @@ +-- name: User :many +SELECT "user".* FROM "user"; + +-- name: UsersB :batchmany +SELECT * FROM "user" +WHERE id = $1; + +-- name: UsersC :copyfrom +INSERT INTO "user" +(id) +VALUES + ($1); diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql b/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json b/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json new file mode 100644 index 0000000000..958c87429c --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true, + "output_batch_file_name": "batch_gen.go", + "output_db_file_name": "db_gen.go", + "output_models_file_name": "models_gen.go", + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_gen.go" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_file_names/stdlib/go/models_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..8008c65e53 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + User(ctx context.Context) ([]int64, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..fc2d9b248e --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, user) + 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/output_file_names/stdlib/query.sql b/internal/endtoend/testdata/output_file_names/stdlib/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_file_names/stdlib/schema.sql b/internal/endtoend/testdata/output_file_names/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json b/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json new file mode 100644 index 0000000000..677f10a908 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true, + "output_db_file_name": "db_gen.go", + "output_models_file_name": "models_gen.go", + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_gen.go" + } + ] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/output_files_suffix/pgx/v4/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json b/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json new file mode 100644 index 0000000000..966fad6dc6 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/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", + "output_files_suffix": "_gen.go" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/output_files_suffix/pgx/v5/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json b/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json new file mode 100644 index 0000000000..9d64831b62 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/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", + "output_files_suffix": "_gen.go" + } + ] +} diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_files_suffix/stdlib/go/models.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fc2d9b248e --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, user) + 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/output_files_suffix/stdlib/query.sql b/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql b/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json b/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json new file mode 100644 index 0000000000..73ff897576 --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "output_files_suffix": "_gen.go" + } + ] +} diff --git a/internal/endtoend/testdata/overrides/mysql/go/db.go b/internal/endtoend/testdata/overrides/mysql/go/db.go index 6f21c94ed1..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/mysql/go/models.go b/internal/endtoend/testdata/overrides/mysql/go/models.go index 9b987955d3..e6ba74a5a0 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides/mysql/go/models.go @@ -1,9 +1,11 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override import ( - "github.com/kyleconroy/sqlc-testdata/pkg" + "github.com/sqlc-dev/sqlc-testdata/pkg" ) type Foo struct { 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..0faba2cde4 --- /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.30.0 +// 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/mysql/sqlc.json b/internal/endtoend/testdata/overrides/mysql/sqlc.json index 592fb072a0..5e0c8b6dc8 100644 --- a/internal/endtoend/testdata/overrides/mysql/sqlc.json +++ b/internal/endtoend/testdata/overrides/mysql/sqlc.json @@ -9,7 +9,7 @@ "queries": "query.sql", "overrides": [ { - "go_type": "github.com/kyleconroy/sqlc-testdata/pkg.CustomType", + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", "column": "foo.retyped" } ] diff --git a/internal/endtoend/testdata/overrides/postgresql/go/db.go b/internal/endtoend/testdata/overrides/postgresql/go/db.go deleted file mode 100644 index 6f21c94ed1..0000000000 --- a/internal/endtoend/testdata/overrides/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package override - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/overrides/postgresql/go/models.go deleted file mode 100644 index bf8ca8c54b..0000000000 --- a/internal/endtoend/testdata/overrides/postgresql/go/models.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package override - -import ( - "github.com/kyleconroy/sqlc-testdata/pkg" - "github.com/lib/pq" -) - -type Foo struct { - Other string - Total int64 - Tags []string - ByteSeq []byte - Retyped pkg.CustomType - Langs pq.StringArray -} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..d27a158d73 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..051e7672e0 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "github.com/lib/pq" + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped pkg.CustomType + Langs pq.StringArray +} 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..6d31e7480e --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/schema.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/overrides/postgresql/schema.sql rename to internal/endtoend/testdata/overrides/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..db76a9de4b --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "foo.retyped" + }, + { + "go_type": "github.com/lib/pq.StringArray", + "column": "foo.langs" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..a6e06f5d0e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "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 +} + +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/overrides/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..051e7672e0 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "github.com/lib/pq" + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped pkg.CustomType + Langs pq.StringArray +} 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..6d31e7480e --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..fc3a13e53d --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + tags text[] NOT NULL, + byte_seq bytea NOT NULL, + retyped text NOT NULL, + langs text[] +); diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..109d41a65e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "foo.retyped" + }, + { + "go_type": "github.com/lib/pq.StringArray", + "column": "foo.langs" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides/postgresql/query.sql b/internal/endtoend/testdata/overrides/postgresql/query.sql deleted file mode 100644 index e0ac49d1ec..0000000000 --- a/internal/endtoend/testdata/overrides/postgresql/query.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/sqlc.json b/internal/endtoend/testdata/overrides/postgresql/sqlc.json deleted file mode 100644 index d5793575bf..0000000000 --- a/internal/endtoend/testdata/overrides/postgresql/sqlc.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "override", - "engine": "postgresql", - "schema": "schema.sql", - "queries": "query.sql", - "overrides": [ - { - "go_type": "github.com/kyleconroy/sqlc-testdata/pkg.CustomType", - "column": "foo.retyped" - }, - { - "go_type": "github.com/lib/pq.StringArray", - "column": "foo.langs" - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..051e7672e0 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "github.com/lib/pq" + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped pkg.CustomType + Langs pq.StringArray +} 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..0faba2cde4 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..fc3a13e53d --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + tags text[] NOT NULL, + byte_seq bytea NOT NULL, + retyped text NOT NULL, + langs text[] +); diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..28e58c947b --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/sqlc.json @@ -0,0 +1,22 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "foo.retyped" + }, + { + "go_type": "github.com/lib/pq.StringArray", + "column": "foo.langs" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides/sqlite/go/db.go b/internal/endtoend/testdata/overrides/sqlite/go/db.go new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/overrides/sqlite/go/models.go new file mode 100644 index 0000000000..e6ba74a5a0 --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Foo struct { + Other string + Total int64 + Retyped pkg.CustomType +} 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..e528f151d9 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides/sqlite/schema.sql b/internal/endtoend/testdata/overrides/sqlite/schema.sql new file mode 100644 index 0000000000..c0c5fc47dc --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + retyped text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides/sqlite/sqlc.json b/internal/endtoend/testdata/overrides/sqlite/sqlc.json new file mode 100644 index 0000000000..3b22097653 --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/sqlc.json @@ -0,0 +1,18 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "foo.retyped" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..6c0b1c86b9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 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 new file mode 100644 index 0000000000..00b551ba76 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides_array/postgresql/pgx/v4/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go new file mode 100644 index 0000000000..c97fe5b642 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Tags []sql.NullInt64 +} 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 new file mode 100644 index 0000000000..0fdeaad6e5 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package query + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, tags 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, + &i.Tags, + ) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..3aaed50644 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "2", + "sql": [{ + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "sql_package": "pgx/v4", + "package": "query", + "out": "query", + "overrides": [{ + "column": "authors.tags", + "go_type": { + "type": "NullInt64", + "import": "database/sql", + "slice": true + } + }] + } + } + }] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..6c0b1c86b9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; 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 new file mode 100644 index 0000000000..fed4c7f269 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "context" + + "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 +} + +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/overrides_array/postgresql/pgx/v5/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go new file mode 100644 index 0000000000..876b5683f2 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "database/sql" + + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text + Tags []sql.NullInt64 +} 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 new file mode 100644 index 0000000000..0fdeaad6e5 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package query + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, tags 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, + &i.Tags, + ) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..f75e700228 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "2", + "sql": [{ + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "sql_package": "pgx/v5", + "package": "query", + "out": "query", + "overrides": [{ + "column": "authors.tags", + "go_type": { + "type": "NullInt64", + "import": "database/sql", + "slice": true + } + }] + } + } + }] + } \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..6c0b1c86b9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go new file mode 100644 index 0000000000..eaae6e5461 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "context" + "database/sql" +) + +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 +} + +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_array/postgresql/stdlib/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go new file mode 100644 index 0000000000..c97fe5b642 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package query + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Tags []sql.NullInt64 +} 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 new file mode 100644 index 0000000000..f6f04988a4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package query + +import ( + "context" + + "github.com/lib/pq" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, tags 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, + pq.Array(&i.Tags), + ) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..8b02b46700 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json @@ -0,0 +1,22 @@ +{ + "version": "2", + "sql": [{ + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "package": "query", + "out": "query", + "overrides": [{ + "column": "authors.tags", + "go_type": { + "type": "NullInt64", + "import": "database/sql", + "slice": true + } + }] + } + } + }] + } \ No newline at end of file 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..48fa1bcf32 --- /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.30.0 + +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..915a614950 --- /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.30.0 +// 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..48fa1bcf32 --- /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.30.0 + +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..915a614950 --- /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.30.0 +// 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..48fa1bcf32 --- /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.30.0 + +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..915a614950 --- /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.30.0 +// 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_go_struct_tags/invalid_tags/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/schema.sql new file mode 100644 index 0000000000..4d5233cc37 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE foo ( + other text NOT NULL, + tagged text NOT NULL +); + +CREATE TABLE bar ( + other text NOT NULL, + also_tagged text NOT NULL +); + +CREATE TABLE baz ( + other text NOT NULL, + also_tagged text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/sqlc.json new file mode 100644 index 0000000000..f3cb66e6ba --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/sqlc.json @@ -0,0 +1,22 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_struct_tag": "abc", + "column": "foo.tagged" + }, + { + "go_struct_tag": "a:b", + "column": "*.also_tagged" + } + ] + } + ] +} 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 new file mode 100644 index 0000000000..c6891c182b --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt @@ -0,0 +1,2 @@ +# 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 new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_go_struct_tags/mysql/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go new file mode 100644 index 0000000000..b7b7849db3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +type Bar struct { + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` +} + +type Baz struct { + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` +} + +type Foo struct { + 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..0faba2cde4 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql @@ -0,0 +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 new file mode 100644 index 0000000000..5c9ce85545 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql @@ -0,0 +1,15 @@ +CREATE TABLE foo ( + other text NOT NULL, + tagged text NOT NULL, + nulltext text +); + +CREATE TABLE bar ( + other text NOT NULL, + also_tagged text NOT NULL +); + +CREATE TABLE baz ( + other text NOT NULL, + also_tagged text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json new file mode 100644 index 0000000000..697fe054ea --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json @@ -0,0 +1,32 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_struct_tag": "a:\"b\" x:\"y,z\"", + "column": "foo.tagged" + }, + { + "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 new file mode 100644 index 0000000000..d27a158d73 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..1a9a939e64 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +type Bar struct { + 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 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..6d31e7480e --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql @@ -0,0 +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 new file mode 100644 index 0000000000..30b718298d --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE foo ( + id text, + other_id text, + about text, + other text, + notnulltext text not null +); + +CREATE TABLE bar ( + id text, + other_id text, + about text, + other text +); 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 new file mode 100644 index 0000000000..bc583cdad4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,49 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "column": "*.id", + "go_struct_tag": "type:\"id\"" + }, + { + "column": "*.*_id", + "go_struct_tag": "type:\"other_id\"" + }, + { + "column": "foo.about", + "go_struct_tag": "type:\"about\"" + }, + { + "column": "foo.id", + "go_struct_tag": "source:\"foo\"" + }, + { + "column": "*.other", + "go_struct_tag": "type:\"other\"" + }, + { + "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 new file mode 100644 index 0000000000..a6e06f5d0e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "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 +} + +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/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..1a9a939e64 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +type Bar struct { + 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 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..6d31e7480e --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql @@ -0,0 +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 new file mode 100644 index 0000000000..30b718298d --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE foo ( + id text, + other_id text, + about text, + other text, + notnulltext text not null +); + +CREATE TABLE bar ( + id text, + other_id text, + about text, + other text +); 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 new file mode 100644 index 0000000000..df8c9de3b0 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,49 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "column": "*.id", + "go_struct_tag": "type:\"id\"" + }, + { + "column": "*.*_id", + "go_struct_tag": "type:\"other_id\"" + }, + { + "column": "foo.about", + "go_struct_tag": "type:\"about\"" + }, + { + "column": "foo.id", + "go_struct_tag": "source:\"foo\"" + }, + { + "column": "*.other", + "go_struct_tag": "type:\"other\"" + }, + { + "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 new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_go_struct_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..e47d67ca03 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +type Foo struct { + 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..0faba2cde4 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql @@ -0,0 +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 new file mode 100644 index 0000000000..82698ec836 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + 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 new file mode 100644 index 0000000000..f1171fcc11 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "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 new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_go_struct_tags/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go new file mode 100644 index 0000000000..72940ae47d --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +type Bar struct { + 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 `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 `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..e528f151d9 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql @@ -0,0 +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 new file mode 100644 index 0000000000..e9aa9bd37a --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE foo ( + other text NOT NULL, + tagged text NOT NULL, + tag3 text NOT NULL, + nulltext text +); + +CREATE TABLE bar ( + other text NOT NULL, + also_tagged text NOT NULL, + tag3 text NOT NULL +); + +CREATE TABLE baz ( + other text NOT NULL, + also_tagged text NOT NULL, + tag3 text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json new file mode 100644 index 0000000000..a4ca853b6a --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json @@ -0,0 +1,36 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_struct_tag": "a:\"b\" x:\"y,z\"", + "column": "foo.tagged" + }, + { + "go_struct_tag": "also:\"tagged\"", + "column": "*.also_tagged" + }, + { + "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 6f21c94ed1..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override 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 9b987955d3..ba5ce329c7 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go @@ -1,11 +1,25 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override import ( - "github.com/kyleconroy/sqlc-testdata/pkg" + "github.com/sqlc-dev/sqlc-testdata/pkg" ) +type Bar struct { + Other string + Total int64 + AlsoRetyped pkg.CustomType +} + +type Baz struct { + Other string + Total int64 + AlsoRetyped pkg.CustomType +} + type Foo struct { Other string Total int64 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 new file mode 100644 index 0000000000..b34ccf09bd --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + "strings" + + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +const testIN = `-- name: TestIN :many +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{} + if len(paramname) > 0 { + for _, v := range paramname { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:paramname*/?", strings.Repeat(",?", len(paramname))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:paramname*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Other, &i.Total, &i.Retyped); 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/overrides_go_types/mysql/query.sql b/internal/endtoend/testdata/overrides_go_types/mysql/query.sql index e0ac49d1ec..6b6fb8634d 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/query.sql +++ b/internal/endtoend/testdata/overrides_go_types/mysql/query.sql @@ -1 +1,2 @@ -SELECT 1; +-- name: TestIN :many +SELECT * FROM foo WHERE retyped IN (sqlc.slice(paramName)); diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/schema.sql b/internal/endtoend/testdata/overrides_go_types/mysql/schema.sql index c0c5fc47dc..31b183ad86 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/mysql/schema.sql @@ -3,3 +3,15 @@ CREATE TABLE foo ( total bigint NOT NULL, retyped text NOT NULL ); + +CREATE TABLE bar ( + other text NOT NULL, + total bigint NOT NULL, + also_retyped text NOT NULL +); + +CREATE TABLE baz ( + other text NOT NULL, + total bigint NOT NULL, + also_retyped text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/sqlc.json b/internal/endtoend/testdata/overrides_go_types/mysql/sqlc.json index 592fb072a0..75730b2753 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_types/mysql/sqlc.json @@ -9,8 +9,12 @@ "queries": "query.sql", "overrides": [ { - "go_type": "github.com/kyleconroy/sqlc-testdata/pkg.CustomType", + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", "column": "foo.retyped" + }, + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "*.also_retyped" } ] } diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/go/db.go deleted file mode 100644 index 6f21c94ed1..0000000000 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package override - -import ( - "context" - "database/sql" -) - -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 -} - -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_go_types/postgresql/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/go/models.go deleted file mode 100644 index 6a07b893c1..0000000000 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/go/models.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package override - -import ( - orm "database/sql" - "github.com/gofrs/uuid" - fuid "github.com/gofrs/uuid" - null "github.com/volatiletech/null/v8" - null_v4 "gopkg.in/guregu/null.v4" -) - -type Foo struct { - ID uuid.UUID - OtherID fuid.UUID - Age orm.NullInt32 - Balance null.Float32 - Bio null_v4.String - About *string -} diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/go/query.sql.go deleted file mode 100644 index 75e73b73d0..0000000000 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/go/query.sql.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package override - -import ( - "context" - - "github.com/gofrs/uuid" -) - -const loadFoo = `-- name: LoadFoo :many -SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 -` - -func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, loadFoo, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan( - &i.ID, - &i.OtherID, - &i.Age, - &i.Balance, - &i.Bio, - &i.About, - ); 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/overrides_go_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..d27a158d73 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides_go_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..2a8281a55b --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "database/sql" + + orm "database/sql" + fuid "github.com/gofrs/uuid" + uuid "github.com/gofrs/uuid" + null "github.com/volatiletech/null/v8" + null_v4 "gopkg.in/guregu/null.v4" +) + +type Bar struct { + ID uuid.UUID + OtherID fuid.UUID + MoreID fuid.UUID + Age sql.NullInt32 + Balance sql.NullFloat64 + Bio sql.NullString + About sql.NullString +} + +type Foo struct { + ID uuid.UUID + OtherID fuid.UUID + Age orm.NullInt32 + Balance null.Float32 + Bio null_v4.String + About *string +} 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 new file mode 100644 index 0000000000..3f162a8688 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,95 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + orm "database/sql" + fuid "github.com/gofrs/uuid" + uuid "github.com/gofrs/uuid" + null "github.com/volatiletech/null/v8" + null_v4 "gopkg.in/guregu/null.v4" +) + +const loadFoo = `-- name: LoadFoo :many +SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 +` + +func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { + rows, err := q.db.Query(ctx, loadFoo, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan( + &i.ID, + &i.OtherID, + &i.Age, + &i.Balance, + &i.Bio, + &i.About, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const loadFooWithAliases = `-- name: LoadFooWithAliases :many +SELECT + id AS aliased_id, + other_id AS aliased_other_id, + age AS aliased_age, + balance AS aliased_balance, + bio AS aliased_bio, + about AS aliased_about +FROM foo +WHERE id = $1 +` + +type LoadFooWithAliasesRow struct { + AliasedID uuid.UUID + AliasedOtherID fuid.UUID + AliasedAge orm.NullInt32 + AliasedBalance null.Float32 + AliasedBio null_v4.String + AliasedAbout *string +} + +func (q *Queries) LoadFooWithAliases(ctx context.Context, namedParameterID uuid.UUID) ([]LoadFooWithAliasesRow, error) { + rows, err := q.db.Query(ctx, loadFooWithAliases, namedParameterID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LoadFooWithAliasesRow + for rows.Next() { + var i LoadFooWithAliasesRow + if err := rows.Scan( + &i.AliasedID, + &i.AliasedOtherID, + &i.AliasedAge, + &i.AliasedBalance, + &i.AliasedBio, + &i.AliasedAbout, + ); 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/overrides_go_types/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b43982986c --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/query.sql @@ -0,0 +1,13 @@ +-- name: LoadFoo :many +SELECT * FROM foo WHERE id = $1; + +-- name: LoadFooWithAliases :many +SELECT + id AS aliased_id, + other_id AS aliased_other_id, + age AS aliased_age, + balance AS aliased_balance, + bio AS aliased_bio, + about AS aliased_about +FROM foo +WHERE id = @named_parameter_id; diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..68d2f8375f --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL, + age integer, + balance double precision, + bio text, + about text +); + +CREATE TABLE bar ( + id uuid NOT NULL, + other_id uuid NOT NULL, + more_id uuid NOT NULL, + age integer, + balance double precision, + bio text, + about text +); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..80f4577b9d --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,64 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "column": "*.id", + "go_type": { + "import": "github.com/gofrs/uuid", + "package": "uuid", + "type": "UUID" + } + }, + { + "column": "*.*_id", + "go_type": { + "import": "github.com/gofrs/uuid", + "package": "fuid", + "type": "UUID" + } + }, + { + "column": "foo.age", + "nullable": true, + "go_type": { + "import": "database/sql", + "package": "orm", + "type": "NullInt32" + } + }, + { + "column": "foo.balance", + "nullable": true, + "go_type": { + "import": "github.com/volatiletech/null/v8", + "type": "Float32" + } + }, + { + "column": "foo.bio", + "nullable": true, + "go_type": { + "import": "gopkg.in/guregu/null.v4", + "type": "String" + } + }, + { + "column": "foo.about", + "nullable": true, + "go_type": { + "type": "string", + "pointer": true + } + } + ] + } + ] +} 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 new file mode 100644 index 0000000000..a6e06f5d0e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "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 +} + +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/overrides_go_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..5e19a83381 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + orm "database/sql" + fuid "github.com/gofrs/uuid" + uuid "github.com/gofrs/uuid" + "github.com/jackc/pgx/v5/pgtype" + null "github.com/volatiletech/null/v8" + null_v4 "gopkg.in/guregu/null.v4" +) + +type Bar struct { + ID uuid.UUID + OtherID fuid.UUID + MoreID fuid.UUID + Age pgtype.Int4 + Balance pgtype.Float8 + Bio pgtype.Text + About pgtype.Text +} + +type Foo struct { + ID uuid.UUID + OtherID fuid.UUID + Age orm.NullInt32 + Balance null.Float32 + Bio null_v4.String + About *string +} 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 new file mode 100644 index 0000000000..69124af2d6 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + uuid "github.com/gofrs/uuid" +) + +const loadFoo = `-- name: LoadFoo :many +SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 +` + +func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { + rows, err := q.db.Query(ctx, loadFoo, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan( + &i.ID, + &i.OtherID, + &i.Age, + &i.Balance, + &i.Bio, + &i.About, + ); 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/overrides_go_types/postgresql/query.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/overrides_go_types/postgresql/query.sql rename to internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/query.sql diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..68d2f8375f --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL, + age integer, + balance double precision, + bio text, + about text +); + +CREATE TABLE bar ( + id uuid NOT NULL, + other_id uuid NOT NULL, + more_id uuid NOT NULL, + age integer, + balance double precision, + bio text, + about text +); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..5baf32800b --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,64 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "column": "*.id", + "go_type": { + "import": "github.com/gofrs/uuid", + "package": "uuid", + "type": "UUID" + } + }, + { + "column": "*.*_id", + "go_type": { + "import": "github.com/gofrs/uuid", + "package": "fuid", + "type": "UUID" + } + }, + { + "column": "foo.age", + "nullable": true, + "go_type": { + "import": "database/sql", + "package": "orm", + "type": "NullInt32" + } + }, + { + "column": "foo.balance", + "nullable": true, + "go_type": { + "import": "github.com/volatiletech/null/v8", + "type": "Float32" + } + }, + { + "column": "foo.bio", + "nullable": true, + "go_type": { + "import": "gopkg.in/guregu/null.v4", + "type": "String" + } + }, + { + "column": "foo.about", + "nullable": true, + "go_type": { + "type": "string", + "pointer": true + } + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/schema.sql deleted file mode 100644 index 4e0d1f5af7..0000000000 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE foo ( - id uuid NOT NULL, - other_id uuid NOT NULL, - age integer, - balance double, - bio text, - about text -); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/sqlc.json deleted file mode 100644 index 8d3b0c2223..0000000000 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/sqlc.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "override", - "engine": "postgresql", - "schema": "schema.sql", - "queries": "query.sql", - "overrides": [ - { - "column": "foo.id", - "go_type": { - "import": "github.com/gofrs/uuid", - "type": "UUID" - }, - }, - { - "column": "foo.other_id", - "go_type": { - "import": "github.com/gofrs/uuid", - "package": "fuid", - "type": "UUID" - }, - }, - { - "column": "foo.age", - "nullable": true, - "go_type": { - "import": "database/sql", - "package": "orm", - "type": "NullInt32" - }, - }, - { - "column": "foo.balance", - "nullable": true, - "go_type": { - "import": "github.com/volatiletech/null/v8", - "type": "Float32" - }, - }, - { - "column": "foo.bio", - "nullable": true, - "go_type": { - "import": "gopkg.in/guregu/null.v4", - "type": "String" - }, - }, - { - "column": "foo.about", - "nullable": true, - "go_type": { - "type": "string", - "pointer": true - } - } - ] - } - ] -} 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 new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_go_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..e86b5539c9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + orm "database/sql" + "github.com/gofrs/uuid" + fuid "github.com/gofrs/uuid" + null "github.com/volatiletech/null/v8" + null_v4 "gopkg.in/guregu/null.v4" +) + +type Foo struct { + ID uuid.UUID + OtherID fuid.UUID + Age orm.NullInt32 + Balance null.Float32 + Bio null_v4.String + About *string +} 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 new file mode 100644 index 0000000000..d73caecead --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + "github.com/gofrs/uuid" +) + +const loadFoo = `-- name: LoadFoo :many +SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 +` + +func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, loadFoo, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan( + &i.ID, + &i.OtherID, + &i.Age, + &i.Balance, + &i.Bio, + &i.About, + ); 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/overrides_go_types/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..192dc6cb94 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: LoadFoo :many +SELECT * FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6e33abfeb1 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + id uuid NOT NULL, + other_id uuid NOT NULL, + age integer, + balance double precision, + bio text, + about text +); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..c97894fd2a --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json @@ -0,0 +1,62 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "column": "foo.id", + "go_type": { + "import": "github.com/gofrs/uuid", + "type": "UUID" + } + }, + { + "column": "foo.other_id", + "go_type": { + "import": "github.com/gofrs/uuid", + "package": "fuid", + "type": "UUID" + } + }, + { + "column": "foo.age", + "nullable": true, + "go_type": { + "import": "database/sql", + "package": "orm", + "type": "NullInt32" + } + }, + { + "column": "foo.balance", + "nullable": true, + "go_type": { + "import": "github.com/volatiletech/null/v8", + "type": "Float32" + } + }, + { + "column": "foo.bio", + "nullable": true, + "go_type": { + "import": "gopkg.in/guregu/null.v4", + "type": "String" + } + }, + { + "column": "foo.about", + "nullable": true, + "go_type": { + "type": "string", + "pointer": true + } + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_go_types/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go new file mode 100644 index 0000000000..ba5ce329c7 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Bar struct { + Other string + Total int64 + AlsoRetyped pkg.CustomType +} + +type Baz struct { + Other string + Total int64 + AlsoRetyped pkg.CustomType +} + +type Foo struct { + Other string + Total int64 + Retyped pkg.CustomType +} 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..e528f151d9 --- /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.30.0 +// 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 new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/schema.sql b/internal/endtoend/testdata/overrides_go_types/sqlite/schema.sql new file mode 100644 index 0000000000..31b183ad86 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/schema.sql @@ -0,0 +1,17 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + retyped text NOT NULL +); + +CREATE TABLE bar ( + other text NOT NULL, + total bigint NOT NULL, + also_retyped text NOT NULL +); + +CREATE TABLE baz ( + other text NOT NULL, + total bigint NOT NULL, + also_retyped text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/sqlc.json b/internal/endtoend/testdata/overrides_go_types/sqlite/sqlc.json new file mode 100644 index 0000000000..212161c014 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/sqlc.json @@ -0,0 +1,22 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "foo.retyped" + }, + { + "go_type": "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType", + "column": "*.also_retyped" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_nullable/go/db.go b/internal/endtoend/testdata/overrides_nullable/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/overrides_nullable/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_nullable/go/models.go b/internal/endtoend/testdata/overrides_nullable/go/models.go deleted file mode 100644 index d8ac4f775f..0000000000 --- a/internal/endtoend/testdata/overrides_nullable/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "github.com/jackc/pgtype" -) - -type Foo struct { - Bar pgtype.Text - Bam pgtype.Name - Baz pgtype.Name -} diff --git a/internal/endtoend/testdata/overrides_nullable/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/go/query.sql.go deleted file mode 100644 index 185b26aba7..0000000000 --- a/internal/endtoend/testdata/overrides_nullable/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listFoo = `-- name: ListFoo :many -SELECT bar, bam, baz FROM foo -` - -func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.Bar, &i.Bam, &i.Baz); 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/overrides_nullable/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides_nullable/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..78aae40b04 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Bam pgtype.Name + Baz pgtype.Name +} 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 new file mode 100644 index 0000000000..1a12b9c4e4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT bar, bam, baz FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Bam, &i.Baz); 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/overrides_nullable/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..b9579b3dff --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam name, + baz name not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..c3f4e1772d --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,29 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "db_type": "name", + "go_type": "github.com/jackc/pgtype.Name" + }, + { + "db_type": "name", + "go_type": "github.com/jackc/pgtype.Name", + "nullable": true + }, + { + "db_type": "text", + "go_type": "github.com/jackc/pgtype.Text", + "null": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/overrides_nullable/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..af9c0bfefe --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.UndecodedBytes + Bam pgtype.DriverBytes + Baz pgtype.Text +} 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 new file mode 100644 index 0000000000..1a12b9c4e4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT bar, bam, baz FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Bam, &i.Baz); 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/overrides_nullable/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a59f6310a0 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam jsonb, + baz jsonb not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..04508b41ef --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,29 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "db_type": "jsonb", + "go_type": "github.com/jackc/pgx/v5/pgtype.Text" + }, + { + "db_type": "jsonb", + "go_type": "github.com/jackc/pgx/v5/pgtype.DriverBytes", + "nullable": true + }, + { + "db_type": "text", + "go_type": "github.com/jackc/pgx/v5/pgtype.UndecodedBytes", + "null": true + } + ] +} diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_nullable/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..78aae40b04 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Bam pgtype.Name + Baz pgtype.Name +} 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 new file mode 100644 index 0000000000..96d6e40680 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT bar, bam, baz FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Bam, &i.Baz); 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/overrides_nullable/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b9579b3dff --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam name, + baz name not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..d59d867c3c --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "db_type": "name", + "go_type": "github.com/jackc/pgtype.Name" + }, + { + "db_type": "name", + "go_type": "github.com/jackc/pgtype.Name", + "nullable": true + }, + { + "db_type": "text", + "go_type": "github.com/jackc/pgtype.Text", + "null": true + } + ] +} diff --git a/internal/endtoend/testdata/overrides_nullable/query.sql b/internal/endtoend/testdata/overrides_nullable/query.sql deleted file mode 100644 index 51bdce2a8b..0000000000 --- a/internal/endtoend/testdata/overrides_nullable/query.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE foo ( - bar text, - bam name, - baz name not null -); - --- name: ListFoo :many -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/sqlc.json b/internal/endtoend/testdata/overrides_nullable/sqlc.json deleted file mode 100644 index 5ac28e87bd..0000000000 --- a/internal/endtoend/testdata/overrides_nullable/sqlc.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ], - "overrides": [ - { - "db_type": "name", - "go_type": "github.com/jackc/pgtype.Name" - }, - { - "db_type": "name", - "go_type": "github.com/jackc/pgtype.Name", - "nullable": true - }, - { - "db_type": "text", - "go_type": "github.com/jackc/pgtype.Text", - "null": true - } - ] -} diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_pointers/mysql/go/models.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go new file mode 100644 index 0000000000..0e8f9db623 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + t "github.com/jackc/pgtype" +) + +type Foo struct { + Other string + Total int64 + Retyped *t.Text +} diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go new file mode 100644 index 0000000000..0d0b9f293c --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + t "github.com/jackc/pgtype" +) + +const test = `-- name: test :exec +SELECT other, total, retyped FROM foo WHERE other = ? and retyped = ? +` + +type testParams struct { + Other string + Retyped *t.Text +} + +func (q *Queries) test(ctx context.Context, arg testParams) error { + _, err := q.db.ExecContext(ctx, test, arg.Other, arg.Retyped) + return err +} diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/query.sql b/internal/endtoend/testdata/overrides_pointers/mysql/query.sql new file mode 100644 index 0000000000..d2733d752f --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: test :exec +SELECT * FROM foo WHERE other = ? and retyped = ?; \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/schema.sql b/internal/endtoend/testdata/overrides_pointers/mysql/schema.sql new file mode 100644 index 0000000000..c0c5fc47dc --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + retyped text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/sqlc.json b/internal/endtoend/testdata/overrides_pointers/mysql/sqlc.json new file mode 100644 index 0000000000..cff9b5a174 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/mysql/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": { + "import": "github.com/jackc/pgtype", + "type": "Text", + "package": "t", + "pointer": true + }, + "column": "foo.retyped" + } + ] + } + ] +} 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 new file mode 100644 index 0000000000..d27a158d73 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/overrides_pointers/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f6aa6a379a --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + t "github.com/jackc/pgtype" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped string + Langs *t.Text +} 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 new file mode 100644 index 0000000000..7b8cadff56 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + t "github.com/jackc/pgtype" +) + +const test = `-- name: test :exec +UPDATE foo SET langs = $1 +` + +func (q *Queries) test(ctx context.Context, langs *t.Text) error { + _, err := q.db.Exec(ctx, test, langs) + return err +} diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..989c99f3c3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: test :exec +UPDATE foo SET langs = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..fc3a13e53d --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + tags text[] NOT NULL, + byte_seq bytea NOT NULL, + retyped text NOT NULL, + langs text[] +); diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..7f9b92f74c --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,24 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": { + "import": "github.com/jackc/pgtype", + "type": "Text", + "package": "t", + "pointer": true + }, + "column": "foo.langs" + } + ] + } + ] +} 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 new file mode 100644 index 0000000000..a6e06f5d0e --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + + "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 +} + +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/overrides_pointers/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f6aa6a379a --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + t "github.com/jackc/pgtype" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped string + Langs *t.Text +} 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 new file mode 100644 index 0000000000..7b8cadff56 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + t "github.com/jackc/pgtype" +) + +const test = `-- name: test :exec +UPDATE foo SET langs = $1 +` + +func (q *Queries) test(ctx context.Context, langs *t.Text) error { + _, err := q.db.Exec(ctx, test, langs) + return err +} diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..989c99f3c3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: test :exec +UPDATE foo SET langs = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..fc3a13e53d --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + tags text[] NOT NULL, + byte_seq bytea NOT NULL, + retyped text NOT NULL, + langs text[] +); diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..9bbaf45420 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,24 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "override", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": { + "import": "github.com/jackc/pgtype", + "type": "Text", + "package": "t", + "pointer": true + }, + "column": "foo.langs" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..9c19dd4a09 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + "context" + "database/sql" +) + +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 +} + +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_pointers/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f6aa6a379a --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package override + +import ( + t "github.com/jackc/pgtype" +) + +type Foo struct { + Other string + Total int64 + Tags []string + ByteSeq []byte + Retyped string + Langs *t.Text +} 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 new file mode 100644 index 0000000000..dfc39890c9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" + + t "github.com/jackc/pgtype" +) + +const test = `-- name: test :exec +UPDATE foo SET langs = $1 +` + +func (q *Queries) test(ctx context.Context, langs *t.Text) error { + _, err := q.db.ExecContext(ctx, test, langs) + return err +} diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c3da7ccaf2 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: test :exec +UPDATE foo SET langs = $1; diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..fc3a13e53d --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE foo ( + other text NOT NULL, + total bigint NOT NULL, + tags text[] NOT NULL, + byte_seq bytea NOT NULL, + retyped text NOT NULL, + langs text[] +); diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..a251249c11 --- /dev/null +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "override", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "overrides": [ + { + "go_type": { + "import": "github.com/jackc/pgtype", + "type": "Text", + "package": "t", + "pointer": true + }, + "column": "foo.langs" + } + ] + } + ] +} diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_result_tag/stdlib/go/models.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go new file mode 100644 index 0000000000..f82d23a941 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Account struct { + ID uuid.UUID `sometagtype:"some_value"` + State sql.NullString +} + +type UsersAccount struct { + Id2 uuid.UUID + Name sql.NullString +} 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 new file mode 100644 index 0000000000..deaf22a459 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/google/uuid" +) + +const findAccount = `-- name: FindAccount :one +SELECT + a.id, a.state, + ua.name + -- other fields +FROM + accounts a + INNER JOIN users_accounts ua ON a.id = ua.id2 +WHERE + a.id = $1 +` + +type FindAccountRow struct { + ID uuid.UUID `sometagtype:"some_value"` + State sql.NullString + Name sql.NullString +} + +func (q *Queries) FindAccount(ctx context.Context, accountID uuid.UUID) (FindAccountRow, error) { + row := q.db.QueryRowContext(ctx, findAccount, accountID) + var i FindAccountRow + err := row.Scan(&i.ID, &i.State, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql new file mode 100644 index 0000000000..4ca1dd8605 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql @@ -0,0 +1,10 @@ +-- name: FindAccount :one +SELECT + a.*, + ua.name + -- other fields +FROM + accounts a + INNER JOIN users_accounts ua ON a.id = ua.id2 +WHERE + a.id = @account_id; diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql b/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql new file mode 100644 index 0000000000..ebd8d00538 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql @@ -0,0 +1,12 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + +CREATE TABLE public.accounts ( + id uuid DEFAULT public.uuid_generate_v4() NOT NULL, + state character varying +); + +CREATE TABLE public.users_accounts ( + ID2 uuid DEFAULT public.uuid_generate_v4() NOT NULL, + name character varying +); + diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml b/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml new file mode 100644 index 0000000000..bbfc3b1d95 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml @@ -0,0 +1,12 @@ +version: "2" +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "querytest" + out: "go" + overrides: + - column: accounts.id + go_struct_tag: sometagtype:"some_value" \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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_unsigned/mysql/go/models.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go new file mode 100644 index 0000000000..ae8927d7c8 --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Rating int64 + Score uint32 + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go new file mode 100644 index 0000000000..9ad07fc0be --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go @@ -0,0 +1,91 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :exec +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) error { + _, err := q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + return 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, rating, score, bio FROM authors +WHERE id = ? 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.Rating, + &i.Score, + &i.Bio, + ) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, rating, score, 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.Rating, + &i.Score, + &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/overrides_unsigned/mysql/query.sql b/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql new file mode 100644 index 0000000000..348b2c6fda --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql @@ -0,0 +1,18 @@ +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ? LIMIT 1; + +-- name: CreateAuthor :exec +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +); + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; \ No newline at end of file diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql b/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql new file mode 100644 index 0000000000..70567eab0b --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE authors ( + id SERIAL, + name text NOT NULL, + rating bigint NOT NULL, + score int UNSIGNED NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json b/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json new file mode 100644 index 0000000000..400518f6f4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql", + "gen": { + "go": { + "package": "db", + "out": "go", + "overrides": [ + { + "db_type": "bigint", + "go_type": "int64", + "unsigned": true + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go index ec72cdf8ec..cab9171aaf 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 1f48521520..332cb9b26e 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -14,12 +16,11 @@ users where (? = id OR ? = 0) ` type SelectUserByIDParams struct { - Column1 interface{} - ID interface{} + ID int32 } func (q *Queries) SelectUserByID(ctx context.Context, arg SelectUserByIDParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByID, arg.Column1, arg.ID) + rows, err := q.db.QueryContext(ctx, selectUserByID, arg.ID, arg.ID) if err != nil { return nil, err } @@ -49,12 +50,11 @@ WHERE first_name = ? ` type SelectUserByNameParams struct { - FirstName sql.NullString - Name sql.NullString + Name sql.NullString } func (q *Queries) SelectUserByName(ctx context.Context, arg SelectUserByNameParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByName, arg.FirstName, arg.Name) + rows, err := q.db.QueryContext(ctx, selectUserByName, arg.Name, arg.Name) if err != nil { return nil, err } @@ -82,12 +82,12 @@ users where (? = id OR ? = 0) ` type SelectUserQuestionParams struct { - Column1 interface{} + ID int32 Column2 interface{} } func (q *Queries) SelectUserQuestion(ctx context.Context, arg SelectUserQuestionParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserQuestion, arg.Column1, arg.Column2) + rows, err := q.db.QueryContext(ctx, selectUserQuestion, arg.ID, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_duplicate/mysql/sqlc.json b/internal/endtoend/testdata/params_duplicate/mysql/sqlc.json index a9e7b055a4..1f70415f37 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_duplicate/mysql/sqlc.json @@ -1,12 +1,12 @@ { - "version": "1", - "packages": [ - { - "name": "querytest", - "path": "go", - "schema": "schema.sql", - "queries": "query.sql", - "engine": "mysql" - } - ] + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql" + } + ] } diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_duplicate/postgresql/go/models.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go new file mode 100644 index 0000000000..cab9171aaf --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName sql.NullString + LastName sql.NullString +} diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go new file mode 100644 index 0000000000..c93d3d9981 --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go @@ -0,0 +1,97 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const selectUserByID = `-- name: SelectUserByID :many +SELECT first_name from +users where ($1 = id OR $1 = 0) +` + +func (q *Queries) SelectUserByID(ctx context.Context, id int32) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectUserByID, id) + 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 selectUserByName = `-- name: SelectUserByName :many +SELECT first_name +FROM users +WHERE first_name = $1 + OR last_name = $1 +` + +func (q *Queries) SelectUserByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectUserByName, name) + 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 selectUserQuestion = `-- name: SelectUserQuestion :many +SELECT first_name from +users where ($1 = id OR $1 = 0) +` + +func (q *Queries) SelectUserQuestion(ctx context.Context, id int32) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectUserQuestion, id) + 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 +} diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/query.sql b/internal/endtoend/testdata/params_duplicate/postgresql/query.sql new file mode 100644 index 0000000000..8a75624011 --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/query.sql @@ -0,0 +1,13 @@ +/* name: SelectUserByID :many */ +SELECT first_name from +users where (sqlc.arg(id) = id OR sqlc.arg(id) = 0); + +/* name: SelectUserByName :many */ +SELECT first_name +FROM users +WHERE first_name = sqlc.arg(name) + OR last_name = sqlc.arg(name); + +/* name: SelectUserQuestion :many */ +SELECT first_name from +users where ($1 = id OR $1 = 0); diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql b/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql new file mode 100644 index 0000000000..554581b60f --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id INT PRIMARY KEY, + first_name varchar(255), + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json b/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json new file mode 100644 index 0000000000..2fc79a9f0e --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql" + } + ] +} diff --git a/internal/endtoend/testdata/params_go_keywords/issue.md b/internal/endtoend/testdata/params_go_keywords/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/params_go_keywords/postgresql/go/models.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go new file mode 100644 index 0000000000..15d9d8ec70 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type GoKeyword struct { + Break pgtype.Text + Default pgtype.Text + Func pgtype.Text + Interface pgtype.Text + Select pgtype.Text + Case pgtype.Text + Defer pgtype.Text + Go pgtype.Text + Map pgtype.Text + Struct pgtype.Text + Chan pgtype.Text + Else pgtype.Text + Goto pgtype.Text + Package pgtype.Text + Switch pgtype.Text + Const pgtype.Text + Fallthrough pgtype.Text + If pgtype.Text + Range pgtype.Text + Type pgtype.Text + Continue pgtype.Text + For pgtype.Text + 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 new file mode 100644 index 0000000000..5c4c6f5945 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go @@ -0,0 +1,532 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const keywordBreak = `-- name: KeywordBreak :exec +SELECT $1::text +` + +func (q *Queries) KeywordBreak(ctx context.Context, break_ string) error { + _, err := q.db.Exec(ctx, keywordBreak, break_) + return err +} + +const keywordCase = `-- name: KeywordCase :exec +SELECT $1::text +` + +func (q *Queries) KeywordCase(ctx context.Context, case_ string) error { + _, err := q.db.Exec(ctx, keywordCase, case_) + return err +} + +const keywordChan = `-- name: KeywordChan :exec +SELECT $1::text +` + +func (q *Queries) KeywordChan(ctx context.Context, chan_ string) error { + _, err := q.db.Exec(ctx, keywordChan, chan_) + return err +} + +const keywordConst = `-- name: KeywordConst :exec +SELECT $1::text +` + +func (q *Queries) KeywordConst(ctx context.Context, const_ string) error { + _, err := q.db.Exec(ctx, keywordConst, const_) + return err +} + +const keywordContinue = `-- name: KeywordContinue :exec +SELECT $1::text +` + +func (q *Queries) KeywordContinue(ctx context.Context, continue_ string) error { + _, err := q.db.Exec(ctx, keywordContinue, continue_) + return err +} + +const keywordDefault = `-- name: KeywordDefault :exec +SELECT $1::text +` + +func (q *Queries) KeywordDefault(ctx context.Context, default_ string) error { + _, err := q.db.Exec(ctx, keywordDefault, default_) + return err +} + +const keywordDefer = `-- name: KeywordDefer :exec +SELECT $1::text +` + +func (q *Queries) KeywordDefer(ctx context.Context, defer_ string) error { + _, err := q.db.Exec(ctx, keywordDefer, defer_) + return err +} + +const keywordElse = `-- name: KeywordElse :exec +SELECT $1::text +` + +func (q *Queries) KeywordElse(ctx context.Context, else_ string) error { + _, err := q.db.Exec(ctx, keywordElse, else_) + return err +} + +const keywordFallthrough = `-- name: KeywordFallthrough :exec +SELECT $1::text +` + +func (q *Queries) KeywordFallthrough(ctx context.Context, fallthrough_ string) error { + _, err := q.db.Exec(ctx, keywordFallthrough, fallthrough_) + return err +} + +const keywordFor = `-- name: KeywordFor :exec +SELECT $1::text +` + +func (q *Queries) KeywordFor(ctx context.Context, for_ string) error { + _, err := q.db.Exec(ctx, keywordFor, for_) + return err +} + +const keywordFunc = `-- name: KeywordFunc :exec +SELECT $1::text +` + +func (q *Queries) KeywordFunc(ctx context.Context, func_ string) error { + _, err := q.db.Exec(ctx, keywordFunc, func_) + return err +} + +const keywordGo = `-- name: KeywordGo :exec +SELECT $1::text +` + +func (q *Queries) KeywordGo(ctx context.Context, go_ string) error { + _, err := q.db.Exec(ctx, keywordGo, go_) + return err +} + +const keywordGoto = `-- name: KeywordGoto :exec +SELECT $1::text +` + +func (q *Queries) KeywordGoto(ctx context.Context, goto_ string) error { + _, err := q.db.Exec(ctx, keywordGoto, goto_) + return err +} + +const keywordIf = `-- name: KeywordIf :exec +SELECT $1::text +` + +func (q *Queries) KeywordIf(ctx context.Context, if_ string) error { + _, err := q.db.Exec(ctx, keywordIf, if_) + return err +} + +const keywordImport = `-- name: KeywordImport :exec +SELECT $1::text +` + +func (q *Queries) KeywordImport(ctx context.Context, import_ string) error { + _, err := q.db.Exec(ctx, keywordImport, import_) + return err +} + +const keywordInterface = `-- name: KeywordInterface :exec +SELECT $1::text +` + +func (q *Queries) KeywordInterface(ctx context.Context, interface_ string) error { + _, err := q.db.Exec(ctx, keywordInterface, interface_) + return err +} + +const keywordMap = `-- name: KeywordMap :exec +SELECT $1::text +` + +func (q *Queries) KeywordMap(ctx context.Context, map_ string) error { + _, err := q.db.Exec(ctx, keywordMap, map_) + return err +} + +const keywordPackage = `-- name: KeywordPackage :exec +SELECT $1::text +` + +func (q *Queries) KeywordPackage(ctx context.Context, package_ string) error { + _, err := q.db.Exec(ctx, keywordPackage, package_) + 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 +` + +func (q *Queries) KeywordRange(ctx context.Context, range_ string) error { + _, err := q.db.Exec(ctx, keywordRange, range_) + return err +} + +const keywordReturn = `-- name: KeywordReturn :exec +SELECT $1::text +` + +func (q *Queries) KeywordReturn(ctx context.Context, return_ string) error { + _, err := q.db.Exec(ctx, keywordReturn, return_) + return err +} + +const keywordSelect = `-- name: KeywordSelect :exec +SELECT $1::text +` + +func (q *Queries) KeywordSelect(ctx context.Context, select_ string) error { + _, err := q.db.Exec(ctx, keywordSelect, select_) + return err +} + +const keywordStruct = `-- name: KeywordStruct :exec +SELECT $1::text +` + +func (q *Queries) KeywordStruct(ctx context.Context, struct_ string) error { + _, err := q.db.Exec(ctx, keywordStruct, struct_) + return err +} + +const keywordSwitch = `-- name: KeywordSwitch :exec +SELECT $1::text +` + +func (q *Queries) KeywordSwitch(ctx context.Context, switch_ string) error { + _, err := q.db.Exec(ctx, keywordSwitch, switch_) + return err +} + +const keywordType = `-- name: KeywordType :exec +SELECT $1::text +` + +func (q *Queries) KeywordType(ctx context.Context, type_ string) error { + _, err := q.db.Exec(ctx, keywordType, type_) + return err +} + +const keywordVar = `-- name: KeywordVar :exec +SELECT $1::text +` + +func (q *Queries) KeywordVar(ctx context.Context, var_ string) error { + _, err := q.db.Exec(ctx, keywordVar, var_) + return err +} + +const selectBreak = `-- name: SelectBreak :one +SELECT "break" FROM go_keywords +` + +func (q *Queries) SelectBreak(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectBreak) + var break_ pgtype.Text + err := row.Scan(&break_) + return break_, err +} + +const selectCase = `-- name: SelectCase :one +SELECT "case" FROM go_keywords +` + +func (q *Queries) SelectCase(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectCase) + var case_ pgtype.Text + err := row.Scan(&case_) + return case_, err +} + +const selectChan = `-- name: SelectChan :one +SELECT "chan" FROM go_keywords +` + +func (q *Queries) SelectChan(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectChan) + var chan_ pgtype.Text + err := row.Scan(&chan_) + return chan_, err +} + +const selectConst = `-- name: SelectConst :one +SELECT "const" FROM go_keywords +` + +func (q *Queries) SelectConst(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectConst) + var const_ pgtype.Text + err := row.Scan(&const_) + return const_, err +} + +const selectContinue = `-- name: SelectContinue :one +SELECT "continue" FROM go_keywords +` + +func (q *Queries) SelectContinue(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectContinue) + var continue_ pgtype.Text + err := row.Scan(&continue_) + return continue_, err +} + +const selectDefault = `-- name: SelectDefault :one +SELECT "default" FROM go_keywords +` + +func (q *Queries) SelectDefault(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectDefault) + var default_ pgtype.Text + err := row.Scan(&default_) + return default_, err +} + +const selectDefer = `-- name: SelectDefer :one +SELECT "defer" FROM go_keywords +` + +func (q *Queries) SelectDefer(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectDefer) + var defer_ pgtype.Text + err := row.Scan(&defer_) + return defer_, err +} + +const selectElse = `-- name: SelectElse :one +SELECT "else" FROM go_keywords +` + +func (q *Queries) SelectElse(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectElse) + var else_ pgtype.Text + err := row.Scan(&else_) + return else_, err +} + +const selectFallthrough = `-- name: SelectFallthrough :one +SELECT "fallthrough" FROM go_keywords +` + +func (q *Queries) SelectFallthrough(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFallthrough) + var fallthrough_ pgtype.Text + err := row.Scan(&fallthrough_) + return fallthrough_, err +} + +const selectFor = `-- name: SelectFor :one +SELECT "for" FROM go_keywords +` + +func (q *Queries) SelectFor(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFor) + var for_ pgtype.Text + err := row.Scan(&for_) + return for_, err +} + +const selectFunc = `-- name: SelectFunc :one +SELECT "func" FROM go_keywords +` + +func (q *Queries) SelectFunc(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFunc) + var func_ pgtype.Text + err := row.Scan(&func_) + return func_, err +} + +const selectGo = `-- name: SelectGo :one +SELECT "go" FROM go_keywords +` + +func (q *Queries) SelectGo(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectGo) + var go_ pgtype.Text + err := row.Scan(&go_) + return go_, err +} + +const selectGoto = `-- name: SelectGoto :one +SELECT "goto" FROM go_keywords +` + +func (q *Queries) SelectGoto(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectGoto) + var goto_ pgtype.Text + err := row.Scan(&goto_) + return goto_, err +} + +const selectIf = `-- name: SelectIf :one +SELECT "if" FROM go_keywords +` + +func (q *Queries) SelectIf(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectIf) + var if_ pgtype.Text + err := row.Scan(&if_) + return if_, err +} + +const selectImport = `-- name: SelectImport :one +SELECT "import" FROM go_keywords +` + +func (q *Queries) SelectImport(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectImport) + var import_ pgtype.Text + err := row.Scan(&import_) + return import_, err +} + +const selectInterface = `-- name: SelectInterface :one +SELECT "interface" FROM go_keywords +` + +func (q *Queries) SelectInterface(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectInterface) + var interface_ pgtype.Text + err := row.Scan(&interface_) + return interface_, err +} + +const selectMap = `-- name: SelectMap :one +SELECT "map" FROM go_keywords +` + +func (q *Queries) SelectMap(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectMap) + var map_ pgtype.Text + err := row.Scan(&map_) + return map_, err +} + +const selectPackage = `-- name: SelectPackage :one +SELECT "package" FROM go_keywords +` + +func (q *Queries) SelectPackage(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectPackage) + var package_ pgtype.Text + err := row.Scan(&package_) + 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 +` + +func (q *Queries) SelectRange(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectRange) + var range_ pgtype.Text + err := row.Scan(&range_) + return range_, err +} + +const selectReturn = `-- name: SelectReturn :one +SELECT "return" FROM go_keywords +` + +func (q *Queries) SelectReturn(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectReturn) + var return_ pgtype.Text + err := row.Scan(&return_) + return return_, err +} + +const selectSelect = `-- name: SelectSelect :one +SELECT "select" FROM go_keywords +` + +func (q *Queries) SelectSelect(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectSelect) + var select_ pgtype.Text + err := row.Scan(&select_) + return select_, err +} + +const selectStruct = `-- name: SelectStruct :one +SELECT "struct" FROM go_keywords +` + +func (q *Queries) SelectStruct(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectStruct) + var struct_ pgtype.Text + err := row.Scan(&struct_) + return struct_, err +} + +const selectSwitch = `-- name: SelectSwitch :one +SELECT "switch" FROM go_keywords +` + +func (q *Queries) SelectSwitch(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectSwitch) + var switch_ pgtype.Text + err := row.Scan(&switch_) + return switch_, err +} + +const selectType = `-- name: SelectType :one +SELECT "type" FROM go_keywords +` + +func (q *Queries) SelectType(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectType) + var type_ pgtype.Text + err := row.Scan(&type_) + return type_, err +} + +const selectVar = `-- name: SelectVar :one +SELECT "var" FROM go_keywords +` + +func (q *Queries) SelectVar(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectVar) + var var_ pgtype.Text + err := row.Scan(&var_) + return var_, err +} diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql new file mode 100644 index 0000000000..bc45b1166f --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql @@ -0,0 +1,155 @@ +-- name: KeywordBreak :exec +SELECT sqlc.arg('break')::text; + +-- name: KeywordDefault :exec +SELECT sqlc.arg('default')::text; + +-- name: KeywordFunc :exec +SELECT sqlc.arg('func')::text; + +-- name: KeywordInterface :exec +SELECT sqlc.arg('interface')::text; + +-- name: KeywordSelect :exec +SELECT sqlc.arg('select')::text; + +-- name: KeywordCase :exec +SELECT sqlc.arg('case')::text; + +-- name: KeywordDefer :exec +SELECT sqlc.arg('defer')::text; + +-- name: KeywordGo :exec +SELECT sqlc.arg('go')::text; + +-- name: KeywordMap :exec +SELECT sqlc.arg('map')::text; + +-- name: KeywordStruct :exec +SELECT sqlc.arg('struct')::text; + +-- name: KeywordChan :exec +SELECT sqlc.arg('chan')::text; + +-- name: KeywordElse :exec +SELECT sqlc.arg('else')::text; + +-- name: KeywordGoto :exec +SELECT sqlc.arg('goto')::text; + +-- name: KeywordPackage :exec +SELECT sqlc.arg('package')::text; + +-- name: KeywordSwitch :exec +SELECT sqlc.arg('switch')::text; + +-- name: KeywordConst :exec +SELECT sqlc.arg('const')::text; + +-- name: KeywordFallthrough :exec +SELECT sqlc.arg('fallthrough')::text; + +-- name: KeywordIf :exec +SELECT sqlc.arg('if')::text; + +-- name: KeywordRange :exec +SELECT sqlc.arg('range')::text; + +-- name: KeywordType :exec +SELECT sqlc.arg('type')::text; + +-- name: KeywordContinue :exec +SELECT sqlc.arg('continue')::text; + +-- name: KeywordFor :exec +SELECT sqlc.arg('for')::text; + +-- name: KeywordImport :exec +SELECT sqlc.arg('import')::text; + +-- name: KeywordReturn :exec +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; + +-- name: SelectDefault :one +SELECT "default" FROM go_keywords; + +-- name: SelectFunc :one +SELECT "func" FROM go_keywords; + +-- name: SelectInterface :one +SELECT "interface" FROM go_keywords; + +-- name: SelectSelect :one +SELECT "select" FROM go_keywords; + +-- name: SelectCase :one +SELECT "case" FROM go_keywords; + +-- name: SelectDefer :one +SELECT "defer" FROM go_keywords; + +-- name: SelectGo :one +SELECT "go" FROM go_keywords; + +-- name: SelectMap :one +SELECT "map" FROM go_keywords; + +-- name: SelectStruct :one +SELECT "struct" FROM go_keywords; + +-- name: SelectChan :one +SELECT "chan" FROM go_keywords; + +-- name: SelectElse :one +SELECT "else" FROM go_keywords; + +-- name: SelectGoto :one +SELECT "goto" FROM go_keywords; + +-- name: SelectPackage :one +SELECT "package" FROM go_keywords; + +-- name: SelectSwitch :one +SELECT "switch" FROM go_keywords; + +-- name: SelectConst :one +SELECT "const" FROM go_keywords; + +-- name: SelectFallthrough :one +SELECT "fallthrough" FROM go_keywords; + +-- name: SelectIf :one +SELECT "if" FROM go_keywords; + +-- name: SelectRange :one +SELECT "range" FROM go_keywords; + +-- name: SelectType :one +SELECT "type" FROM go_keywords; + +-- name: SelectContinue :one +SELECT "continue" FROM go_keywords; + +-- name: SelectFor :one +SELECT "for" FROM go_keywords; + +-- name: SelectImport :one +SELECT "import" FROM go_keywords; + +-- name: SelectReturn :one +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 new file mode 100644 index 0000000000..100be50211 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE go_keywords ( + "break" TEXT, + "default" TEXT, + "func" TEXT, + "interface" TEXT, + "select" TEXT, + "case" TEXT, + "defer" TEXT, + "go" TEXT, + "map" TEXT, + "struct" TEXT, + "chan" TEXT, + "else" TEXT, + "goto" TEXT, + "package" TEXT, + "switch" TEXT, + "const" TEXT, + "fallthrough" TEXT, + "if" TEXT, + "range" TEXT, + "type" TEXT, + "continue" TEXT, + "for" TEXT, + "import" TEXT, + "return" TEXT, + "var" TEXT, + "q" TEXT +); diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/sqlc.yaml b/internal/endtoend/testdata/params_go_keywords/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/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/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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..1e7f7960a4 --- /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.30.0 + +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..70e532ae4e --- /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.30.0 +// 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 interface{} + 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..385bc233aa --- /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.30.0 + +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..32ab16ccc6 --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/db.go +++ b/internal/endtoend/testdata/params_location/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/mysql/go/models.go b/internal/endtoend/testdata/params_location/mysql/go/models.go index 2a3630d6b8..54ca4ce9d6 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/models.go +++ b/internal/endtoend/testdata/params_location/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 215ea4eb51..908e4240d4 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -83,8 +85,8 @@ WHERE orders.price > ? ` type ListUserOrdersRow struct { - ID int32 - FirstName string + ID sql.NullInt32 + FirstName sql.NullString Price string } diff --git a/internal/endtoend/testdata/params_location/mysql/query.sql b/internal/endtoend/testdata/params_location/mysql/query.sql index 824583afa8..cfa804c252 100644 --- a/internal/endtoend/testdata/params_location/mysql/query.sql +++ b/internal/endtoend/testdata/params_location/mysql/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE users ( - id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -) ENGINE=InnoDB; - -CREATE TABLE orders ( - id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -) ENGINE=InnoDB; - /* name: ListUsersByID :many */ SELECT first_name, id, last_name FROM users WHERE id < ?; diff --git a/internal/endtoend/testdata/params_location/mysql/schema.sql b/internal/endtoend/testdata/params_location/mysql/schema.sql new file mode 100644 index 0000000000..5df4b6c7a7 --- /dev/null +++ b/internal/endtoend/testdata/params_location/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +) ENGINE=InnoDB; + +CREATE TABLE orders ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +) ENGINE=InnoDB; + diff --git a/internal/endtoend/testdata/params_location/mysql/sqlc.json b/internal/endtoend/testdata/params_location/mysql/sqlc.json index bfbd23e211..a9e7b055a4 100644 --- a/internal/endtoend/testdata/params_location/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_location/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/params_location/postgresql/go/db.go b/internal/endtoend/testdata/params_location/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/params_location/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_location/postgresql/go/models.go b/internal/endtoend/testdata/params_location/postgresql/go/models.go deleted file mode 100644 index 2a3630d6b8..0000000000 --- a/internal/endtoend/testdata/params_location/postgresql/go/models.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Order struct { - ID int32 - Price string - UserID int32 -} - -type User struct { - ID int32 - FirstName string - LastName sql.NullString - Age int32 - JobStatus string -} diff --git a/internal/endtoend/testdata/params_location/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/go/query.sql.go deleted file mode 100644 index bef918ed5e..0000000000 --- a/internal/endtoend/testdata/params_location/postgresql/go/query.sql.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const getUserByID = `-- name: GetUserByID :one -SELECT first_name, id, last_name FROM users WHERE id = $1 -` - -type GetUserByIDRow struct { - FirstName string - ID int32 - LastName sql.NullString -} - -func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.db.QueryRowContext(ctx, getUserByID, targetID) - var i GetUserByIDRow - err := row.Scan(&i.FirstName, &i.ID, &i.LastName) - return i, err -} - -const insertNewUser = `-- name: InsertNewUser :exec -INSERT INTO users (first_name, last_name) VALUES ($1, $2) -` - -type InsertNewUserParams struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.db.ExecContext(ctx, insertNewUser, arg.FirstName, arg.LastName) - return err -} - -const limitSQLCArg = `-- name: LimitSQLCArg :many -select first_name, id FROM users LIMIT $1 -` - -type LimitSQLCArgRow struct { - FirstName string - ID int32 -} - -func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { - rows, err := q.db.QueryContext(ctx, limitSQLCArg, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []LimitSQLCArgRow - for rows.Next() { - var i LimitSQLCArgRow - if err := rows.Scan(&i.FirstName, &i.ID); 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 listUserOrders = `-- name: ListUserOrders :many -SELECT - users.id, - users.first_name, - orders.price -FROM - orders -LEFT JOIN users ON orders.user_id = users.id -WHERE orders.price > $1 -` - -type ListUserOrdersRow struct { - ID int32 - FirstName string - Price string -} - -func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUserOrdersRow, error) { - rows, err := q.db.QueryContext(ctx, listUserOrders, minPrice) - if err != nil { - return nil, err - } - defer rows.Close() - var items []ListUserOrdersRow - for rows.Next() { - var i ListUserOrdersRow - if err := rows.Scan(&i.ID, &i.FirstName, &i.Price); 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 listUserParenExpr = `-- name: ListUserParenExpr :many -SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') -AND id > $1 -ORDER BY id -LIMIT $2 -` - -type ListUserParenExprParams struct { - ID int32 - Limit int32 -} - -func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { - rows, err := q.db.QueryContext(ctx, listUserParenExpr, arg.ID, arg.Limit) - 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.FirstName, - &i.LastName, - &i.Age, - &i.JobStatus, - ); 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 listUsersByFamily = `-- name: ListUsersByFamily :many -SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 -` - -type ListUsersByFamilyParams struct { - MaxAge int32 - InFamily sql.NullString -} - -type ListUsersByFamilyRow struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) - if err != nil { - return nil, err - } - defer rows.Close() - var items []ListUsersByFamilyRow - for rows.Next() { - var i ListUsersByFamilyRow - if err := rows.Scan(&i.FirstName, &i.LastName); 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 listUsersByID = `-- name: ListUsersByID :many -SELECT first_name, id, last_name FROM users WHERE id < $1 -` - -type ListUsersByIDRow struct { - FirstName string - ID int32 - LastName sql.NullString -} - -func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByID, id) - if err != nil { - return nil, err - } - defer rows.Close() - var items []ListUsersByIDRow - for rows.Next() { - var i ListUsersByIDRow - if err := rows.Scan(&i.FirstName, &i.ID, &i.LastName); 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 listUsersWithLimit = `-- name: ListUsersWithLimit :many -SELECT first_name, last_name FROM users LIMIT $1 -` - -type ListUsersWithLimitRow struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []ListUsersWithLimitRow - for rows.Next() { - var i ListUsersWithLimitRow - if err := rows.Scan(&i.FirstName, &i.LastName); 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_location/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/params_location/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..9a2addf733 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/jackc/pgtype" +) + +type Order struct { + ID int32 + Price pgtype.Numeric + UserID int32 +} + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + JobStatus string +} 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 new file mode 100644 index 0000000000..2422761542 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,241 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/jackc/pgtype" +) + +const getUserByID = `-- name: GetUserByID :one +SELECT first_name, id, last_name FROM users WHERE id = $1 +` + +type GetUserByIDRow struct { + FirstName string + ID int32 + LastName sql.NullString +} + +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { + row := q.db.QueryRow(ctx, getUserByID, targetID) + var i GetUserByIDRow + err := row.Scan(&i.FirstName, &i.ID, &i.LastName) + return i, err +} + +const insertNewUser = `-- name: InsertNewUser :exec +INSERT INTO users (first_name, last_name) VALUES ($1, $2) +` + +type InsertNewUserParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { + _, err := q.db.Exec(ctx, insertNewUser, arg.FirstName, arg.LastName) + return err +} + +const limitSQLCArg = `-- name: LimitSQLCArg :many +select first_name, id FROM users LIMIT $1 +` + +type LimitSQLCArgRow struct { + FirstName string + ID int32 +} + +func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { + rows, err := q.db.Query(ctx, limitSQLCArg, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LimitSQLCArgRow + for rows.Next() { + var i LimitSQLCArgRow + if err := rows.Scan(&i.FirstName, &i.ID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUserOrders = `-- name: ListUserOrders :many +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > $1 +` + +type ListUserOrdersRow struct { + ID sql.NullInt32 + FirstName sql.NullString + Price pgtype.Numeric +} + +func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ([]ListUserOrdersRow, error) { + rows, err := q.db.Query(ctx, listUserOrders, minPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUserOrdersRow + for rows.Next() { + var i ListUserOrdersRow + if err := rows.Scan(&i.ID, &i.FirstName, &i.Price); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUserParenExpr = `-- name: ListUserParenExpr :many +SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2 +` + +type ListUserParenExprParams struct { + ID int32 + Limit int32 +} + +func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { + rows, err := q.db.Query(ctx, listUserParenExpr, arg.ID, arg.Limit) + 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.FirstName, + &i.LastName, + &i.Age, + &i.JobStatus, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersByFamily = `-- name: ListUsersByFamily :many +SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 +` + +type ListUsersByFamilyParams struct { + MaxAge int32 + InFamily sql.NullString +} + +type ListUsersByFamilyRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { + rows, err := q.db.Query(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByFamilyRow + for rows.Next() { + var i ListUsersByFamilyRow + if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersByID = `-- name: ListUsersByID :many +SELECT first_name, id, last_name FROM users WHERE id < $1 +` + +type ListUsersByIDRow struct { + FirstName string + ID int32 + LastName sql.NullString +} + +func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { + rows, err := q.db.Query(ctx, listUsersByID, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByIDRow + for rows.Next() { + var i ListUsersByIDRow + if err := rows.Scan(&i.FirstName, &i.ID, &i.LastName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersWithLimit = `-- name: ListUsersWithLimit :many +SELECT first_name, last_name FROM users LIMIT $1 +` + +type ListUsersWithLimitRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { + rows, err := q.db.Query(ctx, listUsersWithLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersWithLimitRow + for rows.Next() { + var i ListUsersWithLimitRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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/params_location/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..7f973bf409 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql @@ -0,0 +1,33 @@ +/* name: ListUsersByID :many */ +SELECT first_name, id, last_name FROM users WHERE id < $1; + +/* name: ListUserOrders :many */ +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > sqlc.arg('min_price'); + +/* name: GetUserByID :one */ +SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); + +/* name: ListUsersByFamily :many */ +SELECT first_name, last_name FROM users WHERE age < sqlc.arg('max_age') AND last_name = sqlc.arg('in_family'); + +/* name: ListUsersWithLimit :many */ +SELECT first_name, last_name FROM users LIMIT $1; + +/* name: LimitSQLCArg :many */ +select first_name, id FROM users LIMIT $1; + +/* name: InsertNewUser :exec */ +INSERT INTO users (first_name, last_name) VALUES ($1, $2); + +/* name: ListUserParenExpr :many */ +SELECT * FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2; diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/params_location/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ac0e7e3 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Order struct { + ID int32 + Price pgtype.Numeric + UserID int32 +} + +type User struct { + ID int32 + FirstName string + LastName pgtype.Text + Age int32 + JobStatus string +} 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 new file mode 100644 index 0000000000..5df3216911 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,240 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getUserByID = `-- name: GetUserByID :one +SELECT first_name, id, last_name FROM users WHERE id = $1 +` + +type GetUserByIDRow struct { + FirstName string + ID int32 + LastName pgtype.Text +} + +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { + row := q.db.QueryRow(ctx, getUserByID, targetID) + var i GetUserByIDRow + err := row.Scan(&i.FirstName, &i.ID, &i.LastName) + return i, err +} + +const insertNewUser = `-- name: InsertNewUser :exec +INSERT INTO users (first_name, last_name) VALUES ($1, $2) +` + +type InsertNewUserParams struct { + FirstName string + LastName pgtype.Text +} + +func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { + _, err := q.db.Exec(ctx, insertNewUser, arg.FirstName, arg.LastName) + return err +} + +const limitSQLCArg = `-- name: LimitSQLCArg :many +select first_name, id FROM users LIMIT $1 +` + +type LimitSQLCArgRow struct { + FirstName string + ID int32 +} + +func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { + rows, err := q.db.Query(ctx, limitSQLCArg, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LimitSQLCArgRow + for rows.Next() { + var i LimitSQLCArgRow + if err := rows.Scan(&i.FirstName, &i.ID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUserOrders = `-- name: ListUserOrders :many +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > $1 +` + +type ListUserOrdersRow struct { + ID pgtype.Int4 + FirstName pgtype.Text + Price pgtype.Numeric +} + +func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ([]ListUserOrdersRow, error) { + rows, err := q.db.Query(ctx, listUserOrders, minPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUserOrdersRow + for rows.Next() { + var i ListUserOrdersRow + if err := rows.Scan(&i.ID, &i.FirstName, &i.Price); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUserParenExpr = `-- name: ListUserParenExpr :many +SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2 +` + +type ListUserParenExprParams struct { + ID int32 + Limit int32 +} + +func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { + rows, err := q.db.Query(ctx, listUserParenExpr, arg.ID, arg.Limit) + 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.FirstName, + &i.LastName, + &i.Age, + &i.JobStatus, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersByFamily = `-- name: ListUsersByFamily :many +SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 +` + +type ListUsersByFamilyParams struct { + MaxAge int32 + InFamily pgtype.Text +} + +type ListUsersByFamilyRow struct { + FirstName string + LastName pgtype.Text +} + +func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { + rows, err := q.db.Query(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByFamilyRow + for rows.Next() { + var i ListUsersByFamilyRow + if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersByID = `-- name: ListUsersByID :many +SELECT first_name, id, last_name FROM users WHERE id < $1 +` + +type ListUsersByIDRow struct { + FirstName string + ID int32 + LastName pgtype.Text +} + +func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { + rows, err := q.db.Query(ctx, listUsersByID, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByIDRow + for rows.Next() { + var i ListUsersByIDRow + if err := rows.Scan(&i.FirstName, &i.ID, &i.LastName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUsersWithLimit = `-- name: ListUsersWithLimit :many +SELECT first_name, last_name FROM users LIMIT $1 +` + +type ListUsersWithLimitRow struct { + FirstName string + LastName pgtype.Text +} + +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { + rows, err := q.db.Query(ctx, listUsersWithLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersWithLimitRow + for rows.Next() { + var i ListUsersWithLimitRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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/params_location/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..7f973bf409 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql @@ -0,0 +1,33 @@ +/* name: ListUsersByID :many */ +SELECT first_name, id, last_name FROM users WHERE id < $1; + +/* name: ListUserOrders :many */ +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > sqlc.arg('min_price'); + +/* name: GetUserByID :one */ +SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); + +/* name: ListUsersByFamily :many */ +SELECT first_name, last_name FROM users WHERE age < sqlc.arg('max_age') AND last_name = sqlc.arg('in_family'); + +/* name: ListUsersWithLimit :many */ +SELECT first_name, last_name FROM users LIMIT $1; + +/* name: LimitSQLCArg :many */ +select first_name, id FROM users LIMIT $1; + +/* name: InsertNewUser :exec */ +INSERT INTO users (first_name, last_name) VALUES ($1, $2); + +/* name: ListUserParenExpr :many */ +SELECT * FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2; diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/params_location/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/params_location/postgresql/query.sql b/internal/endtoend/testdata/params_location/postgresql/query.sql deleted file mode 100644 index 7bec1be5c5..0000000000 --- a/internal/endtoend/testdata/params_location/postgresql/query.sql +++ /dev/null @@ -1,47 +0,0 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -); - -CREATE TABLE orders ( - id SERIAL NOT NULL, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -); - -/* name: ListUsersByID :many */ -SELECT first_name, id, last_name FROM users WHERE id < $1; - -/* name: ListUserOrders :many */ -SELECT - users.id, - users.first_name, - orders.price -FROM - orders -LEFT JOIN users ON orders.user_id = users.id -WHERE orders.price > sqlc.arg('min_price'); - -/* name: GetUserByID :one */ -SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); - -/* name: ListUsersByFamily :many */ -SELECT first_name, last_name FROM users WHERE age < sqlc.arg('max_age') AND last_name = sqlc.arg('in_family'); - -/* name: ListUsersWithLimit :many */ -SELECT first_name, last_name FROM users LIMIT $1; - -/* name: LimitSQLCArg :many */ -select first_name, id FROM users LIMIT $1; - -/* name: InsertNewUser :exec */ -INSERT INTO users (first_name, last_name) VALUES ($1, $2); - -/* name: ListUserParenExpr :many */ -SELECT * FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') -AND id > $1 -ORDER BY id -LIMIT $2; diff --git a/internal/endtoend/testdata/params_location/postgresql/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/sqlc.json deleted file mode 100644 index 696ed223db..0000000000 --- a/internal/endtoend/testdata/params_location/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "name": "querytest", - "path": "go", - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql" - } - ] -} diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json b/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_location/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..54ca4ce9d6 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Order struct { + ID int32 + Price string + UserID int32 +} + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 + JobStatus string +} 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 new file mode 100644 index 0000000000..6f4b961034 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,257 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getUserByID = `-- name: GetUserByID :one +SELECT first_name, id, last_name FROM users WHERE id = $1 +` + +type GetUserByIDRow struct { + FirstName string + ID int32 + LastName sql.NullString +} + +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { + row := q.db.QueryRowContext(ctx, getUserByID, targetID) + var i GetUserByIDRow + err := row.Scan(&i.FirstName, &i.ID, &i.LastName) + return i, err +} + +const insertNewUser = `-- name: InsertNewUser :exec +INSERT INTO users (first_name, last_name) VALUES ($1, $2) +` + +type InsertNewUserParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { + _, err := q.db.ExecContext(ctx, insertNewUser, arg.FirstName, arg.LastName) + return err +} + +const limitSQLCArg = `-- name: LimitSQLCArg :many +select first_name, id FROM users LIMIT $1 +` + +type LimitSQLCArgRow struct { + FirstName string + ID int32 +} + +func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { + rows, err := q.db.QueryContext(ctx, limitSQLCArg, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []LimitSQLCArgRow + for rows.Next() { + var i LimitSQLCArgRow + if err := rows.Scan(&i.FirstName, &i.ID); 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 listUserOrders = `-- name: ListUserOrders :many +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > $1 +` + +type ListUserOrdersRow struct { + ID sql.NullInt32 + FirstName sql.NullString + Price string +} + +func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUserOrdersRow, error) { + rows, err := q.db.QueryContext(ctx, listUserOrders, minPrice) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUserOrdersRow + for rows.Next() { + var i ListUserOrdersRow + if err := rows.Scan(&i.ID, &i.FirstName, &i.Price); 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 listUserParenExpr = `-- name: ListUserParenExpr :many +SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2 +` + +type ListUserParenExprParams struct { + ID int32 + Limit int32 +} + +func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { + rows, err := q.db.QueryContext(ctx, listUserParenExpr, arg.ID, arg.Limit) + 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.FirstName, + &i.LastName, + &i.Age, + &i.JobStatus, + ); 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 listUsersByFamily = `-- name: ListUsersByFamily :many +SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 +` + +type ListUsersByFamilyParams struct { + MaxAge int32 + InFamily sql.NullString +} + +type ListUsersByFamilyRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { + rows, err := q.db.QueryContext(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByFamilyRow + for rows.Next() { + var i ListUsersByFamilyRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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 listUsersByID = `-- name: ListUsersByID :many +SELECT first_name, id, last_name FROM users WHERE id < $1 +` + +type ListUsersByIDRow struct { + FirstName string + ID int32 + LastName sql.NullString +} + +func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { + rows, err := q.db.QueryContext(ctx, listUsersByID, id) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersByIDRow + for rows.Next() { + var i ListUsersByIDRow + if err := rows.Scan(&i.FirstName, &i.ID, &i.LastName); 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 listUsersWithLimit = `-- name: ListUsersWithLimit :many +SELECT first_name, last_name FROM users LIMIT $1 +` + +type ListUsersWithLimitRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { + rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersWithLimitRow + for rows.Next() { + var i ListUsersWithLimitRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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_location/postgresql/stdlib/query.sql b/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..7f973bf409 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql @@ -0,0 +1,33 @@ +/* name: ListUsersByID :many */ +SELECT first_name, id, last_name FROM users WHERE id < $1; + +/* name: ListUserOrders :many */ +SELECT + users.id, + users.first_name, + orders.price +FROM + orders +LEFT JOIN users ON orders.user_id = users.id +WHERE orders.price > sqlc.arg('min_price'); + +/* name: GetUserByID :one */ +SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); + +/* name: ListUsersByFamily :many */ +SELECT first_name, last_name FROM users WHERE age < sqlc.arg('max_age') AND last_name = sqlc.arg('in_family'); + +/* name: ListUsersWithLimit :many */ +SELECT first_name, last_name FROM users LIMIT $1; + +/* name: LimitSQLCArg :many */ +select first_name, id FROM users LIMIT $1; + +/* name: InsertNewUser :exec */ +INSERT INTO users (first_name, last_name) VALUES ($1, $2); + +/* name: ListUserParenExpr :many */ +SELECT * FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') +AND id > $1 +ORDER BY id +LIMIT $2; diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f5a835c5a6 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_placeholder_in_left_expr/mysql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go new file mode 100644 index 0000000000..6ed28e2de9 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + Name sql.NullString +} 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 new file mode 100644 index 0000000000..57aba80593 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const findByID = `-- name: FindByID :many +SELECT id, name FROM users WHERE ? = id +` + +func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { + rows, err := q.db.QueryContext(ctx, findByID, id) + 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.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 findByIDAndName = `-- name: FindByIDAndName :many +SELECT id, name FROM users WHERE ? = id AND ? = name +` + +type FindByIDAndNameParams struct { + ID int32 + Name sql.NullString +} + +func (q *Queries) FindByIDAndName(ctx context.Context, arg FindByIDAndNameParams) ([]User, error) { + rows, err := q.db.QueryContext(ctx, findByIDAndName, arg.ID, arg.Name) + 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.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/params_placeholder_in_left_expr/mysql/query.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql new file mode 100644 index 0000000000..e241f76a7a --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql @@ -0,0 +1,5 @@ +-- name: FindByID :many +SELECT * FROM users WHERE ? = id; + +-- name: FindByIDAndName :many +SELECT * FROM users WHERE ? = id AND ? = name; diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql new file mode 100644 index 0000000000..b2c6d8d14e --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) +) ENGINE=InnoDB; + diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/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/params_placeholder_in_left_expr/postgresql/exec.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_placeholder_in_left_expr/postgresql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go new file mode 100644 index 0000000000..6ed28e2de9 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + Name sql.NullString +} 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 new file mode 100644 index 0000000000..a04cba9fe0 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const findByID = `-- name: FindByID :many +SELECT id, name FROM users WHERE $1 = id +` + +func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { + rows, err := q.db.QueryContext(ctx, findByID, id) + 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.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 findByIDAndName = `-- name: FindByIDAndName :many +SELECT id, name FROM users WHERE $1 = id AND $1 = name +` + +func (q *Queries) FindByIDAndName(ctx context.Context, id int32) ([]User, error) { + rows, err := q.db.QueryContext(ctx, findByIDAndName, id) + 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.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/params_placeholder_in_left_expr/postgresql/query.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql new file mode 100644 index 0000000000..50b95ea32e --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql @@ -0,0 +1,5 @@ +-- name: FindByID :many +SELECT * FROM users WHERE $1 = id; + +-- name: FindByIDAndName :many +SELECT * FROM users WHERE $1 = id AND $1 = name; diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql new file mode 100644 index 0000000000..33ca489ae5 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INT PRIMARY KEY, + name VARCHAR(255) +); + diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/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/params_two/mysql/go/db.go b/internal/endtoend/testdata/params_two/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/db.go +++ b/internal/endtoend/testdata/params_two/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/go/models.go b/internal/endtoend/testdata/params_two/mysql/go/models.go index ce7117644a..de35bade9f 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/models.go +++ b/internal/endtoend/testdata/params_two/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 5923f74be0..9f1edc6aef 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/query.sql b/internal/endtoend/testdata/params_two/mysql/query.sql index ca95df9cef..66937099c3 100644 --- a/internal/endtoend/testdata/params_two/mysql/query.sql +++ b/internal/endtoend/testdata/params_two/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - /* name: FooByAandB :many */ SELECT a, b FROM foo WHERE a = ? and b = ?; diff --git a/internal/endtoend/testdata/params_two/mysql/schema.sql b/internal/endtoend/testdata/params_two/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/mysql/sqlc.json b/internal/endtoend/testdata/params_two/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/params_two/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_two/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/params_two/postgresql/go/db.go b/internal/endtoend/testdata/params_two/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/params_two/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_two/postgresql/go/models.go b/internal/endtoend/testdata/params_two/postgresql/go/models.go deleted file mode 100644 index ce7117644a..0000000000 --- a/internal/endtoend/testdata/params_two/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/params_two/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/go/query.sql.go deleted file mode 100644 index 0d556e75f6..0000000000 --- a/internal/endtoend/testdata/params_two/postgresql/go/query.sql.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const fooByAandB = `-- name: FooByAandB :many -SELECT a, b FROM foo -WHERE a = $1 and b = $2 -` - -type FooByAandBParams struct { - A sql.NullString - B sql.NullString -} - -func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByAandB, arg.A, arg.B) - 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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/params_two/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..da0ea85d0d --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooByAandB = `-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2 +` + +type FooByAandBParams struct { + A sql.NullString + B sql.NullString +} + +func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, fooByAandB, arg.A, arg.B) + 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 +} diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..83fd1ea40c --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/params_two/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..3ee86d8810 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..5c7953cc70 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const fooByAandB = `-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2 +` + +type FooByAandBParams struct { + A pgtype.Text + B pgtype.Text +} + +func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, fooByAandB, arg.A, arg.B) + 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 +} diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..83fd1ea40c --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/params_two/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/params_two/postgresql/query.sql b/internal/endtoend/testdata/params_two/postgresql/query.sql deleted file mode 100644 index 20b49184ce..0000000000 --- a/internal/endtoend/testdata/params_two/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE foo (a text, b text); - --- name: FooByAandB :many -SELECT a, b FROM foo -WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/params_two/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_two/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..5797bf0f08 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooByAandB = `-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2 +` + +type FooByAandBParams struct { + A sql.NullString + B sql.NullString +} + +func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, fooByAandB, arg.A, arg.B) + 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 +} diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql b/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..83fd1ea40c --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: FooByAandB :many +SELECT a, b FROM foo +WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/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/pattern_in_expr/mysql/go/db.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pattern_in_expr/mysql/go/models.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go new file mode 100644 index 0000000000..41f892cc4a --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + B sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..7fdf362fca --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go @@ -0,0 +1,129 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooByBarB = `-- name: FooByBarB :many +SELECT a, b from foo where foo.a in (select a from bar where bar.b = ?) +` + +func (q *Queries) FooByBarB(ctx context.Context, b sql.NullString) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, fooByBarB, b) + 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 fooByList = `-- name: FooByList :many +SELECT a, b from foo where foo.a in (?, ?) +` + +type FooByListParams struct { + A sql.NullString + A_2 sql.NullString +} + +func (q *Queries) FooByList(ctx context.Context, arg FooByListParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, fooByList, arg.A, arg.A_2) + 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 fooByNotList = `-- name: FooByNotList :many +SELECT a, b from foo where foo.a not in (?, ?) +` + +type FooByNotListParams struct { + A sql.NullString + A_2 sql.NullString +} + +func (q *Queries) FooByNotList(ctx context.Context, arg FooByNotListParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, fooByNotList, arg.A, arg.A_2) + 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 fooByParamList = `-- name: FooByParamList :many +SELECT a, b from foo where ? in (foo.a, foo.b) +` + +func (q *Queries) FooByParamList(ctx context.Context, a sql.NullString) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, fooByParamList, a) + 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 +} diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql b/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql new file mode 100644 index 0000000000..f2c378384d --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql @@ -0,0 +1,11 @@ +/* name: FooByBarB :many */ +SELECT a, b from foo where foo.a in (select a from bar where bar.b = ?); + +/* name: FooByList :many */ +SELECT a, b from foo where foo.a in (?, ?); + +/* name: FooByNotList :many */ +SELECT a, b from foo where foo.a not in (?, ?); + +/* name: FooByParamList :many */ +SELECT a, b from foo where ? in (foo.a, foo.b); diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql b/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql new file mode 100644 index 0000000000..98a197f8f2 --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json b/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/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/pattern_matching/mysql/go/db.go b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pattern_matching/mysql/go/models.go b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go new file mode 100644 index 0000000000..a6a5f8c7bb --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Pet struct { + Name sql.NullString +} diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go new file mode 100644 index 0000000000..447ffb9e92 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const petsByName = `-- name: PetsByName :many +SELECT name FROM pet WHERE name LIKE ? +` + +func (q *Queries) PetsByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, petsByName, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var name sql.NullString + 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 +} diff --git a/internal/endtoend/testdata/pattern_matching/mysql/query.sql b/internal/endtoend/testdata/pattern_matching/mysql/query.sql new file mode 100644 index 0000000000..02327ed734 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: PetsByName :many +SELECT * FROM pet WHERE name LIKE ?; diff --git a/internal/endtoend/testdata/pattern_matching/mysql/schema.sql b/internal/endtoend/testdata/pattern_matching/mysql/schema.sql new file mode 100644 index 0000000000..8133f35e31 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE pet (name text); + diff --git a/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json b/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/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/pattern_matching/postgresql/go/db.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pattern_matching/postgresql/go/models.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go new file mode 100644 index 0000000000..a6a5f8c7bb --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Pet struct { + Name sql.NullString +} diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go new file mode 100644 index 0000000000..2c8760f573 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const petsByName = `-- name: PetsByName :many +SELECT name FROM pet WHERE name LIKE $1 +` + +func (q *Queries) PetsByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, petsByName, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var name sql.NullString + 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 +} diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/query.sql b/internal/endtoend/testdata/pattern_matching/postgresql/query.sql new file mode 100644 index 0000000000..6fef93e5dc --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: PetsByName :many +SELECT * FROM pet WHERE name LIKE $1; diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql b/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql new file mode 100644 index 0000000000..8133f35e31 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE pet (name text); + diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json b/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/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/pg_advisory_xact_lock/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/pg_advisory_xact_lock/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/go/exec.sql.go deleted file mode 100644 index f7260e08bf..0000000000 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/go/exec.sql.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: exec.sql - -package querytest - -import ( - "context" -) - -const advisoryLockExec = `-- name: AdvisoryLockExec :exec -SELECT pg_advisory_lock($1) -` - -func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { - _, err := q.db.ExecContext(ctx, advisoryLockExec, pgAdvisoryLock) - return err -} - -const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows -SELECT pg_advisory_lock($1) -` - -func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { - result, err := q.db.ExecContext(ctx, advisoryLockExecRows, pgAdvisoryLock) - if err != nil { - return 0, err - } - return result.RowsAffected() -} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/go/query.sql.go deleted file mode 100644 index aff1569644..0000000000 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/go/query.sql.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult -SELECT pg_advisory_lock($1) -` - -func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (sql.Result, error) { - return q.db.ExecContext(ctx, advisoryLockExecResult, pgAdvisoryLock) -} - -const advisoryLockOne = `-- name: AdvisoryLockOne :one -SELECT pg_advisory_lock($1) -` - -func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { - row := q.db.QueryRowContext(ctx, advisoryLockOne, pgAdvisoryLock) - var pg_advisory_lock interface{} - err := row.Scan(&pg_advisory_lock) - return pg_advisory_lock, err -} - -const advisoryUnlock = `-- name: AdvisoryUnlock :many -SELECT pg_advisory_unlock($1) -` - -func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, advisoryUnlock, pgAdvisoryUnlock) - if err != nil { - return nil, err - } - defer rows.Close() - var items []bool - for rows.Next() { - var pg_advisory_unlock bool - if err := rows.Scan(&pg_advisory_unlock); err != nil { - return nil, err - } - items = append(items, pg_advisory_unlock) - } - 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/pg_advisory_xact_lock/exec.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/exec.sql similarity index 100% rename from internal/endtoend/testdata/pg_advisory_xact_lock/exec.sql rename to internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/exec.sql 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_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 new file mode 100644 index 0000000000..b2064e0ae9 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: exec.sql + +package querytest + +import ( + "context" +) + +const advisoryLockExec = `-- name: AdvisoryLockExec :exec +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { + _, err := q.db.Exec(ctx, advisoryLockExec, pgAdvisoryLock) + return err +} + +const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { + result, err := q.db.Exec(ctx, advisoryLockExecRows, pgAdvisoryLock) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} 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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..75c3f3fbfc --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" +) + +const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, advisoryLockExecResult, pgAdvisoryLock) +} + +const advisoryLockOne = `-- name: AdvisoryLockOne :one +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { + row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) + var pg_advisory_lock interface{} + err := row.Scan(&pg_advisory_lock) + return pg_advisory_lock, err +} + +const advisoryUnlock = `-- name: AdvisoryUnlock :many +SELECT pg_advisory_unlock($1) +` + +func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { + rows, err := q.db.Query(ctx, advisoryUnlock, pgAdvisoryUnlock) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var pg_advisory_unlock bool + if err := rows.Scan(&pg_advisory_unlock); err != nil { + return nil, err + } + items = append(items, pg_advisory_unlock) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/query.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/pg_advisory_xact_lock/query.sql rename to internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..a632d53590 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": ["query.sql", "exec.sql"] + } + ] +} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/exec.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/exec.sql new file mode 100644 index 0000000000..3f032b3020 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/exec.sql @@ -0,0 +1,5 @@ +-- name: AdvisoryLockExec :exec +SELECT pg_advisory_lock($1); + +-- name: AdvisoryLockExecRows :execrows +SELECT pg_advisory_lock($1); 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_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 new file mode 100644 index 0000000000..b2064e0ae9 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: exec.sql + +package querytest + +import ( + "context" +) + +const advisoryLockExec = `-- name: AdvisoryLockExec :exec +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { + _, err := q.db.Exec(ctx, advisoryLockExec, pgAdvisoryLock) + return err +} + +const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { + result, err := q.db.Exec(ctx, advisoryLockExecRows, pgAdvisoryLock) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} 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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..2b71b44b77 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgconn" +) + +const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (pgconn.CommandTag, error) { + return q.db.Exec(ctx, advisoryLockExecResult, pgAdvisoryLock) +} + +const advisoryLockOne = `-- name: AdvisoryLockOne :one +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { + row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) + var pg_advisory_lock interface{} + err := row.Scan(&pg_advisory_lock) + return pg_advisory_lock, err +} + +const advisoryUnlock = `-- name: AdvisoryUnlock :many +SELECT pg_advisory_unlock($1) +` + +func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { + rows, err := q.db.Query(ctx, advisoryUnlock, pgAdvisoryUnlock) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var pg_advisory_unlock bool + if err := rows.Scan(&pg_advisory_unlock); err != nil { + return nil, err + } + items = append(items, pg_advisory_unlock) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..aeb36c80dc --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: AdvisoryLockOne :one +SELECT pg_advisory_lock($1); + +-- name: AdvisoryUnlock :many +SELECT pg_advisory_unlock($1); + +-- name: AdvisoryLockExecResult :execresult +SELECT pg_advisory_lock($1); diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..a780e051c0 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/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", "exec.sql"] + } + ] +} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/exec.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/exec.sql new file mode 100644 index 0000000000..3f032b3020 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/exec.sql @@ -0,0 +1,5 @@ +-- name: AdvisoryLockExec :exec +SELECT pg_advisory_lock($1); + +-- name: AdvisoryLockExecRows :execrows +SELECT pg_advisory_lock($1); 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go new file mode 100644 index 0000000000..4c03334188 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: exec.sql + +package querytest + +import ( + "context" +) + +const advisoryLockExec = `-- name: AdvisoryLockExec :exec +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { + _, err := q.db.ExecContext(ctx, advisoryLockExec, pgAdvisoryLock) + return err +} + +const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { + result, err := q.db.ExecContext(ctx, advisoryLockExecRows, pgAdvisoryLock) + if err != nil { + return 0, err + } + return result.RowsAffected() +} 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 new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..49fc5359d6 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (sql.Result, error) { + return q.db.ExecContext(ctx, advisoryLockExecResult, pgAdvisoryLock) +} + +const advisoryLockOne = `-- name: AdvisoryLockOne :one +SELECT pg_advisory_lock($1) +` + +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { + row := q.db.QueryRowContext(ctx, advisoryLockOne, pgAdvisoryLock) + var pg_advisory_lock interface{} + err := row.Scan(&pg_advisory_lock) + return pg_advisory_lock, err +} + +const advisoryUnlock = `-- name: AdvisoryUnlock :many +SELECT pg_advisory_unlock($1) +` + +func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, advisoryUnlock, pgAdvisoryUnlock) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var pg_advisory_unlock bool + if err := rows.Scan(&pg_advisory_unlock); err != nil { + return nil, err + } + items = append(items, pg_advisory_unlock) + } + 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/pg_advisory_xact_lock/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..aeb36c80dc --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: AdvisoryLockOne :one +SELECT pg_advisory_lock($1); + +-- name: AdvisoryUnlock :many +SELECT pg_advisory_unlock($1); + +-- name: AdvisoryLockExecResult :execresult +SELECT pg_advisory_lock($1); diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..af1dbd0eb1 --- /dev/null +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": ["query.sql", "exec.sql"] + } + ] +} diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/sqlc.json deleted file mode 100644 index 8e35e82ef5..0000000000 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": ["query.sql", "exec.sql"] - } - ] -} diff --git a/internal/endtoend/testdata/pg_dump/db/db.go b/internal/endtoend/testdata/pg_dump/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_dump/db/models.go b/internal/endtoend/testdata/pg_dump/db/models.go new file mode 100644 index 0000000000..5041799d54 --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/pg_dump/db/query.sql.go b/internal/endtoend/testdata/pg_dump/db/query.sql.go new file mode 100644 index 0000000000..85c204d6fb --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/db/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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/pg_dump/exec.json b/internal/endtoend/testdata/pg_dump/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/pg_dump/query.sql b/internal/endtoend/testdata/pg_dump/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/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/pg_dump/schema.sql b/internal/endtoend/testdata/pg_dump/schema.sql new file mode 100644 index 0000000000..06bfb9d37c --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/schema.sql @@ -0,0 +1,89 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.3 (Debian 15.3-1.pgdg120+1) +-- Dumped by pg_dump version 15.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: public; Type: SCHEMA; Schema: -; Owner: pg_database_owner +-- + +CREATE SCHEMA public; + + +ALTER SCHEMA public OWNER TO pg_database_owner; + +-- +-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: pg_database_owner +-- + +COMMENT ON SCHEMA public IS 'standard public schema'; + + +SET default_table_access_method = heap; + +-- +-- Name: authors; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.authors ( + id bigint NOT NULL, + name text NOT NULL, + bio text +); + + +ALTER TABLE public.authors OWNER TO postgres; + +-- +-- Name: authors_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.authors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.authors_id_seq OWNER TO postgres; + +-- +-- Name: authors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.authors_id_seq OWNED BY public.authors.id; + + +-- +-- Name: authors id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.authors ALTER COLUMN id SET DEFAULT nextval('public.authors_id_seq'::regclass); + + +-- +-- Name: authors authors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.authors + ADD CONSTRAINT authors_pkey PRIMARY KEY (id); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/endtoend/testdata/pg_dump/sqlc.json b/internal/endtoend/testdata/pg_dump/sqlc.json new file mode 100644 index 0000000000..a682c52d42 --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/pg_ext_ltree/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/pg_ext_ltree/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/pg_ext_ltree/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/go/models.go deleted file mode 100644 index 7e9881aaeb..0000000000 --- a/internal/endtoend/testdata/pg_ext_ltree/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - QualifiedName sql.NullString - NameQuery sql.NullString - FtsNameQuery sql.NullString -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_ext_ltree/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..54e621c88d --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + QualifiedName sql.NullString + NameQuery sql.NullString + FtsNameQuery sql.NullString +} 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 new file mode 100644 index 0000000000..31921b6bc1 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); 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_ext_ltree/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_ext_ltree/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..ad35c8fc69 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + QualifiedName pgtype.Text + NameQuery pgtype.Text + FtsNameQuery pgtype.Text +} 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 new file mode 100644 index 0000000000..31921b6bc1 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); 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_ext_ltree/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/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/pg_ext_ltree/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_ext_ltree/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..54e621c88d --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + QualifiedName sql.NullString + NameQuery sql.NullString + FtsNameQuery sql.NullString +} 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 new file mode 100644 index 0000000000..762e65ce5b --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); 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/pg_ext_ltree/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b475d29f5e --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/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/pg_ext_ltree/query.sql b/internal/endtoend/testdata/pg_ext_ltree/query.sql deleted file mode 100644 index b64921789f..0000000000 --- a/internal/endtoend/testdata/pg_ext_ltree/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS ltree; - -CREATE TABLE foo ( - qualified_name ltree, - name_query lquery, - fts_name_query ltxtquery -); - -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/pg_ext_ltree/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/pg_extensions/go/db.go b/internal/endtoend/testdata/pg_extensions/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/pg_extensions/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/pg_extensions/go/models.go b/internal/endtoend/testdata/pg_extensions/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/pg_extensions/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/go/pg_trgm.sql.go deleted file mode 100644 index 4a383673d9..0000000000 --- a/internal/endtoend/testdata/pg_extensions/go/pg_trgm.sql.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: pg_trgm.sql - -package querytest - -import ( - "context" -) - -const wordSimilarity = `-- name: WordSimilarity :one -SELECT word_similarity('word', 'two words') -` - -func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { - row := q.db.QueryRowContext(ctx, wordSimilarity) - var word_similarity float32 - err := row.Scan(&word_similarity) - return word_similarity, err -} diff --git a/internal/endtoend/testdata/pg_extensions/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/go/pgcrypto.sql.go deleted file mode 100644 index d0a68a535d..0000000000 --- a/internal/endtoend/testdata/pg_extensions/go/pgcrypto.sql.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: pgcrypto.sql - -package querytest - -import ( - "context" -) - -const encodeDigest = `-- name: EncodeDigest :one -SELECT encode(digest($1, 'sha1'), 'hex') -` - -func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { - row := q.db.QueryRowContext(ctx, encodeDigest, digest) - var encode string - err := row.Scan(&encode) - return encode, err -} diff --git a/internal/endtoend/testdata/pg_extensions/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/go/uuid_ossp.sql.go deleted file mode 100644 index 42467318f8..0000000000 --- a/internal/endtoend/testdata/pg_extensions/go/uuid_ossp.sql.go +++ /dev/null @@ -1,21 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: uuid_ossp.sql - -package querytest - -import ( - "context" - - "github.com/google/uuid" -) - -const generateUUID = `-- name: GenerateUUID :one -SELECT uuid_generate_v4() -` - -func (q *Queries) GenerateUUID(ctx context.Context) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, generateUUID) - var uuid_generate_v4 uuid.UUID - err := row.Scan(&uuid_generate_v4) - return uuid_generate_v4, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_extensions/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..194612b305 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pg_trgm.sql + +package querytest + +import ( + "context" +) + +const wordSimilarity = `-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words') +` + +func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { + row := q.db.QueryRow(ctx, wordSimilarity) + var word_similarity float32 + err := row.Scan(&word_similarity) + return word_similarity, err +} 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 new file mode 100644 index 0000000000..af48da80f1 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pgcrypto.sql + +package querytest + +import ( + "context" +) + +const encodeDigest = `-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex') +` + +func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { + row := q.db.QueryRow(ctx, encodeDigest, digest) + var encode string + err := row.Scan(&encode) + return encode, err +} 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 new file mode 100644 index 0000000000..e59868c6f3 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: uuid_ossp.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const generateUUID = `-- name: GenerateUUID :one +SELECT uuid_generate_v4() +` + +func (q *Queries) GenerateUUID(ctx context.Context) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, generateUUID) + var uuid_generate_v4 uuid.UUID + err := row.Scan(&uuid_generate_v4) + return uuid_generate_v4, err +} diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql new file mode 100644 index 0000000000..f0edf0955a --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql @@ -0,0 +1,2 @@ +-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql new file mode 100644 index 0000000000..f1045a47f2 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql @@ -0,0 +1,3 @@ +-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex'); + diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql new file mode 100644 index 0000000000..1716962506 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql @@ -0,0 +1,2 @@ +-- name: GenerateUUID :one +SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..520995c96b --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_extensions/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..194612b305 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pg_trgm.sql + +package querytest + +import ( + "context" +) + +const wordSimilarity = `-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words') +` + +func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { + row := q.db.QueryRow(ctx, wordSimilarity) + var word_similarity float32 + err := row.Scan(&word_similarity) + return word_similarity, err +} 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 new file mode 100644 index 0000000000..af48da80f1 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pgcrypto.sql + +package querytest + +import ( + "context" +) + +const encodeDigest = `-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex') +` + +func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { + row := q.db.QueryRow(ctx, encodeDigest, digest) + var encode string + err := row.Scan(&encode) + return encode, err +} 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 new file mode 100644 index 0000000000..2d17d87349 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: uuid_ossp.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const generateUUID = `-- name: GenerateUUID :one +SELECT uuid_generate_v4() +` + +func (q *Queries) GenerateUUID(ctx context.Context) (pgtype.UUID, error) { + row := q.db.QueryRow(ctx, generateUUID) + var uuid_generate_v4 pgtype.UUID + err := row.Scan(&uuid_generate_v4) + return uuid_generate_v4, err +} diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql new file mode 100644 index 0000000000..f0edf0955a --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql @@ -0,0 +1,2 @@ +-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql new file mode 100644 index 0000000000..f1045a47f2 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql @@ -0,0 +1,3 @@ +-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex'); + diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql new file mode 100644 index 0000000000..1716962506 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql @@ -0,0 +1,2 @@ +-- name: GenerateUUID :one +SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..7fcfe047f2 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/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": "sql" + } + ] +} diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_extensions/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..ba8c0c9aff --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pg_trgm.sql + +package querytest + +import ( + "context" +) + +const wordSimilarity = `-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words') +` + +func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { + row := q.db.QueryRowContext(ctx, wordSimilarity) + var word_similarity float32 + err := row.Scan(&word_similarity) + return word_similarity, err +} 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 new file mode 100644 index 0000000000..248873db67 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: pgcrypto.sql + +package querytest + +import ( + "context" +) + +const encodeDigest = `-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex') +` + +func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { + row := q.db.QueryRowContext(ctx, encodeDigest, digest) + var encode string + err := row.Scan(&encode) + return encode, err +} 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 new file mode 100644 index 0000000000..7318c4d149 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: uuid_ossp.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const generateUUID = `-- name: GenerateUUID :one +SELECT uuid_generate_v4() +` + +func (q *Queries) GenerateUUID(ctx context.Context) (uuid.UUID, error) { + row := q.db.QueryRowContext(ctx, generateUUID) + var uuid_generate_v4 uuid.UUID + err := row.Scan(&uuid_generate_v4) + return uuid_generate_v4, err +} diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql new file mode 100644 index 0000000000..f0edf0955a --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql @@ -0,0 +1,2 @@ +-- name: WordSimilarity :one +SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql new file mode 100644 index 0000000000..f1045a47f2 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql @@ -0,0 +1,3 @@ +-- name: EncodeDigest :one +SELECT encode(digest($1, 'sha1'), 'hex'); + diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql new file mode 100644 index 0000000000..1716962506 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql @@ -0,0 +1,2 @@ +-- name: GenerateUUID :one +SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..c78a3298d9 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "sql" + } + ] +} diff --git a/internal/endtoend/testdata/pg_extensions/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/sql/pg_trgm.sql deleted file mode 100644 index 42f111ce00..0000000000 --- a/internal/endtoend/testdata/pg_extensions/sql/pg_trgm.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS "pg_trgm"; - --- name: WordSimilarity :one -SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/sql/pgcrypto.sql deleted file mode 100644 index 6c94a105c2..0000000000 --- a/internal/endtoend/testdata/pg_extensions/sql/pgcrypto.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS "pgcrypto"; - --- name: EncodeDigest :one -SELECT encode(digest($1, 'sha1'), 'hex'); - diff --git a/internal/endtoend/testdata/pg_extensions/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/sql/uuid_ossp.sql deleted file mode 100644 index 389375627f..0000000000 --- a/internal/endtoend/testdata/pg_extensions/sql/uuid_ossp.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - --- name: GenerateUUID :one -SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/sqlc.json b/internal/endtoend/testdata/pg_extensions/sqlc.json deleted file mode 100644 index d2f8a5054a..0000000000 --- a/internal/endtoend/testdata/pg_extensions/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "sql", - "queries": "sql" - } - ] -} diff --git a/internal/endtoend/testdata/pg_generate_series/go/db.go b/internal/endtoend/testdata/pg_generate_series/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/pg_generate_series/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/pg_generate_series/go/models.go b/internal/endtoend/testdata/pg_generate_series/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/pg_generate_series/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/go/query.sql.go deleted file mode 100644 index 63d113dc25..0000000000 --- a/internal/endtoend/testdata/pg_generate_series/go/query.sql.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "time" -) - -const generateSeries = `-- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp) -` - -type GenerateSeriesParams struct { - Column1 time.Time `json:"column_1"` - Column2 time.Time `json:"column_2"` -} - -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var generate_series string - if err := rows.Scan(&generate_series); err != nil { - return nil, err - } - items = append(items, generate_series) - } - 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/pg_generate_series/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_generate_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..5a2f13da51 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "time" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') +` + +type GenerateSeriesParams struct { + Column1 time.Time `json:"column_1"` + Column2 time.Time `json:"column_2"` +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var generate_series int64 + if err := rows.Scan(&generate_series); err != nil { + return nil, err + } + items = append(items, generate_series) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3d483e89ec --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..a1dead4a24 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/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_json_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_generate_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..b1afe1a0f3 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') +` + +type GenerateSeriesParams struct { + Column1 pgtype.Timestamp `json:"column_1"` + Column2 pgtype.Timestamp `json:"column_2"` +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var generate_series int64 + if err := rows.Scan(&generate_series); err != nil { + return nil, err + } + items = append(items, generate_series) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3d483e89ec --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..fff8b19a30 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/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_json_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_generate_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..3f78c01386 --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "time" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') +` + +type GenerateSeriesParams struct { + Column1 time.Time `json:"column_1"` + Column2 time.Time `json:"column_2"` +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var generate_series int64 + if err := rows.Scan(&generate_series); err != nil { + return nil, err + } + items = append(items, generate_series) + } + 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/pg_generate_series/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3d483e89ec --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GenerateSeries :many +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..bb6ecf409f --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/pg_generate_series/query.sql b/internal/endtoend/testdata/pg_generate_series/query.sql deleted file mode 100644 index c00238feda..0000000000 --- a/internal/endtoend/testdata/pg_generate_series/query.sql +++ /dev/null @@ -1,2 +0,0 @@ --- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp); diff --git a/internal/endtoend/testdata/pg_generate_series/sqlc.json b/internal/endtoend/testdata/pg_generate_series/sqlc.json deleted file mode 100644 index 60f9d7b09f..0000000000 --- a/internal/endtoend/testdata/pg_generate_series/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql", - "emit_json_tags": true - } - ] -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_timezone_names/go_pgx/v4/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..75e0538c92 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go @@ -0,0 +1,100 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getColumns = `-- name: GetColumns :many +SELECT table_name::text, column_name::text from information_schema.columns +` + +type GetColumnsRow struct { + TableName string + ColumnName string +} + +func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { + rows, err := q.db.Query(ctx, getColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetColumnsRow + for rows.Next() { + var i GetColumnsRow + if err := rows.Scan(&i.TableName, &i.ColumnName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getTables = `-- name: GetTables :many +SELECT table_name::text from information_schema.tables +` + +func (q *Queries) GetTables(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getTables) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var table_name string + if err := rows.Scan(&table_name); err != nil { + return nil, err + } + items = append(items, table_name) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getTimezones = `-- name: GetTimezones :many +SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names +` + +type GetTimezonesRow struct { + Name sql.NullString + Abbrev sql.NullString + UtcOffset sql.NullInt64 + IsDst sql.NullBool +} + +func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { + rows, err := q.db.Query(ctx, getTimezones) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTimezonesRow + for rows.Next() { + var i GetTimezonesRow + if err := rows.Scan( + &i.Name, + &i.Abbrev, + &i.UtcOffset, + &i.IsDst, + ); 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_timezone_names/go_pgx/v5/db.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_timezone_names/go_pgx/v5/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..6b36384a09 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getColumns = `-- name: GetColumns :many +SELECT table_name::text, column_name::text from information_schema.columns +` + +type GetColumnsRow struct { + TableName string + ColumnName string +} + +func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { + rows, err := q.db.Query(ctx, getColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetColumnsRow + for rows.Next() { + var i GetColumnsRow + if err := rows.Scan(&i.TableName, &i.ColumnName); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getTables = `-- name: GetTables :many +SELECT table_name::text from information_schema.tables +` + +func (q *Queries) GetTables(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getTables) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var table_name string + if err := rows.Scan(&table_name); err != nil { + return nil, err + } + items = append(items, table_name) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getTimezones = `-- name: GetTimezones :many +SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names +` + +type GetTimezonesRow struct { + Name pgtype.Text + Abbrev pgtype.Text + UtcOffset pgtype.Interval + IsDst pgtype.Bool +} + +func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { + rows, err := q.db.Query(ctx, getTimezones) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTimezonesRow + for rows.Next() { + var i GetTimezonesRow + if err := rows.Scan( + &i.Name, + &i.Abbrev, + &i.UtcOffset, + &i.IsDst, + ); 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_timezone_names/go_stdlib/db.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_timezone_names/go_stdlib/models.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..8b18058453 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go @@ -0,0 +1,109 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getColumns = `-- name: GetColumns :many +SELECT table_name::text, column_name::text from information_schema.columns +` + +type GetColumnsRow struct { + TableName string + ColumnName string +} + +func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, getColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetColumnsRow + for rows.Next() { + var i GetColumnsRow + if err := rows.Scan(&i.TableName, &i.ColumnName); 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 getTables = `-- name: GetTables :many +SELECT table_name::text from information_schema.tables +` + +func (q *Queries) GetTables(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getTables) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var table_name string + if err := rows.Scan(&table_name); err != nil { + return nil, err + } + items = append(items, table_name) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getTimezones = `-- name: GetTimezones :many +SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names +` + +type GetTimezonesRow struct { + Name sql.NullString + Abbrev sql.NullString + UtcOffset sql.NullInt64 + IsDst sql.NullBool +} + +func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { + rows, err := q.db.QueryContext(ctx, getTimezones) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTimezonesRow + for rows.Next() { + var i GetTimezonesRow + if err := rows.Scan( + &i.Name, + &i.Abbrev, + &i.UtcOffset, + &i.IsDst, + ); 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/pg_timezone_names/query.sql b/internal/endtoend/testdata/pg_timezone_names/query.sql new file mode 100644 index 0000000000..dc4310f4aa --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/query.sql @@ -0,0 +1,8 @@ +-- name: GetTimezones :many +SELECT * from pg_catalog.pg_timezone_names; + +-- name: GetTables :many +SELECT table_name::text from information_schema.tables; + +-- name: GetColumns :many +SELECT table_name::text, column_name::text from information_schema.columns; diff --git a/internal/endtoend/testdata/datatype/sql/query.sql b/internal/endtoend/testdata/pg_timezone_names/schema.sql similarity index 100% rename from internal/endtoend/testdata/datatype/sql/query.sql rename to internal/endtoend/testdata/pg_timezone_names/schema.sql diff --git a/internal/endtoend/testdata/pg_timezone_names/sqlc.json b/internal/endtoend/testdata/pg_timezone_names/sqlc.json new file mode 100644 index 0000000000..1f0b8cd3d6 --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/sqlc.json @@ -0,0 +1,40 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "sql_package": "pgx/v4", + "package": "querytest", + "out": "go_pgx/v4" + } + } + }, + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "sql_package": "pgx/v5", + "package": "querytest", + "out": "go_pgx/v5" + } + } + }, + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "out": "go_stdlib" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/pg_user_table/go/db.go b/internal/endtoend/testdata/pg_user_table/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/pg_user_table/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/pg_user_table/go/models.go b/internal/endtoend/testdata/pg_user_table/go/models.go deleted file mode 100644 index 6fc2fc8685..0000000000 --- a/internal/endtoend/testdata/pg_user_table/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type User struct { - ID int64 -} diff --git a/internal/endtoend/testdata/pg_user_table/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/go/query.sql.go deleted file mode 100644 index d84d2c087f..0000000000 --- a/internal/endtoend/testdata/pg_user_table/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const user = `-- name: User :many -SELECT "user".id FROM "user" -` - -func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, user) - 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/pg_user_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_user_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_user_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4debf38e23 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.Query(ctx, user) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/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/pg_user_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/pg_user_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..7a00bcb08b --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fc2d9b248e --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const user = `-- name: User :many +SELECT "user".id FROM "user" +` + +func (q *Queries) User(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, user) + 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/pg_user_table/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..64493569d3 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: User :many +SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/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/pg_user_table/query.sql b/internal/endtoend/testdata/pg_user_table/query.sql deleted file mode 100644 index 3191419956..0000000000 --- a/internal/endtoend/testdata/pg_user_table/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE "user" (id bigserial not null); - --- name: User :many -SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/sqlc.json b/internal/endtoend/testdata/pg_user_table/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/pg_user_table/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..5921a1e292 --- /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.30.0 + +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..20db5866bd --- /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.30.0 +// 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 new file mode 100644 index 0000000000..4e47262b7d --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/pointer_type_import/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..048c2f7457 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "time" + + "github.com/google/uuid" +) + +type Foo struct { + Bar *time.Time + Baz *uuid.UUID +} 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 new file mode 100644 index 0000000000..5c76759055 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const find = `-- name: Find :one +SELECT bar FROM foo WHERE baz = $1 +` + +func (q *Queries) Find(ctx context.Context, baz *uuid.UUID) (*time.Time, error) { + row := q.db.QueryRow(ctx, find, baz) + var bar *time.Time + err := row.Scan(&bar) + return bar, err +} + +const list = `-- name: List :many +SELECT bar, baz FROM foo +` + +func (q *Queries) List(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, list) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Baz); 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/pointer_type_import/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..b94846fce2 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: List :many +SELECT * FROM foo; + +-- name: Find :one +SELECT bar FROM foo WHERE baz = $1; diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..532ae9943b --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar date, baz uuid); + diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..56341eccdd --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "datatype", + "schema": "schema.sql", + "queries": "query.sql", + "emit_pointers_for_null_types": true + } + ] +} diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..2853d5f77e --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + + "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 +} + +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/pointer_type_import/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..af33c734e5 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "net/netip" +) + +type Foo struct { + Bar *netip.Addr + Baz *netip.Prefix +} 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 new file mode 100644 index 0000000000..2098df405f --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" + "net/netip" +) + +const find = `-- name: Find :one +SELECT bar FROM foo WHERE baz = $1 +` + +func (q *Queries) Find(ctx context.Context, baz *netip.Prefix) (*netip.Addr, error) { + row := q.db.QueryRow(ctx, find, baz) + var bar *netip.Addr + err := row.Scan(&bar) + return bar, err +} + +const list = `-- name: List :many +SELECT bar, baz FROM foo +` + +func (q *Queries) List(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, list) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Bar, &i.Baz); 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/pointer_type_import/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b94846fce2 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: List :many +SELECT * FROM foo; + +-- name: Find :one +SELECT bar FROM foo WHERE baz = $1; diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..4b28530e80 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar inet, baz cidr); + diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..7465088d1d --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "datatype", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go new file mode 100644 index 0000000000..e35a714344 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" + "fmt" +) + +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 +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +func Prepare(ctx context.Context, db DBTX) (*Queries, error) { + q := Queries{db: db} + var err error + if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByName); err != nil { + return nil, fmt.Errorf("error preparing query DeleteUsersByName: %w", err) + } + if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByID); err != nil { + return nil, fmt.Errorf("error preparing query GetUserByID: %w", err) + } + if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUser); err != nil { + return nil, fmt.Errorf("error preparing query InsertNewUser: %w", err) + } + if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResult); err != nil { + return nil, fmt.Errorf("error preparing query InsertNewUserWithResult: %w", err) + } + if q.listUsersStmt, err = db.PrepareContext(ctx, listUsers); err != nil { + return nil, fmt.Errorf("error preparing query ListUsers: %w", err) + } + return &q, nil +} + +func (q *Queries) Close() error { + var err error + if q.deleteUsersByNameStmt != nil { + if cerr := q.deleteUsersByNameStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing deleteUsersByNameStmt: %w", cerr) + } + } + if q.getUserByIDStmt != nil { + if cerr := q.getUserByIDStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing getUserByIDStmt: %w", cerr) + } + } + if q.insertNewUserStmt != nil { + if cerr := q.insertNewUserStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing insertNewUserStmt: %w", cerr) + } + } + if q.insertNewUserWithResultStmt != nil { + if cerr := q.insertNewUserWithResultStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing insertNewUserWithResultStmt: %w", cerr) + } + } + if q.listUsersStmt != nil { + if cerr := q.listUsersStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing listUsersStmt: %w", cerr) + } + } + return err +} + +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) + case stmt != nil: + return stmt.ExecContext(ctx, args...) + default: + return q.db.ExecContext(ctx, query, args...) + } +} + +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) + case stmt != nil: + return stmt.QueryContext(ctx, args...) + default: + return q.db.QueryContext(ctx, query, args...) + } +} + +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) + case stmt != nil: + return stmt.QueryRowContext(ctx, args...) + default: + return q.db.QueryRowContext(ctx, query, args...) + } +} + +type Queries struct { + db DBTX + tx *sql.Tx + deleteUsersByNameStmt *sql.Stmt + getUserByIDStmt *sql.Stmt + insertNewUserStmt *sql.Stmt + insertNewUserWithResultStmt *sql.Stmt + listUsersStmt *sql.Stmt +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + tx: tx, + deleteUsersByNameStmt: q.deleteUsersByNameStmt, + getUserByIDStmt: q.getUserByIDStmt, + insertNewUserStmt: q.insertNewUserStmt, + insertNewUserWithResultStmt: q.insertNewUserWithResultStmt, + listUsersStmt: q.listUsersStmt, + } +} diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/models.go b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go new file mode 100644 index 0000000000..d8ac2c0dcb --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID uint64 + FirstName string + LastName sql.NullString +} diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go new file mode 100644 index 0000000000..530dca1939 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go @@ -0,0 +1,104 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteUsersByName = `-- name: DeleteUsersByName :execrows +DELETE FROM users WHERE first_name = ? AND last_name = ? +` + +type DeleteUsersByNameParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) DeleteUsersByName(ctx context.Context, arg DeleteUsersByNameParams) (int64, error) { + result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByName, arg.FirstName, arg.LastName) + if err != nil { + return 0, err + } + return result.RowsAffected() +} + +const getUserByID = `-- name: GetUserByID :one +SELECT first_name, id, last_name FROM users WHERE id = ? +` + +type GetUserByIDRow struct { + FirstName string + ID uint64 + LastName sql.NullString +} + +func (q *Queries) GetUserByID(ctx context.Context, targetID uint64) (GetUserByIDRow, error) { + row := q.queryRow(ctx, q.getUserByIDStmt, getUserByID, targetID) + var i GetUserByIDRow + err := row.Scan(&i.FirstName, &i.ID, &i.LastName) + return i, err +} + +const insertNewUser = `-- name: InsertNewUser :exec +INSERT INTO users (first_name, last_name) VALUES (?, ?) +` + +type InsertNewUserParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { + _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUser, arg.FirstName, arg.LastName) + return err +} + +const insertNewUserWithResult = `-- name: InsertNewUserWithResult :execresult +INSERT INTO users (first_name, last_name) VALUES (?, ?) +` + +type InsertNewUserWithResultParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUserWithResult(ctx context.Context, arg InsertNewUserWithResultParams) (sql.Result, error) { + return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResult, arg.FirstName, arg.LastName) +} + +const listUsers = `-- name: ListUsers :many +SELECT first_name, last_name FROM users +` + +type ListUsersRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) { + rows, err := q.query(ctx, q.listUsersStmt, listUsers) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersRow + for rows.Next() { + var i ListUsersRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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/prepared_queries/mysql/query.sql b/internal/endtoend/testdata/prepared_queries/mysql/query.sql new file mode 100644 index 0000000000..b743aee060 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/query.sql @@ -0,0 +1,14 @@ +/* name: GetUserByID :one */ +SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); + +/* name: ListUsers :many */ +SELECT first_name, last_name FROM users; + +/* name: InsertNewUser :exec */ +INSERT INTO users (first_name, last_name) VALUES (?, ?); + +/* name: InsertNewUserWithResult :execresult */ +INSERT INTO users (first_name, last_name) VALUES (?, ?); + +/* name: DeleteUsersByName :execrows */ +DELETE FROM users WHERE first_name = ? AND last_name = ?; diff --git a/internal/endtoend/testdata/prepared_queries/mysql/schema.sql b/internal/endtoend/testdata/prepared_queries/mysql/schema.sql new file mode 100644 index 0000000000..c928f3b7ce --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json b/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json new file mode 100644 index 0000000000..9d96bdc1c3 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql", + "emit_prepared_queries": true + } + ] +} diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..e35a714344 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" + "fmt" +) + +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 +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +func Prepare(ctx context.Context, db DBTX) (*Queries, error) { + q := Queries{db: db} + var err error + if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByName); err != nil { + return nil, fmt.Errorf("error preparing query DeleteUsersByName: %w", err) + } + if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByID); err != nil { + return nil, fmt.Errorf("error preparing query GetUserByID: %w", err) + } + if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUser); err != nil { + return nil, fmt.Errorf("error preparing query InsertNewUser: %w", err) + } + if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResult); err != nil { + return nil, fmt.Errorf("error preparing query InsertNewUserWithResult: %w", err) + } + if q.listUsersStmt, err = db.PrepareContext(ctx, listUsers); err != nil { + return nil, fmt.Errorf("error preparing query ListUsers: %w", err) + } + return &q, nil +} + +func (q *Queries) Close() error { + var err error + if q.deleteUsersByNameStmt != nil { + if cerr := q.deleteUsersByNameStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing deleteUsersByNameStmt: %w", cerr) + } + } + if q.getUserByIDStmt != nil { + if cerr := q.getUserByIDStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing getUserByIDStmt: %w", cerr) + } + } + if q.insertNewUserStmt != nil { + if cerr := q.insertNewUserStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing insertNewUserStmt: %w", cerr) + } + } + if q.insertNewUserWithResultStmt != nil { + if cerr := q.insertNewUserWithResultStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing insertNewUserWithResultStmt: %w", cerr) + } + } + if q.listUsersStmt != nil { + if cerr := q.listUsersStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing listUsersStmt: %w", cerr) + } + } + return err +} + +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) + case stmt != nil: + return stmt.ExecContext(ctx, args...) + default: + return q.db.ExecContext(ctx, query, args...) + } +} + +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) + case stmt != nil: + return stmt.QueryContext(ctx, args...) + default: + return q.db.QueryContext(ctx, query, args...) + } +} + +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) + case stmt != nil: + return stmt.QueryRowContext(ctx, args...) + default: + return q.db.QueryRowContext(ctx, query, args...) + } +} + +type Queries struct { + db DBTX + tx *sql.Tx + deleteUsersByNameStmt *sql.Stmt + getUserByIDStmt *sql.Stmt + insertNewUserStmt *sql.Stmt + insertNewUserWithResultStmt *sql.Stmt + listUsersStmt *sql.Stmt +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + tx: tx, + deleteUsersByNameStmt: q.deleteUsersByNameStmt, + getUserByIDStmt: q.getUserByIDStmt, + insertNewUserStmt: q.insertNewUserStmt, + insertNewUserWithResultStmt: q.insertNewUserWithResultStmt, + listUsersStmt: q.listUsersStmt, + } +} diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..7043a480a5 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString +} 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 new file mode 100644 index 0000000000..eca6854f2e --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,104 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteUsersByName = `-- name: DeleteUsersByName :execrows +DELETE FROM users WHERE first_name = $1 AND last_name = $2 +` + +type DeleteUsersByNameParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) DeleteUsersByName(ctx context.Context, arg DeleteUsersByNameParams) (int64, error) { + result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByName, arg.FirstName, arg.LastName) + if err != nil { + return 0, err + } + return result.RowsAffected() +} + +const getUserByID = `-- name: GetUserByID :one +SELECT first_name, id, last_name FROM users WHERE id = $1 +` + +type GetUserByIDRow struct { + FirstName string + ID int32 + LastName sql.NullString +} + +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { + row := q.queryRow(ctx, q.getUserByIDStmt, getUserByID, targetID) + var i GetUserByIDRow + err := row.Scan(&i.FirstName, &i.ID, &i.LastName) + return i, err +} + +const insertNewUser = `-- name: InsertNewUser :exec +INSERT INTO users (first_name, last_name) VALUES ($1, $2) +` + +type InsertNewUserParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { + _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUser, arg.FirstName, arg.LastName) + return err +} + +const insertNewUserWithResult = `-- name: InsertNewUserWithResult :execresult +INSERT INTO users (first_name, last_name) VALUES ($1, $2) +` + +type InsertNewUserWithResultParams struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) InsertNewUserWithResult(ctx context.Context, arg InsertNewUserWithResultParams) (sql.Result, error) { + return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResult, arg.FirstName, arg.LastName) +} + +const listUsers = `-- name: ListUsers :many +SELECT first_name, last_name FROM users +` + +type ListUsersRow struct { + FirstName string + LastName sql.NullString +} + +func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) { + rows, err := q.query(ctx, q.listUsersStmt, listUsers) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUsersRow + for rows.Next() { + var i ListUsersRow + if err := rows.Scan(&i.FirstName, &i.LastName); 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/prepared_queries/postgresql/stdlib/query.sql b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..d2f54f2037 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql @@ -0,0 +1,14 @@ +/* name: GetUserByID :one */ +SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); + +/* name: ListUsers :many */ +SELECT first_name, last_name FROM users; + +/* name: InsertNewUser :exec */ +INSERT INTO users (first_name, last_name) VALUES ($1, $2); + +/* name: InsertNewUserWithResult :execresult */ +INSERT INTO users (first_name, last_name) VALUES ($1, $2); + +/* name: DeleteUsersByName :execrows */ +DELETE FROM users WHERE first_name = $1 AND last_name = $2; diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c928f3b7ce --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..ff1ae98f80 --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "emit_prepared_queries": true + } + ] +} diff --git a/internal/endtoend/testdata/primary_key_later/go/db.go b/internal/endtoend/testdata/primary_key_later/go/db.go deleted file mode 100644 index ae95420bdc..0000000000 --- a/internal/endtoend/testdata/primary_key_later/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package primary_key_later - -import ( - "context" - "database/sql" -) - -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 -} - -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/primary_key_later/go/models.go b/internal/endtoend/testdata/primary_key_later/go/models.go deleted file mode 100644 index 6f99a23a5b..0000000000 --- a/internal/endtoend/testdata/primary_key_later/go/models.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package primary_key_later - -import ( - "database/sql" -) - -type Author struct { - ID int64 - Name string - Bio sql.NullString -} diff --git a/internal/endtoend/testdata/primary_key_later/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/go/queries.sql.go deleted file mode 100644 index 6a559f8873..0000000000 --- a/internal/endtoend/testdata/primary_key_later/go/queries.sql.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: queries.sql - -package primary_key_later - -import ( - "context" -) - -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 -} 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 new file mode 100644 index 0000000000..6b6e1f86ce --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/primary_key_later/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..201035a605 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..7f977f1181 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: queries.sql + +package primary_key_later + +import ( + "context" +) + +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) + return i, err +} diff --git a/internal/endtoend/testdata/primary_key_later/queries.sql b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/queries.sql similarity index 100% rename from internal/endtoend/testdata/primary_key_later/queries.sql rename to internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/queries.sql diff --git a/internal/endtoend/testdata/primary_key_later/schema.sql b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/primary_key_later/schema.sql rename to internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..662dbe4db3 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "primary_key_later", + "schema": "schema.sql", + "queries": "queries.sql" + } + ] +} 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 new file mode 100644 index 0000000000..0e46e3ac82 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "context" + + "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 +} + +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/primary_key_later/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..e0e8d9f649 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} 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 new file mode 100644 index 0000000000..7f977f1181 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: queries.sql + +package primary_key_later + +import ( + "context" +) + +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) + return i, err +} diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/queries.sql b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/queries.sql new file mode 100644 index 0000000000..158a7c66bc --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/queries.sql @@ -0,0 +1,9 @@ +-- name: GetAuthor :one +SELECT + * +FROM + authors +WHERE + id = $1 +LIMIT 1; + diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..652d4f1f9d --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id bigserial, + name text NOT NULL, + bio text, + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..798d222039 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "primary_key_later", + "schema": "schema.sql", + "queries": "queries.sql" + } + ] +} 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 new file mode 100644 index 0000000000..3091c8d82e --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "context" + "database/sql" +) + +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 +} + +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/primary_key_later/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..201035a605 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package primary_key_later + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..3cb37cdb45 --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: queries.sql + +package primary_key_later + +import ( + "context" +) + +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 +} diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/queries.sql b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/queries.sql new file mode 100644 index 0000000000..158a7c66bc --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/queries.sql @@ -0,0 +1,9 @@ +-- name: GetAuthor :one +SELECT + * +FROM + authors +WHERE + id = $1 +LIMIT 1; + diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..652d4f1f9d --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id bigserial, + name text NOT NULL, + bio text, + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..c1defb3b5e --- /dev/null +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "primary_key_later", + "schema": "schema.sql", + "queries": "queries.sql" + } + ] +} diff --git a/internal/endtoend/testdata/primary_key_later/sqlc.json b/internal/endtoend/testdata/primary_key_later/sqlc.json deleted file mode 100644 index 498f89cb24..0000000000 --- a/internal/endtoend/testdata/primary_key_later/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "primary_key_later", - "schema": "schema.sql", - "queries": "queries.sql" - } - ] -} diff --git a/internal/endtoend/testdata/process_plugin_disabled/exec.json b/internal/endtoend/testdata/process_plugin_disabled/exec.json new file mode 100644 index 0000000000..d88b817f99 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/exec.json @@ -0,0 +1,6 @@ +{ + "process": "sqlc-gen-json", + "env": { + "SQLCDEBUG": "processplugins=0" + } +} diff --git a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json new file mode 100644 index 0000000000..06bc46aa71 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json @@ -0,0 +1,65403 @@ +{ + "settings": { + "version": "2", + "engine": "postgresql", + "schema": [ + "schema.sql" + ], + "queries": [ + "query.sql" + ], + "rename": {}, + "overrides": [], + "codegen": { + "out": "gen", + "plugin": "jsonb", + "options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" + }, + "go": { + "emit_interface": false, + "emit_json_tags": false, + "emit_db_tags": false, + "emit_prepared_queries": false, + "emit_exact_table_names": false, + "emit_empty_slices": false, + "emit_exported_queries": false, + "emit_result_struct_pointers": false, + "emit_params_struct_pointers": false, + "emit_methods_with_db_argument": false, + "json_tags_case_style": "", + "package": "", + "out": "", + "sql_package": "", + "sql_driver": "", + "output_db_file_name": "", + "output_models_file_name": "", + "output_querier_file_name": "", + "output_copyfrom_file_name": "", + "output_files_suffix": "", + "emit_enum_valid_method": false, + "emit_all_enum_values": false, + "inflection_exclude_table_names": [], + "emit_pointers_for_null_types": false, + "query_parameter_limit": 1, + "output_batch_file_name": "", + "json_tags_id_uppercase": false, + "omit_unused_structs": false, + "emit_sql_as_comment": false + }, + "json": { + "out": "", + "indent": "", + "filename": "" + } + }, + "catalog": { + "comment": "", + "default_schema": "public", + "name": "", + "schemas": [ + { + "comment": "", + "name": "public", + "tables": [ + { + "rel": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_temp", + "tables": [], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_catalog", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "columns": [ + { + "name": "tableoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfnoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggkind", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggnumdirectargs", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggcombinefn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggdeserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminvtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggsortop", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "agginitval", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminitval", + "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_aggregate" + }, + "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_am" + }, + "columns": [ + { + "name": "tableoid", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amhandler", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amtype", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "columns": [ + { + "name": "tableoid", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoplefttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoprighttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopstrategy", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoppurpose", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopopr", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopmethod", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopsortfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "columns": [ + { + "name": "tableoid", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocfamily", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproclefttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocrighttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocnum", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproc", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "columns": [ + { + "name": "tableoid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adrelid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adnum", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adbin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attribute" + }, + "columns": [ + { + "name": "tableoid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attrelid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atttypid", + "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": "oid" + }, + "is_sqlc_slice": false, + "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 + }, + { + "name": "attlen", + "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 + }, + { + "name": "attnum", + "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 + }, + { + "name": "attndims", + "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 + }, + { + "name": "attcacheoff", + "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 + }, + { + "name": "atttypmod", + "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 + }, + { + "name": "attbyval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attalign", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attstorage", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attcompression", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnotnull", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasdef", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasmissing", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attidentity", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attgenerated", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attisdropped", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attislocal", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attinhcount", + "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 + }, + { + "name": "attcollation", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attacl", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attmissingval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "columns": [ + { + "name": "tableoid", + "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 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roleid", + "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 + }, + { + "name": "member", + "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 + }, + { + "name": "grantor", + "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 + }, + { + "name": "admin_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "columns": [ + { + "name": "tableoid", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "superuser", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trusted", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relocatable", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "requires", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extension_versions" + }, + "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_available_extensions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extensions" + }, + "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_backend_memory_contexts" + }, + "columns": [ + { + "name": "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ident", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parent", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "level", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_nblocks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_chunks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "used_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "columns": [ + { + "name": "tableoid", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castsource", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "casttarget", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castfunc", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castcontext", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castmethod", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "columns": [ + { + "name": "tableoid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnamespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloftype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relowner", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relam", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfilenode", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltablespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpages", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltuples", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relallvisible", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltoastrelid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasindex", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relisshared", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpersistence", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relkind", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnatts", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relchecks", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasrules", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhastriggers", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhassubclass", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relforcerowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispopulated", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relreplident", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispartition", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrewrite", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfrozenxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relminmxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relacl", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloptions", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpartbound", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_collation" + }, + "columns": [ + { + "name": "tableoid", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collnamespace", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collowner", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collprovider", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collisdeterministic", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collencoding", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collcollate", + "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 + }, + { + "name": "collctype", + "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 + }, + { + "name": "colliculocale", + "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 + }, + { + "name": "collversion", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_config" + }, + "columns": [ + { + "name": "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_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_config" + }, + "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_constraint" + }, + "columns": [ + { + "name": "tableoid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferrable", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferred", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "convalidated", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contypid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conindid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conparentid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confupdtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdeltype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confmatchtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conislocal", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "coninhcount", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connoinherit", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conpfeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conppeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conffeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdelsetcols", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conexclop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conbin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "columns": [ + { + "name": "tableoid", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conowner", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conforencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contoencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conproc", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condefault", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cursors" + }, + "columns": [ + { + "name": "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_holdable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_binary", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_scrollable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "creation_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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_database" + }, + "columns": [ + { + "name": "tableoid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datdba", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encoding", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datlocprovider", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datistemplate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datallowconn", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datconnlimit", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datfrozenxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datminmxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dattablespace", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datcollate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datctype", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "daticulocale", + "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 + }, + { + "name": "datcollversion", + "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 + }, + { + "name": "datacl", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "columns": [ + { + "name": "tableoid", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setdatabase", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setrole", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setconfig", + "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_db_role_setting" + }, + "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_default_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclrole", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclnamespace", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclobjtype", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclacl", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "columns": [ + { + "name": "tableoid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "columns": [ + { + "name": "tableoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_description" + }, + "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_enum" + }, + "columns": [ + { + "name": "tableoid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumtypid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumsortorder", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumlabel", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtevent", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtowner", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtfoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtenabled", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evttags", + "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_event_trigger" + }, + "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_extension" + }, + "columns": [ + { + "name": "tableoid", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extowner", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extnamespace", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extrelocatable", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extversion", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extconfig", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extcondition", + "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_extension" + }, + "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_file_settings" + }, + "columns": [ + { + "name": "sourcefile", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqno", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "applied", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "error", + "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_file_settings" + }, + "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_foreign_data_wrapper" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwhandler", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwvalidator", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwacl", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "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_foreign_data_wrapper" + }, + "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_foreign_server" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvfdw", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvtype", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvversion", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvacl", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "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_foreign_server" + }, + "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_foreign_table" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftrelid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftserver", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "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_foreign_table" + }, + "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_group" + }, + "columns": [ + { + "name": "groname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grosysid", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grolist", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "columns": [ + { + "name": "line_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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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": 0 + }, + { + "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": 0 + }, + { + "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 + }, + { + "name": "netmask", + "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 + }, + { + "name": "auth_method", + "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 + }, + { + "name": "options", + "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": 0 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "columns": [ + { + "name": "line_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 + }, + { + "name": "map_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 + }, + { + "name": "sys_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 + }, + { + "name": "pg_username", + "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 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "columns": [ + { + "name": "tableoid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnkeyatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisunique", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnullsnotdistinct", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisprimary", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisexclusion", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indimmediate", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisclustered", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisvalid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcheckxmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisready", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indislive", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisreplident", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indkey", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indoption", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexprs", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indpred", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexdef", + "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_indexes" + }, + "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_inherits" + }, + "columns": [ + { + "name": "tableoid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhrelid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhparent", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhseqno", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhdetachpending", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "columns": [ + { + "name": "tableoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privtype", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initprivs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "columns": [ + { + "name": "tableoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanowner", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanispl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanpltrusted", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanplcallfoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "laninline", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanvalidator", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanacl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "loid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pageno", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomowner", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomacl", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "columns": [ + { + "name": "locktype", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relation", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "page", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuple", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualxid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transactionid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualtransaction", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mode", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "granted", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fastpath", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "waitstart", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ispopulated", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_matviews" + }, + "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_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspowner", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspacl", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "columns": [ + { + "name": "tableoid", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcmethod", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcnamespace", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcowner", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcfamily", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcintype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcdefault", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opckeytype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "columns": [ + { + "name": "tableoid", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnamespace", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprowner", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprkind", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanmerge", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanhash", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprleft", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprright", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprresult", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcom", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnegate", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcode", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprrest", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprjoin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "columns": [ + { + "name": "tableoid", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfmethod", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfnamespace", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfowner", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parname", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "paracl", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "columns": [ + { + "name": "tableoid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partrelid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partstrat", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partnatts", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partdefid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partattrs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partexprs", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "policyname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "permissive", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roles", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmd", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "qual", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_check", + "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_policies" + }, + "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_policy" + }, + "columns": [ + { + "name": "tableoid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polrelid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polcmd", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polpermissive", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polroles", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polqual", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polwithcheck", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_statements" + }, + "columns": [ + { + "name": "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepare_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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_types", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "from_sql", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generic_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "custom_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "columns": [ + { + "name": "transaction", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gid", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepared", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "columns": [ + { + "name": "tableoid", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronamespace", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proowner", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prolang", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "procost", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorows", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provariadic", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosupport", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prokind", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosecdef", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proleakproof", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proisstrict", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proretset", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provolatile", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proparallel", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargs", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorettype", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargtypes", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proallargtypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargmodes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargnames", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "protrftypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosrc", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "probin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosqlbody", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proconfig", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proacl", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "columns": [ + { + "name": "tableoid", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubowner", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "puballtables", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubinsert", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubupdate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubdelete", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubtruncate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubviaroot", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnpubid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnnspid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prpubid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prrelid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prqual", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prattrs", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "columns": [ + { + "name": "pubname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowfilter", + "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_publication_tables" + }, + "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_range" + }, + "columns": [ + { + "name": "tableoid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngtypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubtype", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngmultitypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcollation", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubopc", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcanonical", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubdiff", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "columns": [ + { + "name": "tableoid", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roident", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roname", + "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_replication_origin" + }, + "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_replication_origin_status" + }, + "columns": [ + { + "name": "local_id", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_id", + "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_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "remote_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "local_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_slots" + }, + "columns": [ + { + "name": "slot_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "plugin", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datoid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temporary", + "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 + }, + { + "name": "active", + "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 + }, + { + "name": "active_pid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "catalog_xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "restart_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confirmed_flush_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_status", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "safe_wal_size", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "two_phase", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "columns": [ + { + "name": "tableoid", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_class", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_type", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_enabled", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instead", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_qual", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_action", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "columns": [ + { + "name": "rolname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconfig", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oid", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_rules" + }, + "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_seclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabel" + }, + "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_seclabels" + }, + "columns": [ + { + "name": "objoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objtype", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objnamespace", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objname", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabels" + }, + "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_sequence" + }, + "columns": [ + { + "name": "tableoid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqrelid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqtypid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqstart", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqincrement", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcache", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcycle", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequencename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequenceowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment_by", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cache_size", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_settings" + }, + "columns": [ + { + "name": "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unit", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "category", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "short_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extra_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "vartype", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumvals", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "boot_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reset_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourcefile", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pending_restart", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_shadow" + }, + "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_shdepend" + }, + "columns": [ + { + "name": "tableoid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dbid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "columns": [ + { + "name": "tableoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_shdescription" + }, + "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_shmem_allocations" + }, + "columns": [ + { + "name": "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "off", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "allocated_size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_shseclabel" + }, + "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_activity" + }, + "columns": [ + { + "name": "datid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "leader_pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state_change", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event_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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_id", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_activity" + }, + "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_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_archiver" + }, + "columns": [ + { + "name": "archived_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "failed_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_bgwriter" + }, + "columns": [ + { + "name": "checkpoints_timed", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoints_req", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_sync_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_checkpoint", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maxwritten_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend_fsync", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_alloc", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database" + }, + "columns": [ + { + "name": "datid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numbackends", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_commit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_rollback", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_returned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_fetched", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_inserted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_updated", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_deleted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conflicts", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_files", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deadlocks", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_failures", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_last_failure", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "session_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "active_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idle_in_transaction_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_abandoned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_fatal", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_killed", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database_conflicts" + }, + "columns": [ + { + "name": "datid", + "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_database_conflicts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confl_tablespace", + "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 + }, + { + "name": "confl_lock", + "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 + }, + { + "name": "confl_snapshot", + "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 + }, + { + "name": "confl_bufferpin", + "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 + }, + { + "name": "confl_deadlock", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_gssapi" + }, + "columns": [ + { + "name": "pid", + "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_gssapi" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gss_authenticated", + "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 + }, + { + "name": "principal", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encrypted", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "columns": [ + { + "name": "pid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_scanned", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_computed", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_done", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_child_table_relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "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_progress_basebackup" + }, + "columns": [ + { + "name": "pid", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_cluster" + }, + "columns": [ + { + "name": "pid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cluster_index_relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_written", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_rebuild_count", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_copy" + }, + "columns": [ + { + "name": "pid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_total", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_excluded", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_create_index" + }, + "columns": [ + { + "name": "pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_locker_pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_vacuum" + }, + "columns": [ + { + "name": "pid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_vacuumed", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_vacuum_count", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "num_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_recovery_prefetch" + }, + "columns": [ + { + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prefetch", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hit", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_init", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_new", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_fpw", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_rep", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "block_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "io_depth", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "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_replication" + }, + "columns": [ + { + "name": "pid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sent_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_priority", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reply_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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_replication_slots" + }, + "columns": [ + { + "name": "slot_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_stat_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_slru" + }, + "columns": [ + { + "name": "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_stat_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_zeroed", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_written", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_exists", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushes", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "truncates", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_ssl" + }, + "columns": [ + { + "name": "pid", + "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 + }, + { + "name": "ssl", + "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": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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": "cipher", + "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": "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 + }, + { + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_stats" + }, + "columns": [ + { + "name": "subid", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "apply_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_wal" + }, + "columns": [ + { + "name": "wal_records", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_fpi", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_bytes", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_buffers_full", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_write", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_wal_receiver" + }, + "columns": [ + { + "name": "pid", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "status", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "written_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushed_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_stat_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_host", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_port", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conninfo", + "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_wal_receiver" + }, + "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_xact_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_xact_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "starelid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staattnum", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stainherit", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanullfrac", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stawidth", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stadistinct", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxrelid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxnamespace", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxowner", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxstattarget", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkeys", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkind", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxexprs", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdinherit", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdndistinct", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxddependencies", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdmcv", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_mcv_list" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdexpr", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_pg_statistic" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "exprs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "kinds", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependencies", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_val_nulls", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_base_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "expr", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdbid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subskiplsn", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "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": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subowner", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subenabled", + "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 + }, + { + "name": "subbinary", + "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 + }, + { + "name": "substream", + "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 + }, + { + "name": "subtwophasestate", + "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": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdisableonerr", + "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 + }, + { + "name": "subconninfo", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subslotname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subsynccommit", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subpublications", + "not_null": true, + "is_array": true, + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srrelid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubstate", + "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_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsublsn", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tableowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasrules", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hastriggers", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowsecurity", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "columns": [ + { + "name": "tableoid", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcowner", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcacl", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcoptions", + "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_tablespace" + }, + "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_timezone_abbrevs" + }, + "columns": [ + { + "name": "abbrev", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "columns": [ + { + "name": "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "abbrev", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "columns": [ + { + "name": "tableoid", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftype", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trflang", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trffromsql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftosql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgparentid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgfoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgtype", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgenabled", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgisinternal", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrindid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstraint", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgdeferrable", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tginitdeferred", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgattr", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgqual", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgoldtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnewtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgnamespace", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgowner", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgparser", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapcfg", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maptokentype", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapseqno", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapdict", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictnamespace", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictowner", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dicttemplate", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictinitoption", + "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_ts_dict" + }, + "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_ts_parser" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsnamespace", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsstart", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prstoken", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsend", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsheadline", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prslextype", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplnamespace", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplinit", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmpllexize", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "columns": [ + { + "name": "tableoid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnamespace", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typowner", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typlen", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbyval", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcategory", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typispreferred", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typisdefined", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdelim", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typrelid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsubscript", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typelem", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typarray", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typinput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typoutput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typreceive", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsend", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodout", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typanalyze", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typalign", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typstorage", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnotnull", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbasetype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtypmod", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typndims", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcollation", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefaultbin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefault", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typacl", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_user" + }, + "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_user_mapping" + }, + "columns": [ + { + "name": "tableoid", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umserver", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mapping" + }, + "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_user_mappings" + }, + "columns": [ + { + "name": "umid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mappings" + }, + "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_views" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "information_schema", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "columns": [ + { + "name": "nspname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "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": "information_schema", + "name": "_pg_foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_derived_reference_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "columns": [ + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_repertoire", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "form_of_use", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_clause", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pad_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependent_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_self_referencing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_identity", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_start", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_maximum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_minimum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_cycle", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_generated", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generation_expression", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collection_type_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "columns": [ + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "library_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "position_in_unique_constraint", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_mode", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_result", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "match_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "update_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "delete_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_body", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_style", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deterministic", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_data_access", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_null_call", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_level_routine", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dynamic_result_sets", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_user_defined_cast", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_implicitly_invocable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "security_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_altered", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "new_savepoint_level", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_udt_dependent", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_from_data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_max_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "columns": [ + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "minimum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "integer_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "supported_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enforced", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nulls_distinct", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_referencing_column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_typed", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "commit_action", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "group_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transform_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_manipulation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_order", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_condition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_statement", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_orientation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_timing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "columns": [ + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instantiable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_final", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_form", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ref_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_deletable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + } + ] + }, + "queries": [ + { + "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", + "name": "GetAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "SELECT id, name, bio FROM authors\nORDER BY name", + "name": "ListAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", + "name": "CreateAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + } + }, + { + "number": 2, + "column": { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": { + "catalog": "", + "schema": "", + "name": "authors" + } + }, + { + "text": "DELETE FROM authors\nWHERE id = $1", + "name": "DeleteAuthor", + "cmd": ":exec", + "columns": [], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + } + ], + "sqlc_version": "v1.30.0", + "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" +} diff --git a/internal/endtoend/testdata/process_plugin_disabled/query.sql b/internal/endtoend/testdata/process_plugin_disabled/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/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/process_plugin_disabled/schema.sql b/internal/endtoend/testdata/process_plugin_disabled/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/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/process_plugin_disabled/sqlc.json b/internal/endtoend/testdata/process_plugin_disabled/sqlc.json new file mode 100644 index 0000000000..f47189143a --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "jsonb", + "options": { + "indent": " ", + "filename": "codegen.json" + } + } + ] + } + ], + "plugins": [ + { + "name": "jsonb", + "process": { + "cmd": "sqlc-gen-json" + } + } + ] +} diff --git a/internal/endtoend/testdata/process_plugin_disabled/stderr.txt b/internal/endtoend/testdata/process_plugin_disabled/stderr.txt new file mode 100644 index 0000000000..85ee900cc6 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_disabled/stderr.txt @@ -0,0 +1 @@ +error validating sqlc.json: plugin: process-based plugins disabled via SQLCDEBUG=processplugins=0 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/process_plugin_format_json/query.sql b/internal/endtoend/testdata/process_plugin_format_json/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/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/process_plugin_format_json/schema.sql b/internal/endtoend/testdata/process_plugin_format_json/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/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/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 new file mode 100644 index 0000000000..e38046cf57 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json @@ -0,0 +1,4 @@ +{ + "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 new file mode 100644 index 0000000000..0c7282ac9c --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -0,0 +1,65371 @@ +{ + "settings": { + "version": "2", + "engine": "postgresql", + "schema": [ + "schema.sql" + ], + "queries": [ + "query.sql" + ], + "codegen": { + "out": "gen", + "plugin": "jsonb", + "options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "env": [], + "process": { + "cmd": "sqlc-gen-json" + }, + "wasm": null + } + }, + "catalog": { + "comment": "", + "default_schema": "public", + "name": "", + "schemas": [ + { + "comment": "", + "name": "public", + "tables": [ + { + "rel": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_temp", + "tables": [], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "pg_catalog", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "columns": [ + { + "name": "tableoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfnoid", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggkind", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggnumdirectargs", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggcombinefn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggdeserialfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminvtransfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalfn", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalextra", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmfinalmodify", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggsortop", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtranstype", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggmtransspace", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "agginitval", + "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_aggregate" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "aggminitval", + "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_aggregate" + }, + "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_am" + }, + "columns": [ + { + "name": "tableoid", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amhandler", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amtype", + "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_am" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "columns": [ + { + "name": "tableoid", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoplefttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoprighttype", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopstrategy", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amoppurpose", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopopr", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopmethod", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amopsortfamily", + "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_amop" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "columns": [ + { + "name": "tableoid", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocfamily", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproclefttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocrighttype", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amprocnum", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "amproc", + "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_amproc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "columns": [ + { + "name": "tableoid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adrelid", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adnum", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "adbin", + "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_attrdef" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attribute" + }, + "columns": [ + { + "name": "tableoid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attrelid", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atttypid", + "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": "oid" + }, + "is_sqlc_slice": false, + "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 + }, + { + "name": "attlen", + "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 + }, + { + "name": "attnum", + "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 + }, + { + "name": "attndims", + "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 + }, + { + "name": "attcacheoff", + "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 + }, + { + "name": "atttypmod", + "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 + }, + { + "name": "attbyval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attalign", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attstorage", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attcompression", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnotnull", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasdef", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "atthasmissing", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attidentity", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attgenerated", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attisdropped", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attislocal", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attinhcount", + "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 + }, + { + "name": "attcollation", + "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": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attacl", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attmissingval", + "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_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "columns": [ + { + "name": "tableoid", + "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 + }, + { + "name": "cmax", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roleid", + "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 + }, + { + "name": "member", + "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 + }, + { + "name": "grantor", + "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 + }, + { + "name": "admin_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "columns": [ + { + "name": "tableoid", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_authid" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "superuser", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trusted", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relocatable", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "requires", + "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_available_extension_versions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extension_versions" + }, + "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_available_extensions" + }, + "columns": [ + { + "name": "name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "installed_version", + "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_available_extensions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comment", + "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_available_extensions" + }, + "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_backend_memory_contexts" + }, + "columns": [ + { + "name": "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ident", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parent", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "level", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_nblocks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "free_chunks", + "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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "used_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_backend_memory_contexts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "columns": [ + { + "name": "tableoid", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castsource", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "casttarget", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castfunc", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castcontext", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "castmethod", + "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_cast" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "columns": [ + { + "name": "tableoid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnamespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloftype", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relowner", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relam", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfilenode", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltablespace", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpages", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltuples", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relallvisible", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reltoastrelid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasindex", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relisshared", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpersistence", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relkind", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relnatts", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relchecks", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhasrules", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhastriggers", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relhassubclass", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relforcerowsecurity", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispopulated", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relreplident", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relispartition", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relrewrite", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relfrozenxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relminmxid", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relacl", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reloptions", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relpartbound", + "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_class" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_collation" + }, + "columns": [ + { + "name": "tableoid", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collnamespace", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collowner", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collprovider", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collisdeterministic", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collencoding", + "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_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collcollate", + "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 + }, + { + "name": "collctype", + "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 + }, + { + "name": "colliculocale", + "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 + }, + { + "name": "collversion", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_config" + }, + "columns": [ + { + "name": "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_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_config" + }, + "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_constraint" + }, + "columns": [ + { + "name": "tableoid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferrable", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condeferred", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "convalidated", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contypid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conindid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conparentid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confrelid", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confupdtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdeltype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confmatchtype", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conislocal", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "coninhcount", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connoinherit", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confkey", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conpfeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conppeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conffeqop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confdelsetcols", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conexclop", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conbin", + "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_constraint" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "columns": [ + { + "name": "tableoid", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "connamespace", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conowner", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conforencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "contoencoding", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conproc", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "condefault", + "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_conversion" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_cursors" + }, + "columns": [ + { + "name": "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_holdable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_binary", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_scrollable", + "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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "creation_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_cursors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_database" + }, + "columns": [ + { + "name": "tableoid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datdba", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encoding", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datlocprovider", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datistemplate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datallowconn", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datconnlimit", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datfrozenxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datminmxid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dattablespace", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datcollate", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datctype", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "daticulocale", + "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 + }, + { + "name": "datcollversion", + "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 + }, + { + "name": "datacl", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "columns": [ + { + "name": "tableoid", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setdatabase", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setrole", + "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_db_role_setting" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setconfig", + "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_db_role_setting" + }, + "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_default_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclrole", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclnamespace", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclobjtype", + "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_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "defaclacl", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_default_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "columns": [ + { + "name": "tableoid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjsubid", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_depend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "columns": [ + { + "name": "tableoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_description" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_description" + }, + "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_enum" + }, + "columns": [ + { + "name": "tableoid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumtypid", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumsortorder", + "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_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumlabel", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_enum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtevent", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtowner", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtfoid", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evtenabled", + "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_event_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "evttags", + "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_event_trigger" + }, + "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_extension" + }, + "columns": [ + { + "name": "tableoid", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extowner", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extnamespace", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extrelocatable", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extversion", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extconfig", + "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_extension" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extcondition", + "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_extension" + }, + "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_file_settings" + }, + "columns": [ + { + "name": "sourcefile", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqno", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "applied", + "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_file_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "error", + "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_file_settings" + }, + "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_foreign_data_wrapper" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwhandler", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwvalidator", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwacl", + "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_foreign_data_wrapper" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "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_foreign_data_wrapper" + }, + "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_foreign_server" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvfdw", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvtype", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvversion", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvacl", + "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_foreign_server" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "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_foreign_server" + }, + "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_foreign_table" + }, + "columns": [ + { + "name": "tableoid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftrelid", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftserver", + "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_foreign_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "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_foreign_table" + }, + "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_group" + }, + "columns": [ + { + "name": "groname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grosysid", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grolist", + "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_group" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "columns": [ + { + "name": "line_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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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": 0 + }, + { + "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": 0 + }, + { + "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 + }, + { + "name": "netmask", + "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 + }, + { + "name": "auth_method", + "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 + }, + { + "name": "options", + "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": 0 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "columns": [ + { + "name": "line_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 + }, + { + "name": "map_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 + }, + { + "name": "sys_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 + }, + { + "name": "pg_username", + "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 + }, + { + "name": "error", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "columns": [ + { + "name": "tableoid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indrelid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnkeyatts", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisunique", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indnullsnotdistinct", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisprimary", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisexclusion", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indimmediate", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisclustered", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisvalid", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcheckxmin", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisready", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indislive", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indisreplident", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indkey", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indoption", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexprs", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indpred", + "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_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexdef", + "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_indexes" + }, + "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_inherits" + }, + "columns": [ + { + "name": "tableoid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhrelid", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhparent", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhseqno", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inhdetachpending", + "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_inherits" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "columns": [ + { + "name": "tableoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privtype", + "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_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initprivs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_init_privs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "columns": [ + { + "name": "tableoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanowner", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanispl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanpltrusted", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanplcallfoid", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "laninline", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanvalidator", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lanacl", + "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_language" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "loid", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pageno", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data", + "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_largeobject" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "columns": [ + { + "name": "tableoid", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomowner", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lomacl", + "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_largeobject_metadata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "columns": [ + { + "name": "locktype", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relation", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "page", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuple", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualxid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transactionid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "virtualtransaction", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mode", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "granted", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fastpath", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "waitstart", + "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_locks" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "matviewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ispopulated", + "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_matviews" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_matviews" + }, + "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_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspowner", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nspacl", + "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_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "columns": [ + { + "name": "tableoid", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcmethod", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcnamespace", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcowner", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcfamily", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcintype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opcdefault", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opckeytype", + "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_opclass" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "columns": [ + { + "name": "tableoid", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnamespace", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprowner", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprkind", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanmerge", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcanhash", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprleft", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprright", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprresult", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcom", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprnegate", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprcode", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprrest", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oprjoin", + "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_operator" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "columns": [ + { + "name": "tableoid", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfmethod", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfnamespace", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "opfowner", + "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_opfamily" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "columns": [ + { + "name": "tableoid", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parname", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "paracl", + "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_parameter_acl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "columns": [ + { + "name": "tableoid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partrelid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partstrat", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partnatts", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partdefid", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partattrs", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partclass", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partcollation", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partexprs", + "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_partitioned_table" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "policyname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "permissive", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roles", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmd", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "qual", + "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_policies" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_check", + "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_policies" + }, + "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_policy" + }, + "columns": [ + { + "name": "tableoid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polrelid", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polcmd", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polpermissive", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polroles", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polqual", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "polwithcheck", + "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_policy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_statements" + }, + "columns": [ + { + "name": "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statement", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepare_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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_types", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "from_sql", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generic_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "custom_plans", + "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_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "columns": [ + { + "name": "transaction", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gid", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prepared", + "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_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_xacts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "columns": [ + { + "name": "tableoid", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronamespace", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proowner", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prolang", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "procost", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorows", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provariadic", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosupport", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prokind", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosecdef", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proleakproof", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proisstrict", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proretset", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provolatile", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proparallel", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargs", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pronargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prorettype", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargtypes", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oidvector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proallargtypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargmodes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargnames", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proargdefaults", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "protrftypes", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosrc", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "probin", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prosqlbody", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proconfig", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "proacl", + "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_proc" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "columns": [ + { + "name": "tableoid", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubowner", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "puballtables", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubinsert", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubupdate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubdelete", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubtruncate", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pubviaroot", + "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_publication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnpubid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pnnspid", + "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_publication_namespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prpubid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prrelid", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prqual", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prattrs", + "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_publication_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "columns": [ + { + "name": "pubname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_publication_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowfilter", + "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_publication_tables" + }, + "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_range" + }, + "columns": [ + { + "name": "tableoid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngtypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubtype", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngmultitypid", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcollation", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubopc", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngcanonical", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rngsubdiff", + "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_range" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "columns": [ + { + "name": "tableoid", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roident", + "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_replication_origin" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "roname", + "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_replication_origin" + }, + "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_replication_origin_status" + }, + "columns": [ + { + "name": "local_id", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_id", + "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_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "remote_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "local_lsn", + "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_replication_origin_status" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_slots" + }, + "columns": [ + { + "name": "slot_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "plugin", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datoid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "database", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temporary", + "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 + }, + { + "name": "active", + "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 + }, + { + "name": "active_pid", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "catalog_xmin", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "restart_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confirmed_flush_lsn", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_status", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "safe_wal_size", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "two_phase", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "columns": [ + { + "name": "tableoid", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_class", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_type", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_enabled", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instead", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_qual", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ev_action", + "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_rewrite" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "columns": [ + { + "name": "rolname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolsuper", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolinherit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreaterole", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcreatedb", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolcanlogin", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolreplication", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconnlimit", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolpassword", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolvaliduntil", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolbypassrls", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rolconfig", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "oid", + "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_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rulename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_rules" + }, + "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_seclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabel" + }, + "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_seclabels" + }, + "columns": [ + { + "name": "objoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objtype", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objnamespace", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objname", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_seclabels" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_seclabels" + }, + "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_sequence" + }, + "columns": [ + { + "name": "tableoid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqrelid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqtypid", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqstart", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqincrement", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcache", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seqcycle", + "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_sequence" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequencename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequenceowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment_by", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cache_size", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_value", + "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_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_settings" + }, + "columns": [ + { + "name": "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "setting", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unit", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "category", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "short_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "extra_desc", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "vartype", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "min_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enumvals", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "boot_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reset_val", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourcefile", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sourceline", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pending_restart", + "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_settings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_shadow" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_shadow" + }, + "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_shdepend" + }, + "columns": [ + { + "name": "tableoid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dbid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objsubid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refclassid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "refobjid", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deptype", + "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_shdepend" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "columns": [ + { + "name": "tableoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shdescription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "description", + "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_shdescription" + }, + "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_shmem_allocations" + }, + "columns": [ + { + "name": "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "off", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "allocated_size", + "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_shmem_allocations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "columns": [ + { + "name": "tableoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "objoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "classoid", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "provider", + "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_shseclabel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "label", + "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_shseclabel" + }, + "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_activity" + }, + "columns": [ + { + "name": "datid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "leader_pid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_start", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state_change", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event_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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wait_event", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xid", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query_id", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "query", + "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_activity" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_activity" + }, + "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_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_archiver" + }, + "columns": [ + { + "name": "archived_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_archived_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "failed_count", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_wal", + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_failed_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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_archiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_bgwriter" + }, + "columns": [ + { + "name": "checkpoints_timed", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoints_req", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checkpoint_sync_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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_checkpoint", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maxwritten_clean", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_backend_fsync", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "buffers_alloc", + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_bgwriter" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database" + }, + "columns": [ + { + "name": "datid", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numbackends", + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_commit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xact_rollback", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_returned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_fetched", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_inserted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_updated", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tup_deleted", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conflicts", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_files", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "temp_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "deadlocks", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_failures", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "checksum_last_failure", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blk_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "session_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "active_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idle_in_transaction_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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_abandoned", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_fatal", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sessions_killed", + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_database_conflicts" + }, + "columns": [ + { + "name": "datid", + "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_database_conflicts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "confl_tablespace", + "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 + }, + { + "name": "confl_lock", + "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 + }, + { + "name": "confl_snapshot", + "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 + }, + { + "name": "confl_bufferpin", + "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 + }, + { + "name": "confl_deadlock", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_gssapi" + }, + "columns": [ + { + "name": "pid", + "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_gssapi" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "gss_authenticated", + "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 + }, + { + "name": "principal", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "encrypted", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "columns": [ + { + "name": "pid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sample_blks_scanned", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ext_stats_computed", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_total", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "child_tables_done", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_child_table_relid", + "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_progress_analyze" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "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_progress_basebackup" + }, + "columns": [ + { + "name": "pid", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backup_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_total", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespaces_streamed", + "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_progress_basebackup" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_cluster" + }, + "columns": [ + { + "name": "pid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cluster_index_relid", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_tuples_written", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_rebuild_count", + "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_progress_cluster" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_copy" + }, + "columns": [ + { + "name": "pid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bytes_total", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_processed", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_excluded", + "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_progress_copy" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_create_index" + }, + "columns": [ + { + "name": "pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_relid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "command", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "lockers_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "current_locker_pid", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blocks_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tuples_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_total", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "partitions_done", + "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_progress_create_index" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_progress_vacuum" + }, + "columns": [ + { + "name": "pid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "phase", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_total", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_scanned", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_vacuumed", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "index_vacuum_count", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "num_dead_tuples", + "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_progress_vacuum" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "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_recovery_prefetch" + }, + "columns": [ + { + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prefetch", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hit", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_init", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_new", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_fpw", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "skip_rep", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "block_distance", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "io_depth", + "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_recovery_prefetch" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "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_replication" + }, + "columns": [ + { + "name": "pid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "application_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_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_addr", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "inet" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_hostname", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "client_port", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_start", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "backend_xmin", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sent_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lsn", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "write_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flush_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "replay_lag", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_priority", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_state", + "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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reply_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_replication" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_replication_slots" + }, + "columns": [ + { + "name": "slot_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_stat_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spill_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_count", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stream_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_txns", + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_slru" + }, + "columns": [ + { + "name": "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_stat_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_zeroed", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_written", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_exists", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushes", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "truncates", + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_slru" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_ssl" + }, + "columns": [ + { + "name": "pid", + "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 + }, + { + "name": "ssl", + "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": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "version", + "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": "cipher", + "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": "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 + }, + { + "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" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_stats" + }, + "columns": [ + { + "name": "subid", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "apply_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sync_error_count", + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_read", + "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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": "int8" + }, + "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_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + }, + { + "name": "n_live_tup", + "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 + }, + { + "name": "n_dead_tup", + "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 + }, + { + "name": "n_mod_since_analyze", + "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 + }, + { + "name": "n_ins_since_vacuum", + "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 + }, + { + "name": "last_vacuum", + "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 + }, + { + "name": "last_autovacuum", + "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 + }, + { + "name": "last_analyze", + "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 + }, + { + "name": "last_autoanalyze", + "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 + }, + { + "name": "vacuum_count", + "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 + }, + { + "name": "autovacuum_count", + "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 + }, + { + "name": "analyze_count", + "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 + }, + { + "name": "autoanalyze_count", + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_wal" + }, + "columns": [ + { + "name": "wal_records", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_fpi", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_bytes", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_buffers_full", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_write", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync", + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "wal_sync_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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_wal" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "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_wal_receiver" + }, + "columns": [ + { + "name": "pid", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "status", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "receive_start_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "written_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "flushed_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "received_tli", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_send_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_msg_receipt_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_lsn", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "latest_end_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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "slot_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_stat_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_host", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sender_port", + "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_wal_receiver" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "conninfo", + "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_wal_receiver" + }, + "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_xact_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "columns": [ + { + "name": "funcid", + "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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "funcname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "calls", + "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_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "total_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_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_xact_user_functions" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "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_xact_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "seq_tup_read", + "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 + }, + { + "name": "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_tup_fetch", + "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 + }, + { + "name": "n_tup_ins", + "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 + }, + { + "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_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_tup_del", + "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 + }, + { + "name": "n_tup_hot_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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_all_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_sys_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelid", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "indexrelname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_read", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "blks_hit", + "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_statio_user_sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "columns": [ + { + "name": "relid", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "heap_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "idx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "toast_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_read", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tidx_blks_hit", + "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_statio_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "starelid", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staattnum", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stainherit", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanullfrac", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stawidth", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stadistinct", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stakind5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "staop5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stacoll5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stanumbers5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues1", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues2", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues3", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues4", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stavalues5", + "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_statistic" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxrelid", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxnamespace", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxowner", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxstattarget", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkeys", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxkind", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxexprs", + "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_statistic_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "columns": [ + { + "name": "tableoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxoid", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdinherit", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdndistinct", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxddependencies", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdmcv", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_mcv_list" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "stxdexpr", + "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_statistic_ext_data" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_pg_statistic" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attnames", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "exprs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "kinds", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_ndistinct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependencies", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_dependencies" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_val_nulls", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_base_freqs", + "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_stats_ext" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "statistics_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "expr", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "inherited", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "null_frac", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "avg_width", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "n_distinct", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_vals", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "histogram_bounds", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "correlation", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elems", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "anyarray" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "most_common_elem_freqs", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "elem_count_histogram", + "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_stats_ext_exprs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_float4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "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": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdbid", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subskiplsn", + "not_null": true, + "is_array": false, + "comment": "", + "length": 8, + "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": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subowner", + "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_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subenabled", + "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 + }, + { + "name": "subbinary", + "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 + }, + { + "name": "substream", + "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 + }, + { + "name": "subtwophasestate", + "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": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subdisableonerr", + "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 + }, + { + "name": "subconninfo", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subslotname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "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": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subsynccommit", + "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": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "subpublications", + "not_null": true, + "is_array": true, + "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 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "columns": [ + { + "name": "tableoid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srrelid", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsubstate", + "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_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srsublsn", + "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_subscription_rel" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_lsn" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tableowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tablespace", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasindexes", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hasrules", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "hastriggers", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "rowsecurity", + "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_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "columns": [ + { + "name": "tableoid", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcowner", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcacl", + "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_tablespace" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "spcoptions", + "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_tablespace" + }, + "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_timezone_abbrevs" + }, + "columns": [ + { + "name": "abbrev", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_abbrevs" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "columns": [ + { + "name": "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "abbrev", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "utc_offset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 16, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "interval" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_dst", + "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_timezone_names" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "columns": [ + { + "name": "tableoid", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftype", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trflang", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trffromsql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trftosql", + "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_transform" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "columns": [ + { + "name": "tableoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgparentid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgfoid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgtype", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgenabled", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgisinternal", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrrelid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstrindid", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgconstraint", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgdeferrable", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tginitdeferred", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgattr", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2vector" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgargs", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bytea" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgqual", + "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_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgoldtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tgnewtable", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_trigger" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgnamespace", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgowner", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cfgparser", + "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_ts_config" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapcfg", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maptokentype", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapseqno", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "mapdict", + "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_ts_config_map" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictnamespace", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictowner", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dicttemplate", + "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_ts_dict" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dictinitoption", + "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_ts_dict" + }, + "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_ts_parser" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsnamespace", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsstart", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prstoken", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsend", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prsheadline", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "prslextype", + "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_ts_parser" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "columns": [ + { + "name": "tableoid", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplnamespace", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmplinit", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "tmpllexize", + "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_ts_template" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "columns": [ + { + "name": "tableoid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typname", + "not_null": true, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnamespace", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typowner", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typlen", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbyval", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcategory", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typispreferred", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typisdefined", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdelim", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typrelid", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsubscript", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typelem", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typarray", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typinput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typoutput", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typreceive", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typsend", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typmodout", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typanalyze", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regproc" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typalign", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typstorage", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "char" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typnotnull", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typbasetype", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typtypmod", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typndims", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typcollation", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefaultbin", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "pg_node_tree" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typdefault", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "typacl", + "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_type" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_aclitem" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "columns": [ + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesysid", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usecreatedb", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usesuper", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "userepl", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usebypassrls", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "passwd", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "valuntil", + "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_user" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "useconfig", + "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_user" + }, + "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_user_mapping" + }, + "columns": [ + { + "name": "tableoid", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umserver", + "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_user_mapping" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mapping" + }, + "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_user_mappings" + }, + "columns": [ + { + "name": "umid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvid", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "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_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "usename", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "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_user_mappings" + }, + "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_views" + }, + "columns": [ + { + "name": "schemaname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "viewowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "definition", + "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_views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "information_schema", + "tables": [ + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "fdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "columns": [ + { + "name": "nspname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "relname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attname", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "name" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attfdwoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_table_columns" + }, + "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": "information_schema", + "name": "_pg_foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ftoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "columns": [ + { + "name": "oid", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umoptions", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "_text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "umuser", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "srvowner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "_pg_user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "administrable_role_authorizations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "columns": [ + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "applicable_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "attribute_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_derived_reference_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "attributes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "columns": [ + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_repertoire", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "form_of_use", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_collate_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "character_sets" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraint_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_clause", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "check_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collation_character_set_applicability" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "columns": [ + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "pad_attribute", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "collations" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dependent_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_domain_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "column_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_nullable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_self_referencing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_identity", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_start", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_maximum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_minimum", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "identity_cycle", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_generated", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "generation_expression", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "constraint_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "data_type_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domain_udt_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "columns": [ + { + "name": "domain_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "domains" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "columns": [ + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collection_type_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "domain_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "element_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "columns": [ + { + "name": "role_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "enabled_roles" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrapper_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "columns": [ + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "library_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_data_wrappers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_server_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "columns": [ + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_data_wrapper_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_version", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_servers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_table_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "columns": [ + { + "name": "foreign_table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "foreign_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "information_schema_catalog_name" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "position_in_unique_constraint", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "key_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordinal_position", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_mode", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_result", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_default", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "parameters" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "unique_constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "match_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "update_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "delete_rule", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "referential_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_column_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_routine_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_table_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_udt_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "role_usage_grants" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_sequence_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routine_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "columns": [ + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "module_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_body", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "routine_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "external_language", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "parameter_style", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deterministic", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_data_access", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_null_call", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_level_routine", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "max_dynamic_result_sets", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_user_defined_cast", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_implicitly_invocable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "security_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "to_sql_specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "last_altered", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "new_savepoint_level", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_udt_dependent", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_from_data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_as_locator", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_max_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_char_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_type_udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_scope_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_maximum_cardinality", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "result_cast_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "routines" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "columns": [ + { + "name": "catalog_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "schema_owner", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "default_character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sql_path", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "schemata" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "columns": [ + { + "name": "sequence_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sequence_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "start_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "minimum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "maximum_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "increment", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cycle_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sequences" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sub_feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_features" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "implementation_info_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "integer_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_implementation_info" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "feature_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_supported", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_verified_by", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_parts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "columns": [ + { + "name": "tableoid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmax", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "cmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "xmin", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "xid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ctid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 6, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "tid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_id", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "sizing_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "supported_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "comments", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "sql_sizing" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "columns": [ + { + "name": "constraint_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "constraint_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_deferrable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "initially_deferred", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "enforced", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "nulls_distinct", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_constraints" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "with_hierarchy", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "table_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "self_referencing_column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_generation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_typed", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "commit_action", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "columns": [ + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "group_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "transform_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "transforms" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_column", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggered_update_columns" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "columns": [ + { + "name": "trigger_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "trigger_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_manipulation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "event_object_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_order", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_condition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_statement", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_orientation", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_timing", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_table", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_old_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "action_reference_new_row", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "created", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "triggers" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "time_stamp" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "udt_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "udt_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "columns": [ + { + "name": "grantor", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "grantee", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "object_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "privilege_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_grantable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "usage_privileges" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "columns": [ + { + "name": "user_defined_type_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "user_defined_type_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_instantiable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_final", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_form", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_category", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ordering_routine_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "reference_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "data_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_maximum_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_octet_length", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "character_set_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "collation_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_precision_radix", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "numeric_scale", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "datetime_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "interval_precision", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "cardinal_number" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "source_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "ref_dtd_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_defined_types" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "option_value", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mapping_options" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "columns": [ + { + "name": "authorization_identifier", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "foreign_server_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "user_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "column_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_column_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "specific_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_routine_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "columns": [ + { + "name": "view_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "view_table_usage" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "columns": [ + { + "name": "table_catalog", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_schema", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "table_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": 64, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "sql_identifier" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "view_definition", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "check_option", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "character_data" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_updatable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_deletable", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "is_trigger_insertable_into", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "information_schema", + "name": "views" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "yes_or_no" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0 + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + } + ] + }, + "queries": [ + { + "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", + "name": "GetAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "SELECT id, name, bio FROM authors\nORDER BY name", + "name": "ListAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + }, + { + "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", + "name": "CreateAuthor", + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + }, + { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "name", + "unsigned": false, + "array_dims": 0 + } + }, + { + "number": 2, + "column": { + "name": "bio", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "bio", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": { + "catalog": "", + "schema": "", + "name": "authors" + } + }, + { + "text": "DELETE FROM authors\nWHERE id = $1", + "name": "DeleteAuthor", + "cmd": ":exec", + "columns": [], + "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": "", + "name": "authors" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bigserial" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0 + } + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + } + ], + "sqlc_version": "v1.30.0", + "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "global_options": "" +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/query.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/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/process_plugin_sqlc_gen_json/schema.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/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/process_plugin_sqlc_gen_json/sqlc.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/sqlc.json new file mode 100644 index 0000000000..f47189143a --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "jsonb", + "options": { + "indent": " ", + "filename": "codegen.json" + } + } + ] + } + ], + "plugins": [ + { + "name": "jsonb", + "process": { + "cmd": "sqlc-gen-json" + } + } + ] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json new file mode 100644 index 0000000000..1aa4920cb9 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json @@ -0,0 +1,4 @@ +{ + "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 new file mode 100644 index 0000000000..fa4beb305c --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json @@ -0,0 +1,6 @@ +{ + "env": [ + "SQLC_VERSION=v1.30.0", + "SQLC_DUMMY_VALUE=true" + ] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/query.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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/process_plugin_sqlc_gen_test/schema.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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/process_plugin_sqlc_gen_test/sqlc.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/sqlc.json new file mode 100644 index 0000000000..a2b0e8b931 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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", + "env": ["SQLC_DUMMY_VALUE"], + "process": { + "cmd": "sqlc-gen-test" + } + } + ] +} diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql new file mode 100644 index 0000000000..a71d662465 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE name = $1 AND country_code = $2 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, country_code +) VALUES ( + $1, $2, $3 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $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 new file mode 100644 index 0000000000..c473270913 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": -1 + } + ] + } + \ No newline at end of file diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt new file mode 100644 index 0000000000..9e1760ffca --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt @@ -0,0 +1,2 @@ +# 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/query_parameter_limit_param_only/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go new file mode 100644 index 0000000000..bf48c95dcc --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Notice struct { + ID int32 + Cnt int32 + Status string + NoticeAt sql.NullTime + CreatedAt time.Time +} 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 new file mode 100644 index 0000000000..571c4c2e91 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +type Querier interface { + CreateNotice(ctx context.Context, cnt int32, createdAt time.Time) error + MarkNoticeDone(ctx context.Context, noticeAt sql.NullTime, iD int32) error +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..065ea6b556 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const createNotice = `-- name: CreateNotice :exec +INSERT INTO notice (cnt, created_at) +VALUES ($1, $2) +` + +func (q *Queries) CreateNotice(ctx context.Context, cnt int32, createdAt time.Time) error { + _, err := q.db.ExecContext(ctx, createNotice, cnt, createdAt) + return err +} + +const markNoticeDone = `-- name: MarkNoticeDone :exec +UPDATE notice +SET status='done', notice_at=$1 +WHERE id=$2 +` + +func (q *Queries) MarkNoticeDone(ctx context.Context, noticeAt sql.NullTime, iD int32) error { + _, err := q.db.ExecContext(ctx, markNoticeDone, noticeAt, iD) + return err +} diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql new file mode 100644 index 0000000000..7622bafa13 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql @@ -0,0 +1,8 @@ +-- name: MarkNoticeDone :exec +UPDATE notice +SET status='done', notice_at=$1 +WHERE id=$2; + +-- name: CreateNotice :exec +INSERT INTO notice (cnt, created_at) +VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql new file mode 100644 index 0000000000..f07b5f4d7c --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE notice ( + id INTEGER NOT NULL, + cnt INTEGER NOT NULL, + status TEXT NOT NULL, + notice_at TIMESTAMP, + created_at TIMESTAMP NOT NULL +); + diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json new file mode 100644 index 0000000000..78d96c3e80 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 2, + "emit_interface": true, + "name": "querytest" + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/query_parameter_limit_to_two/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go new file mode 100644 index 0000000000..fff4b9d91a --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + CountryCode string + Titles []string +} + +type Client struct { + ID int32 + Name string +} 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 new file mode 100644 index 0000000000..af0d591ad1 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go @@ -0,0 +1,164 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "strings" + + "github.com/lib/pq" +) + +const addNewClient = `-- name: AddNewClient :one +INSERT INTO clients ( + id, name +) VALUES ( + $1, $2 +) +RETURNING id, name +` + +func (q *Queries) AddNewClient(ctx context.Context, iD int32, name string) (Client, error) { + row := q.db.QueryRowContext(ctx, addNewClient, iD, name) + var i Client + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, country_code, titles +) VALUES ( + $1, $2, $3, $4 +) +RETURNING id, name, bio, country_code, titles +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString + CountryCode string + Titles []string +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, + arg.Name, + arg.Bio, + arg.CountryCode, + pq.Array(arg.Titles), + ) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.CountryCode, + pq.Array(&i.Titles), + ) + return i, err +} + +const createAuthorOnlyTitles = `-- name: CreateAuthorOnlyTitles :one +INSERT INTO authors (name, titles) VALUES ($1, $2) RETURNING id, name, bio, country_code, titles +` + +func (q *Queries) CreateAuthorOnlyTitles(ctx context.Context, name string, titles []string) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthorOnlyTitles, name, pq.Array(titles)) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.CountryCode, + pq.Array(&i.Titles), + ) + 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 deleteAuthors = `-- name: DeleteAuthors :exec +DELETE FROM authors +WHERE id IN ($2) AND name = $1 +` + +func (q *Queries) DeleteAuthors(ctx context.Context, name string, ids []int64) error { + query := deleteAuthors + var queryParams []interface{} + queryParams = append(queryParams, name) + if len(ids) > 0 { + for _, v := range ids { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:ids*/?", strings.Repeat(",?", len(ids))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:ids*/?", "NULL", 1) + } + _, err := q.db.ExecContext(ctx, query, queryParams...) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, country_code, titles FROM authors +WHERE name = $1 AND country_code = $2 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, name string, countryCode string) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, name, countryCode) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.CountryCode, + pq.Array(&i.Titles), + ) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, country_code, titles 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, + &i.CountryCode, + pq.Array(&i.Titles), + ); 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/query_parameter_limit_to_two/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql new file mode 100644 index 0000000000..b255f75dbd --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql @@ -0,0 +1,34 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE name = $1 AND country_code = $2 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, country_code, titles +) VALUES ( + $1, $2, $3, $4 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthors :exec +DELETE FROM authors +WHERE id IN (sqlc.slice(ids)) AND name = $1; + +-- name: CreateAuthorOnlyTitles :one +INSERT INTO authors (name, titles) VALUES ($1, $2) RETURNING *; + +-- name: AddNewClient :one +INSERT INTO clients ( + id, name +) VALUES ( + $1, $2 +) +RETURNING *; diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql new file mode 100644 index 0000000000..eef7025648 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql @@ -0,0 +1,13 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + country_code CHAR(2) NOT NULL, + titles TEXT[] +); + +CREATE TABLE clients ( + id INT PRIMARY KEY, + name TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json new file mode 100644 index 0000000000..5aea38de5e --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 2 + } + ] + } + \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/query_parameter_limit_to_zero/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go new file mode 100644 index 0000000000..db9108bb80 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + CountryCode string +} 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 new file mode 100644 index 0000000000..0d2ece1477 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) + DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error + GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error) + ListAuthors(ctx context.Context) ([]Author, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..e0aa6b8c1b --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go @@ -0,0 +1,107 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, country_code +) VALUES ( + $1, $2, $3 +) +RETURNING id, name, bio, country_code +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString + CountryCode string +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio, arg.CountryCode) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.CountryCode, + ) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1 +` + +type DeleteAuthorParams struct { + ID int64 +} + +func (q *Queries) DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, arg.ID) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, country_code FROM authors +WHERE name = $1 AND country_code = $2 LIMIT 1 +` + +type GetAuthorParams struct { + Name string + CountryCode string +} + +func (q *Queries) GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, arg.Name, arg.CountryCode) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.CountryCode, + ) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, country_code 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, + &i.CountryCode, + ); 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/query_parameter_limit_to_zero/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql new file mode 100644 index 0000000000..a71d662465 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE name = $1 AND country_code = $2 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, country_code +) VALUES ( + $1, $2, $3 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql new file mode 100644 index 0000000000..d06fd86126 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +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_to_zero/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json new file mode 100644 index 0000000000..af2da739c1 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 0, + "emit_interface": true + } + ] + } + diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_colname/sqlite/go/models.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go new file mode 100644 index 0000000000..11b0271bc3 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5c12e677f6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testList = `-- name: TestList :many +SELECT id FROM "test" +` + +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_colname/sqlite/query.sql b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql new file mode 100644 index 0000000000..8b8ae15e9a --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: TestList :many +SELECT * FROM "test"; \ No newline at end of file diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql b/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql new file mode 100644 index 0000000000..8e6b5b38d6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE "test" +( + "id" TEXT NOT NULL +); + diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/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/quoted_names_complex/sqlite/go/db.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..333ea43ea3 --- /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.30.0 + +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..3f59aec9b9 --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..1bbac6281c --- /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.30.0 + +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..e6f06662ab --- /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.30.0 +// 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/ranges/pgx/v5/go/models.go b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go new file mode 100644 index 0000000000..07e82ad410 --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TestTable struct { + VDaterangeNull pgtype.Range[pgtype.Date] + VDatemultirangeNull pgtype.Multirange[pgtype.Range[pgtype.Date]] + VTsrangeNull pgtype.Range[pgtype.Timestamp] + VTsmultirangeNull pgtype.Multirange[pgtype.Range[pgtype.Timestamp]] + VTstzrangeNull pgtype.Range[pgtype.Timestamptz] + VTstzmultirangeNull pgtype.Multirange[pgtype.Range[pgtype.Timestamptz]] + VNumrangeNull pgtype.Range[pgtype.Numeric] + VNummultirangeNull pgtype.Multirange[pgtype.Range[pgtype.Numeric]] + VInt4rangeNull pgtype.Range[pgtype.Int4] + VInt4multirangeNull pgtype.Multirange[pgtype.Range[pgtype.Int4]] + VInt8rangeNull pgtype.Range[pgtype.Int8] + VInt8multirangeNull pgtype.Multirange[pgtype.Range[pgtype.Int8]] + VDaterange pgtype.Range[pgtype.Date] + VDatemultirange pgtype.Multirange[pgtype.Range[pgtype.Date]] + VTsrange pgtype.Range[pgtype.Timestamp] + VTsmultirange pgtype.Multirange[pgtype.Range[pgtype.Timestamp]] + VTstzrange pgtype.Range[pgtype.Timestamptz] + VTstzmultirange pgtype.Multirange[pgtype.Range[pgtype.Timestamptz]] + VNumrange pgtype.Range[pgtype.Numeric] + VNummultirange pgtype.Multirange[pgtype.Range[pgtype.Numeric]] + VInt4range pgtype.Range[pgtype.Int4] + VInt4multirange pgtype.Multirange[pgtype.Range[pgtype.Int4]] + VInt8range pgtype.Range[pgtype.Int8] + VInt8multirange pgtype.Multirange[pgtype.Range[pgtype.Int8]] +} diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..7231704edd --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_daterange_null, v_datemultirange_null, v_tsrange_null, v_tsmultirange_null, v_tstzrange_null, v_tstzmultirange_null, v_numrange_null, v_nummultirange_null, v_int4range_null, v_int4multirange_null, v_int8range_null, v_int8multirange_null, v_daterange, v_datemultirange, v_tsrange, v_tsmultirange, v_tstzrange, v_tstzmultirange, v_numrange, v_nummultirange, v_int4range, v_int4multirange, v_int8range, v_int8multirange from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VDaterangeNull, + &i.VDatemultirangeNull, + &i.VTsrangeNull, + &i.VTsmultirangeNull, + &i.VTstzrangeNull, + &i.VTstzmultirangeNull, + &i.VNumrangeNull, + &i.VNummultirangeNull, + &i.VInt4rangeNull, + &i.VInt4multirangeNull, + &i.VInt8rangeNull, + &i.VInt8multirangeNull, + &i.VDaterange, + &i.VDatemultirange, + &i.VTsrange, + &i.VTsmultirange, + &i.VTstzrange, + &i.VTstzmultirange, + &i.VNumrange, + &i.VNummultirange, + &i.VInt4range, + &i.VInt4multirange, + &i.VInt8range, + &i.VInt8multirange, + ); 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/ranges/pgx/v5/query.sql b/internal/endtoend/testdata/ranges/pgx/v5/query.sql new file mode 100644 index 0000000000..0119001690 --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SelectTest :many +SELECT * from test_table; diff --git a/internal/endtoend/testdata/ranges/pgx/v5/schema.sql b/internal/endtoend/testdata/ranges/pgx/v5/schema.sql new file mode 100644 index 0000000000..d217bb66f1 --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE test_table +( + v_daterange_null daterange, + v_datemultirange_null datemultirange, + v_tsrange_null tsrange, + v_tsmultirange_null tsmultirange, + v_tstzrange_null tstzrange, + v_tstzmultirange_null tstzmultirange, + v_numrange_null numrange, + v_nummultirange_null nummultirange, + v_int4range_null int4range, + v_int4multirange_null int4multirange, + v_int8range_null int8range, + v_int8multirange_null int8multirange, + v_daterange daterange not null, + v_datemultirange datemultirange not null, + v_tsrange tsrange not null, + v_tsmultirange tsmultirange not null, + v_tstzrange tstzrange not null, + v_tstzmultirange tstzmultirange not null, + v_numrange numrange not null, + v_nummultirange nummultirange not null, + v_int4range int4range not null, + v_int4multirange int4multirange not null, + v_int8range int8range not null, + v_int8multirange int8multirange not null +); + diff --git a/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json b/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/ranges/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/refreshmatview/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/refreshmatview/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f09d714a39 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..cee6ee9091 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const refresh = `-- name: Refresh :exec +REFRESH MATERIALIZED VIEW myview +` + +func (q *Queries) Refresh(ctx context.Context) error { + _, err := q.db.Exec(ctx, refresh) + return err +} diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3b3af63640 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Refresh :exec +REFRESH MATERIALIZED VIEW myview; diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..5b5f556495 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE MATERIALIZED VIEW myview AS (SELECT 1); + diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/refreshmatview/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f09d714a39 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..cee6ee9091 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const refresh = `-- name: Refresh :exec +REFRESH MATERIALIZED VIEW myview +` + +func (q *Queries) Refresh(ctx context.Context) error { + _, err := q.db.Exec(ctx, refresh) + return err +} diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3b3af63640 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Refresh :exec +REFRESH MATERIALIZED VIEW myview; diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..5b5f556495 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE MATERIALIZED VIEW myview AS (SELECT 1); + diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/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/relation_does_not_exist/postgresql/query.sql b/internal/endtoend/testdata/relation_does_not_exist/postgresql/query.sql new file mode 100644 index 0000000000..cb7e6e1398 --- /dev/null +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/query.sql @@ -0,0 +1,11 @@ +-- name: MissingSelect :many +SELECT * FROM nonexisting_relation WHERE name = 'foo'; + +-- name: MissingParam :many +SELECT * FROM nonexisting_relation WHERE name = $1; + +-- name: MissingUpdate :exec +UPDATE nonexisting_relation SET name = $1; + +-- name: MisingInsert :exec +INSERT INTO nonexisting_relation (id) VALUES ($1); diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/schema.sql b/internal/endtoend/testdata/relation_does_not_exist/postgresql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json b/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/base.txt b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/base.txt new file mode 100644 index 0000000000..0d8930ee17 --- /dev/null +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: relation "nonexisting_relation" does not exist +query.sql:5:1: relation "nonexisting_relation" does not exist +query.sql:8:1: relation "nonexisting_relation" does not exist +query.sql:11:1: relation "nonexisting_relation" does not exist diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..5621f9739e --- /dev/null +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:15: relation "nonexisting_relation" does not exist +query.sql:5:15: relation "nonexisting_relation" does not exist +query.sql:8:8: relation "nonexisting_relation" does not exist +query.sql:11:13: relation "nonexisting_relation" does not exist diff --git a/internal/endtoend/testdata/rename/go/db.go b/internal/endtoend/testdata/rename/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/rename/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/rename/go/models.go b/internal/endtoend/testdata/rename/go/models.go deleted file mode 100644 index 48864f384c..0000000000 --- a/internal/endtoend/testdata/rename/go/models.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -type IPProtocol string - -const ( - IPProtocolTCP IPProtocol = "tcp" - IpProtocolIp IPProtocol = "ip" - IpProtocolIcmp IPProtocol = "icmp" -) - -func (e *IPProtocol) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = IPProtocol(s) - case string: - *e = IPProtocol(s) - default: - return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) - } - return nil -} - -type BarNew struct { - IDNew int32 - IpOld IPProtocol -} diff --git a/internal/endtoend/testdata/rename/go/query.sql.go b/internal/endtoend/testdata/rename/go/query.sql.go deleted file mode 100644 index d3bfd6fe79..0000000000 --- a/internal/endtoend/testdata/rename/go/query.sql.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listBar = `-- name: ListBar :many -SELECT id_old, ip_old FROM bar_old -` - -func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.QueryContext(ctx, listBar) - if err != nil { - return nil, err - } - defer rows.Close() - var items []BarNew - for rows.Next() { - var i BarNew - if err := rows.Scan(&i.IDNew, &i.IpOld); 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 listFoo = `-- name: ListFoo :many -SELECT id_old as foo_old, id_old as baz_old -FROM bar_old -WHERE ip_old = $1 AND id_old = $2 -` - -type ListFooParams struct { - IpOld IPProtocol - IDNew int32 -} - -type ListFooRow struct { - FooNew int32 - BazOld int32 -} - -func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.QueryContext(ctx, listFoo, arg.IpOld, arg.IDNew) - if err != nil { - return nil, err - } - defer rows.Close() - var items []ListFooRow - for rows.Next() { - var i ListFooRow - if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/query.sql b/internal/endtoend/testdata/rename/query.sql deleted file mode 100644 index e91722b3f3..0000000000 --- a/internal/endtoend/testdata/rename/query.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - --- name: ListFoo :many -SELECT id_old as foo_old, id_old as baz_old -FROM bar_old -WHERE ip_old = $1 AND id_old = $2; - --- name: ListBar :many -SELECT * FROM bar_old; - diff --git a/internal/endtoend/testdata/rename/sqlc.json b/internal/endtoend/testdata/rename/sqlc.json deleted file mode 100644 index a7cf0ce2a7..0000000000 --- a/internal/endtoend/testdata/rename/sqlc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ], - "rename": { - "id_old": "IDNew", - "bar_old": "BarNew", - "foo_old": "FooNew", - "ip_protocol": "IPProtocol", - "ip_protocol_tcp": "IPProtocolTCP" - } -} diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/rename/v1/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} 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 new file mode 100644 index 0000000000..30a1622132 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v1/pgx/v4/query.sql b/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql b/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json b/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json new file mode 100644 index 0000000000..50288fccd8 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json @@ -0,0 +1,20 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } +} diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/rename/v1/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} 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 new file mode 100644 index 0000000000..30a1622132 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v1/pgx/v5/query.sql b/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql b/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json b/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json new file mode 100644 index 0000000000..89225718f3 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json @@ -0,0 +1,20 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } +} diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/db.go b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/rename/v1/stdlib/go/models.go b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go new file mode 100644 index 0000000000..b4f51c51fa --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); 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 listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.QueryContext(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v1/stdlib/query.sql b/internal/endtoend/testdata/rename/v1/stdlib/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v1/stdlib/schema.sql b/internal/endtoend/testdata/rename/v1/stdlib/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json b/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json new file mode 100644 index 0000000000..630709db5c --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json @@ -0,0 +1,18 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } +} diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/rename/v2/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} 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 new file mode 100644 index 0000000000..30a1622132 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v2/pgx/v4/query.sql b/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql b/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json b/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json new file mode 100644 index 0000000000..ae08b824a3 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json @@ -0,0 +1,24 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "sql_package": "pgx/v4", + "package": "querytest", + "out": "go", + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } + } + } + } + ] +} diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/rename/v2/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} 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 new file mode 100644 index 0000000000..30a1622132 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.Query(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v2/pgx/v5/query.sql b/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql b/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json b/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json new file mode 100644 index 0000000000..8f0a34dbad --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json @@ -0,0 +1,24 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "out": "go", + "sql_package": "pgx/v5", + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } + } + } + } + ] +} diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/db.go b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/rename/v2/stdlib/go/models.go b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go new file mode 100644 index 0000000000..7036918b46 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type IPProtocol string + +const ( + IPProtocolTCP IPProtocol = "tcp" + IpProtocolIp IPProtocol = "ip" + IpProtocolIcmp IPProtocol = "icmp" +) + +func (e *IPProtocol) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = IPProtocol(s) + case string: + *e = IPProtocol(s) + default: + return fmt.Errorf("unsupported scan type for IPProtocol: %T", src) + } + return nil +} + +type NullIPProtocol struct { + IPProtocol IPProtocol + Valid bool // Valid is true if IPProtocol is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullIPProtocol) Scan(value interface{}) error { + if value == nil { + ns.IPProtocol, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.IPProtocol.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullIPProtocol) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.IPProtocol), nil +} + +type BarNew struct { + IDNew int32 + IpOld IPProtocol +} diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go new file mode 100644 index 0000000000..b4f51c51fa --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id_old, ip_old FROM bar_old +` + +func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []BarNew + for rows.Next() { + var i BarNew + if err := rows.Scan(&i.IDNew, &i.IpOld); 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 listFoo = `-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2 +` + +type ListFooParams struct { + IpOld IPProtocol + IDNew int32 +} + +type ListFooRow struct { + FooNew int32 + BazOld int32 +} + +func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { + rows, err := q.db.QueryContext(ctx, listFoo, arg.IpOld, arg.IDNew) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListFooRow + for rows.Next() { + var i ListFooRow + if err := rows.Scan(&i.FooNew, &i.BazOld); 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/rename/v2/stdlib/query.sql b/internal/endtoend/testdata/rename/v2/stdlib/query.sql new file mode 100644 index 0000000000..a8211d0edb --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: ListFoo :many +SELECT id_old as foo_old, id_old as baz_old +FROM bar_old +WHERE ip_old = $1 AND id_old = $2; + +-- name: ListBar :many +SELECT * FROM bar_old; + diff --git a/internal/endtoend/testdata/rename/v2/stdlib/schema.sql b/internal/endtoend/testdata/rename/v2/stdlib/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json b/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json new file mode 100644 index 0000000000..22372fffad --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json @@ -0,0 +1,23 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "package": "querytest", + "out": "go", + "rename": { + "id_old": "IDNew", + "bar_old": "BarNew", + "foo_old": "FooNew", + "ip_protocol": "IPProtocol", + "ip_protocol_tcp": "IPProtocolTCP" + } + } + } + } + ] +} diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ca9c03dd51 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + Name sql.NullString + ID int32 +} 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 new file mode 100644 index 0000000000..c3c9a1d03d --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,97 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id +` + +func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { + row := q.db.QueryRow(ctx, deleteUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING name, id +` + +func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRow(ctx, deleteUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id +` + +func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { + row := q.db.QueryRow(ctx, insertUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING name, id +` + +func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRow(ctx, insertUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id +` + +type UpdateUserAndReturnIDParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { + row := q.db.QueryRow(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + var id int32 + err := row.Scan(&id) + return id, err +} + +const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING name, id +` + +type UpdateUserAndReturnUserParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { + row := q.db.QueryRow(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/returning/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..1da506161c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/query.sql @@ -0,0 +1,27 @@ +-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id; + +-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING *; + +-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id; + +-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING *; + +-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id; + +-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING *; diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/returning/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..5502e8ec7c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE users (name text, id serial primary key); diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/returning/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..be032c0c74 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + Name pgtype.Text + ID int32 +} 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 new file mode 100644 index 0000000000..20a0a245a2 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,98 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id +` + +func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name pgtype.Text) (int32, error) { + row := q.db.QueryRow(ctx, deleteUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING name, id +` + +func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name pgtype.Text) (User, error) { + row := q.db.QueryRow(ctx, deleteUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id +` + +func (q *Queries) InsertUserAndReturnID(ctx context.Context, name pgtype.Text) (int32, error) { + row := q.db.QueryRow(ctx, insertUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING name, id +` + +func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name pgtype.Text) (User, error) { + row := q.db.QueryRow(ctx, insertUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id +` + +type UpdateUserAndReturnIDParams struct { + Name pgtype.Text + Name_2 pgtype.Text +} + +func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { + row := q.db.QueryRow(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + var id int32 + err := row.Scan(&id) + return id, err +} + +const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING name, id +` + +type UpdateUserAndReturnUserParams struct { + Name pgtype.Text + Name_2 pgtype.Text +} + +func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { + row := q.db.QueryRow(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/returning/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..1da506161c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/query.sql @@ -0,0 +1,27 @@ +-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id; + +-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING *; + +-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id; + +-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING *; + +-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id; + +-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING *; diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/returning/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..5502e8ec7c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE users (name text, id serial primary key); diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/returning/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/returning/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/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ca9c03dd51 --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + Name sql.NullString + ID int32 +} diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..05d38d3c2a --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,97 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id +` + +func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { + row := q.db.QueryRowContext(ctx, deleteUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING name, id +` + +func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, deleteUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id +` + +func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { + row := q.db.QueryRowContext(ctx, insertUserAndReturnID, name) + var id int32 + err := row.Scan(&id) + return id, err +} + +const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING name, id +` + +func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, insertUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id +` + +type UpdateUserAndReturnIDParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { + row := q.db.QueryRowContext(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + var id int32 + err := row.Scan(&id) + return id, err +} + +const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING name, id +` + +type UpdateUserAndReturnUserParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { + row := q.db.QueryRowContext(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/query.sql b/internal/endtoend/testdata/returning/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..1da506161c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/query.sql @@ -0,0 +1,27 @@ +-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES ($1) + RETURNING id; + +-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES ($1) + RETURNING *; + +-- name: UpdateUserAndReturnID :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING id; + +-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = $1 + WHERE name = $2 + RETURNING *; + +-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = $1 + RETURNING id; + +-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = $1 + RETURNING *; diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/returning/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..5502e8ec7c --- /dev/null +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE users (name text, id serial primary key); diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/returning/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/returning/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/returning/sqlite/go/db.go b/internal/endtoend/testdata/returning/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/returning/sqlite/go/models.go new file mode 100644 index 0000000000..5385a7eebc --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + Name sql.NullString + ID int64 +} diff --git a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go new file mode 100644 index 0000000000..8767922088 --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go @@ -0,0 +1,97 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = ?1 + RETURNING id +` + +func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { + row := q.db.QueryRowContext(ctx, deleteUserAndReturnID, name) + var id int64 + err := row.Scan(&id) + return id, err +} + +const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = ?1 + RETURNING name, id +` + +func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, deleteUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES (?1) + RETURNING id +` + +func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { + row := q.db.QueryRowContext(ctx, insertUserAndReturnID, name) + var id int64 + err := row.Scan(&id) + return id, err +} + +const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES (?1) + RETURNING name, id +` + +func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, insertUserAndReturnUser, name) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} + +const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +UPDATE users SET name = ?1 + WHERE name = ?2 + RETURNING id +` + +type UpdateUserAndReturnIDParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int64, error) { + row := q.db.QueryRowContext(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + var id int64 + err := row.Scan(&id) + return id, err +} + +const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = ?1 + WHERE name = ?2 + RETURNING name, id +` + +type UpdateUserAndReturnUserParams struct { + Name sql.NullString + Name_2 sql.NullString +} + +func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { + row := q.db.QueryRowContext(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + var i User + err := row.Scan(&i.Name, &i.ID) + return i, err +} diff --git a/internal/endtoend/testdata/returning/sqlite/query.sql b/internal/endtoend/testdata/returning/sqlite/query.sql new file mode 100644 index 0000000000..ded7c9e810 --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/query.sql @@ -0,0 +1,27 @@ +-- name: InsertUserAndReturnID :one +INSERT INTO users (name) VALUES (?1) + RETURNING id; + +-- name: InsertUserAndReturnUser :one +INSERT INTO users (name) VALUES (?1) + RETURNING *; + +-- name: UpdateUserAndReturnID :one +UPDATE users SET name = ?1 + WHERE name = ?2 + RETURNING id; + +-- name: UpdateUserAndReturnUser :one +UPDATE users SET name = ?1 + WHERE name = ?2 + RETURNING *; + +-- name: DeleteUserAndReturnID :one +DELETE FROM users + WHERE name = ?1 + RETURNING id; + +-- name: DeleteUserAndReturnUser :one +DELETE FROM users + WHERE name = ?1 + RETURNING *; diff --git a/internal/endtoend/testdata/returning/sqlite/schema.sql b/internal/endtoend/testdata/returning/sqlite/schema.sql new file mode 100644 index 0000000000..6a2a156f40 --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE users (name text, id integer PRIMARY KEY AUTOINCREMENT); diff --git a/internal/endtoend/testdata/returning/sqlite/sqlc.json b/internal/endtoend/testdata/returning/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/returning/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 0fbc39e425..d9da85602e 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go @@ -1,10 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type FooBar struct { - ID int64 + 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 7fc8194dff..0217d24cf3 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +15,7 @@ INSERT INTO foo.bar (id, name) VALUES (?, ?) ` type SchemaScopedCreateParams struct { - ID int64 + ID uint64 Name string } diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql index 8e3d810b44..ac7e203e07 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedCreate :execresult INSERT INTO foo.bar (id, name) VALUES (?, ?); diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_create/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/schema_scoped_create/postgresql/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_create/postgresql/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/go/models.go deleted file mode 100644 index 5c9241aabd..0000000000 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { - ID int32 - Name string -} diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/go/query.sql.go deleted file mode 100644 index 8a738e1805..0000000000 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/go/query.sql.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const schemaScopedCreate = `-- name: SchemaScopedCreate :one -INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id -` - -type SchemaScopedCreateParams struct { - ID int32 - Name string -} - -func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { - row := q.db.QueryRowContext(ctx, schemaScopedCreate, arg.ID, arg.Name) - var id int32 - err := row.Scan(&id) - return id, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_create/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..553162e34c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedCreate = `-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id +` + +type SchemaScopedCreateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { + row := q.db.QueryRow(ctx, schemaScopedCreate, arg.ID, arg.Name) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ecc6fb1d49 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_create/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..553162e34c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedCreate = `-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id +` + +type SchemaScopedCreateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { + row := q.db.QueryRow(ctx, schemaScopedCreate, arg.ID, arg.Name) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ecc6fb1d49 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/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/schema_scoped_create/postgresql/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/query.sql deleted file mode 100644 index 6d7262e1d0..0000000000 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - --- name: SchemaScopedCreate :one -INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_create/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f8431ee605 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedCreate = `-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id +` + +type SchemaScopedCreateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { + row := q.db.QueryRowContext(ctx, schemaScopedCreate, arg.ID, arg.Name) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ecc6fb1d49 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedCreate :one +INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/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_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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 e4de2cfee2..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type FooBar struct { - ID int64 + 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 9515a65207..210e348762 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,7 +13,7 @@ const schemaScopedDelete = `-- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = ? ` -func (q *Queries) SchemaScopedDelete(ctx context.Context, id int64) error { +func (q *Queries) SchemaScopedDelete(ctx context.Context, id uint64) error { _, err := q.db.ExecContext(ctx, schemaScopedDelete, id) return err } diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql index 90464ce29d..3ba74206d2 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_delete/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/schema_scoped_delete/postgresql/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_delete/postgresql/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/models.go deleted file mode 100644 index 15c48626a7..0000000000 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/query.sql.go deleted file mode 100644 index c384cbf2cb..0000000000 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const schemaScopedDelete = `-- name: SchemaScopedDelete :exec -DELETE FROM foo.bar WHERE id = $1 -` - -func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, schemaScopedDelete, id) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_delete/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..ddee18e0e4 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { + _, err := q.db.Exec(ctx, schemaScopedDelete, id) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..e83763cfbc --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_delete/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..ddee18e0e4 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { + _, err := q.db.Exec(ctx, schemaScopedDelete, id) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..e83763cfbc --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/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/schema_scoped_delete/postgresql/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/query.sql deleted file mode 100644 index 0587634827..0000000000 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - --- name: SchemaScopedDelete :exec -DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_delete/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..b3066b689b --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { + _, err := q.db.ExecContext(ctx, schemaScopedDelete, id) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..e83763cfbc --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedDelete :exec +DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/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_enum/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_enum/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_enum/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/go/models.go deleted file mode 100644 index a33cd031ca..0000000000 --- a/internal/endtoend/testdata/schema_scoped_enum/go/models.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "fmt" -) - -type FooTypeUserRole string - -const ( - FooTypeUserRoleAdmin FooTypeUserRole = "admin" - FooTypeUserRoleUser FooTypeUserRole = "user" -) - -func (e *FooTypeUserRole) Scan(src interface{}) error { - switch s := src.(type) { - case []byte: - *e = FooTypeUserRole(s) - case string: - *e = FooTypeUserRole(s) - default: - return fmt.Errorf("unsupported scan type for FooTypeUserRole: %T", src) - } - return nil -} - -type FooUser struct { - Role FooTypeUserRole -} diff --git a/internal/endtoend/testdata/schema_scoped_enum/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/go/query.sql.go deleted file mode 100644 index 1a53febe11..0000000000 --- a/internal/endtoend/testdata/schema_scoped_enum/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listUsersByRole = `-- name: ListUsersByRole :many -SELECT role FROM foo.users WHERE role = $1 -` - -func (q *Queries) ListUsersByRole(ctx context.Context, role FooTypeUserRole) ([]FooTypeUserRole, error) { - rows, err := q.db.QueryContext(ctx, listUsersByRole, role) - if err != nil { - return nil, err - } - defer rows.Close() - var items []FooTypeUserRole - for rows.Next() { - var role FooTypeUserRole - if err := rows.Scan(&role); err != nil { - return nil, err - } - items = append(items, role) - } - 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/schema_scoped_enum/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_enum/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go new file mode 100644 index 0000000000..1c13b04072 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type FooTypeUserRole string + +const ( + FooTypeUserRoleAdmin FooTypeUserRole = "admin" + FooTypeUserRoleUser FooTypeUserRole = "user" +) + +func (e *FooTypeUserRole) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooTypeUserRole(s) + case string: + *e = FooTypeUserRole(s) + default: + return fmt.Errorf("unsupported scan type for FooTypeUserRole: %T", src) + } + return nil +} + +type NullFooTypeUserRole struct { + FooTypeUserRole FooTypeUserRole + Valid bool // Valid is true if FooTypeUserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooTypeUserRole) Scan(value interface{}) error { + if value == nil { + ns.FooTypeUserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooTypeUserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooTypeUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooTypeUserRole), nil +} + +type FooUser struct { + Role NullFooTypeUserRole +} 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 new file mode 100644 index 0000000000..3f490bbcf0 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role FROM foo.users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []NullFooTypeUserRole + for rows.Next() { + var role NullFooTypeUserRole + if err := rows.Scan(&role); err != nil { + return nil, err + } + items = append(items, role) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql new file mode 100644 index 0000000000..df3634b902 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_enum/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go new file mode 100644 index 0000000000..1c13b04072 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type FooTypeUserRole string + +const ( + FooTypeUserRoleAdmin FooTypeUserRole = "admin" + FooTypeUserRoleUser FooTypeUserRole = "user" +) + +func (e *FooTypeUserRole) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooTypeUserRole(s) + case string: + *e = FooTypeUserRole(s) + default: + return fmt.Errorf("unsupported scan type for FooTypeUserRole: %T", src) + } + return nil +} + +type NullFooTypeUserRole struct { + FooTypeUserRole FooTypeUserRole + Valid bool // Valid is true if FooTypeUserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooTypeUserRole) Scan(value interface{}) error { + if value == nil { + ns.FooTypeUserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooTypeUserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooTypeUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooTypeUserRole), nil +} + +type FooUser struct { + Role NullFooTypeUserRole +} 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 new file mode 100644 index 0000000000..3f490bbcf0 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role FROM foo.users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []NullFooTypeUserRole + for rows.Next() { + var role NullFooTypeUserRole + if err := rows.Scan(&role); err != nil { + return nil, err + } + items = append(items, role) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql new file mode 100644 index 0000000000..df3634b902 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/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/schema_scoped_enum/query.sql b/internal/endtoend/testdata/schema_scoped_enum/query.sql deleted file mode 100644 index 88b0416d86..0000000000 --- a/internal/endtoend/testdata/schema_scoped_enum/query.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE SCHEMA foo; - -CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); - -CREATE TABLE foo.users ( - role foo.type_user_role -); - --- name: ListUsersByRole :many -SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/schema_scoped_enum/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_enum/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go new file mode 100644 index 0000000000..1c13b04072 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type FooTypeUserRole string + +const ( + FooTypeUserRoleAdmin FooTypeUserRole = "admin" + FooTypeUserRoleUser FooTypeUserRole = "user" +) + +func (e *FooTypeUserRole) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = FooTypeUserRole(s) + case string: + *e = FooTypeUserRole(s) + default: + return fmt.Errorf("unsupported scan type for FooTypeUserRole: %T", src) + } + return nil +} + +type NullFooTypeUserRole struct { + FooTypeUserRole FooTypeUserRole + Valid bool // Valid is true if FooTypeUserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooTypeUserRole) Scan(value interface{}) error { + if value == nil { + ns.FooTypeUserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooTypeUserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooTypeUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooTypeUserRole), nil +} + +type FooUser struct { + Role NullFooTypeUserRole +} 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 new file mode 100644 index 0000000000..b20ca177cd --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role FROM foo.users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { + rows, err := q.db.QueryContext(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []NullFooTypeUserRole + for rows.Next() { + var role NullFooTypeUserRole + if err := rows.Scan(&role); err != nil { + return nil, err + } + items = append(items, role) + } + 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/schema_scoped_enum/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql new file mode 100644 index 0000000000..df3634b902 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 e4de2cfee2..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type FooBar struct { - ID int64 + 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 e54fe727e6..40c7da8c0c 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,15 +13,15 @@ const schemaScopedFilter = `-- name: SchemaScopedFilter :many SELECT id FROM foo.bar WHERE id = ? ` -func (q *Queries) SchemaScopedFilter(ctx context.Context, id int64) ([]int64, error) { +func (q *Queries) SchemaScopedFilter(ctx context.Context, id uint64) ([]uint64, error) { rows, err := q.db.QueryContext(ctx, schemaScopedFilter, id) if err != nil { return nil, err } defer rows.Close() - var items []int64 + var items []uint64 for rows.Next() { - var id int64 + var id uint64 if err := rows.Scan(&id); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql index a55cfa5e35..11490897dd 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedFilter :many SELECT * FROM foo.bar WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql new file mode 100644 index 0000000000..e5cb43f4bf --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_filter/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/schema_scoped_filter/postgresql/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_filter/postgresql/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/models.go deleted file mode 100644 index 15c48626a7..0000000000 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/query.sql.go deleted file mode 100644 index 6d64c649cd..0000000000 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const schemaScopedFilter = `-- name: SchemaScopedFilter :many -SELECT id FROM foo.bar WHERE id = $1 -` - -func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedFilter, id) - 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/schema_scoped_filter/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_filter/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..304d36042d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedFilter = `-- name: SchemaScopedFilter :many +SELECT id FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedFilter, id) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..11cba02f60 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedFilter :many +SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_filter/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..304d36042d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedFilter = `-- name: SchemaScopedFilter :many +SELECT id FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedFilter, id) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..11cba02f60 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedFilter :many +SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/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/schema_scoped_filter/postgresql/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/query.sql deleted file mode 100644 index 4ea93990a7..0000000000 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - --- name: SchemaScopedFilter :many -SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_filter/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3d11584e6e --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedFilter = `-- name: SchemaScopedFilter :many +SELECT id FROM foo.bar WHERE id = $1 +` + +func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedFilter, id) + 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/schema_scoped_filter/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..11cba02f60 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedFilter :many +SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/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_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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 e4de2cfee2..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type FooBar struct { - ID int64 + 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 98e291b3bc..6a26f8a6b4 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -7,19 +9,46 @@ import ( "context" ) +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedColList) + 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 schemaScopedList = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` -func (q *Queries) SchemaScopedList(ctx context.Context) ([]int64, error) { +func (q *Queries) SchemaScopedList(ctx context.Context) ([]uint64, error) { rows, err := q.db.QueryContext(ctx, schemaScopedList) if err != nil { return nil, err } defer rows.Close() - var items []int64 + var items []uint64 for rows.Next() { - var id int64 + var id uint64 if err := rows.Scan(&id); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql index cb8d6cdb61..66dab6bfe7 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql @@ -1,5 +1,5 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_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/schema_scoped_list/postgresql/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_list/postgresql/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/go/models.go deleted file mode 100644 index 15c48626a7..0000000000 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/go/query.sql.go deleted file mode 100644 index 9c79ed00fe..0000000000 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const schemaScopedList = `-- name: SchemaScopedList :many -SELECT id FROM foo.bar -` - -func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedList) - 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/schema_scoped_list/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..333d990343 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedColList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const schemaScopedList = `-- name: SchemaScopedList :many +SELECT id FROM foo.bar +` + +func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c508143f43 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: SchemaScopedList :many +SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..333d990343 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedColList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const schemaScopedList = `-- name: SchemaScopedList :many +SELECT id FROM foo.bar +` + +func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c508143f43 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: SchemaScopedList :many +SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/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/schema_scoped_list/postgresql/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/query.sql deleted file mode 100644 index cb8d6cdb61..0000000000 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - --- name: SchemaScopedList :many -SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f90d97a6eb --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..33e8ff0096 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedColList) + 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 schemaScopedList = `-- name: SchemaScopedList :many +SELECT id FROM foo.bar +` + +func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedList) + 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/schema_scoped_list/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c508143f43 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: SchemaScopedList :many +SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/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_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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 0fbc39e425..d9da85602e 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go @@ -1,10 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type FooBar struct { - ID int64 + 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 08b211e114..8e4d7546d5 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +15,7 @@ UPDATE foo.bar SET name = ? WHERE id = ? type SchemaScopedUpdateParams struct { Name string - ID int64 + ID uint64 } func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql index 76d1eb953b..1c3c644037 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = ? WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_update/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/schema_scoped_update/postgresql/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/schema_scoped_update/postgresql/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/go/models.go deleted file mode 100644 index 5c9241aabd..0000000000 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type FooBar struct { - ID int32 - Name string -} diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/go/query.sql.go deleted file mode 100644 index 60cf602cc1..0000000000 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/go/query.sql.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec -UPDATE foo.bar SET name = $2 WHERE id = $1 -` - -type SchemaScopedUpdateParams struct { - ID int32 - Name string -} - -func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { - _, err := q.db.ExecContext(ctx, schemaScopedUpdate, arg.ID, arg.Name) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_scoped_update/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..54e213ac9f --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1 +` + +type SchemaScopedUpdateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { + _, err := q.db.Exec(ctx, schemaScopedUpdate, arg.ID, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..3649c25eb4 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_scoped_update/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..54e213ac9f --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1 +` + +type SchemaScopedUpdateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { + _, err := q.db.Exec(ctx, schemaScopedUpdate, arg.ID, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..3649c25eb4 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/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/schema_scoped_update/postgresql/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/query.sql deleted file mode 100644 index 99d08246a4..0000000000 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - --- name: SchemaScopedUpdate :exec -UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/schema_scoped_update/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..db32907a18 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..cfbc8429e9 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1 +` + +type SchemaScopedUpdateParams struct { + ID int32 + Name string +} + +func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { + _, err := q.db.ExecContext(ctx, schemaScopedUpdate, arg.ID, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3649c25eb4 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SchemaScopedUpdate :exec +UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/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_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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..225430ef85 --- /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.30.0 + +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..2b55ca7204 --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/select_column_cast/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_column_cast/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_column_cast/go/models.go b/internal/endtoend/testdata/select_column_cast/go/models.go deleted file mode 100644 index c7700695cd..0000000000 --- a/internal/endtoend/testdata/select_column_cast/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Bar bool -} diff --git a/internal/endtoend/testdata/select_column_cast/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/go/query.sql.go deleted file mode 100644 index ceb87b72ac..0000000000 --- a/internal/endtoend/testdata/select_column_cast/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectColumnCast = `-- name: SelectColumnCast :many -SELECT bar::int FROM foo -` - -func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, selectColumnCast) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var bar int32 - 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/select_column_cast/mysql/go/db.go b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_column_cast/mysql/go/models.go b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..bfe7263f56 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT CAST(bar AS UNSIGNED) FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var bar int64 + 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/select_column_cast/mysql/query.sql b/internal/endtoend/testdata/select_column_cast/mysql/query.sql new file mode 100644 index 0000000000..dc083f3590 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: SelectColumnCast :many +SELECT CAST(bar AS UNSIGNED) FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/mysql/schema.sql b/internal/endtoend/testdata/select_column_cast/mysql/schema.sql new file mode 100644 index 0000000000..51f66c6cfc --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar BOOLEAN NOT NULL); + diff --git a/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json b/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/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/select_column_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_column_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..0840542975 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SelectColumnCast :many +SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_column_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..0840542975 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SelectColumnCast :many +SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/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/select_column_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_column_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..04bc70ad65 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..8e24d6bb96 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + 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/select_column_cast/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SelectColumnCast :many +SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_column_cast/query.sql b/internal/endtoend/testdata/select_column_cast/query.sql deleted file mode 100644 index 412fe6b77b..0000000000 --- a/internal/endtoend/testdata/select_column_cast/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null); - --- name: SelectColumnCast :many -SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/sqlc.json b/internal/endtoend/testdata/select_column_cast/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_column_cast/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_column_cast/sqlite/go/models.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go new file mode 100644 index 0000000000..0cd442222e --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1ecd627432 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT CAST(bar AS BLOB) FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([][]byte, error) { + rows, err := q.db.QueryContext(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]byte + for rows.Next() { + var bar []byte + 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/select_column_cast/sqlite/query.sql b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql new file mode 100644 index 0000000000..4775543757 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: SelectColumnCast :many +SELECT CAST(bar AS BLOB) FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql b/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql new file mode 100644 index 0000000000..883b4580b6 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar TEXT NOT NULL); + diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json b/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/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/select_cte/sqlite/go/db.go b/internal/endtoend/testdata/select_cte/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_cte/sqlite/go/models.go b/internal/endtoend/testdata/select_cte/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go new file mode 100644 index 0000000000..672d639af9 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +WITH abc AS ( + SELECT 1 AS n +) +SELECT n FROM abc +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var n int64 + if err := rows.Scan(&n); err != nil { + return nil, err + } + items = append(items, n) + } + 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_cte/sqlite/query.sql b/internal/endtoend/testdata/select_cte/sqlite/query.sql new file mode 100644 index 0000000000..2f538b84e6 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: ListAuthors :many +WITH abc AS ( + SELECT 1 AS n +) +SELECT * FROM abc; diff --git a/internal/endtoend/testdata/select_cte/sqlite/schema.sql b/internal/endtoend/testdata/select_cte/sqlite/schema.sql new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/schema.sql @@ -0,0 +1 @@ + diff --git a/internal/endtoend/testdata/select_cte/sqlite/sqlc.json b/internal/endtoend/testdata/select_cte/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/select_cte/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/select_distinct/go/db.go b/internal/endtoend/testdata/select_distinct/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_distinct/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_distinct/go/models.go b/internal/endtoend/testdata/select_distinct/go/models.go deleted file mode 100644 index b928e98774..0000000000 --- a/internal/endtoend/testdata/select_distinct/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - ID int32 - Name sql.NullString -} diff --git a/internal/endtoend/testdata/select_distinct/go/query.sql.go b/internal/endtoend/testdata/select_distinct/go/query.sql.go deleted file mode 100644 index f7dceaa445..0000000000 --- a/internal/endtoend/testdata/select_distinct/go/query.sql.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const getBars = `-- name: GetBars :many -SELECT DISTINCT ON (a.id) a.id, a.name -FROM bar a -` - -func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, getBars) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Bar - for rows.Next() { - var i Bar - 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/select_distinct/pgx/v4/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_distinct/pgx/v4/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go new file mode 100644 index 0000000000..91dd1c85fd --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Name sql.NullString +} 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 new file mode 100644 index 0000000000..6ff3d6e3e5 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.id, a.name +FROM bar a +` + +func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + 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/select_distinct/pgx/v4/query.sql b/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql new file mode 100644 index 0000000000..8f8cafc523 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.* +FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql b/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_distinct/pgx/v5/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go new file mode 100644 index 0000000000..2e5e0b9352 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..6ff3d6e3e5 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.id, a.name +FROM bar a +` + +func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + 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/select_distinct/pgx/v5/query.sql b/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql new file mode 100644 index 0000000000..8f8cafc523 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.* +FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql b/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/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/select_distinct/query.sql b/internal/endtoend/testdata/select_distinct/query.sql deleted file mode 100644 index 4327cd32e4..0000000000 --- a/internal/endtoend/testdata/select_distinct/query.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE bar (id serial not null, name text); - --- name: GetBars :many -SELECT DISTINCT ON (a.id) a.* -FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/sqlc.json b/internal/endtoend/testdata/select_distinct/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_distinct/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/db.go b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_distinct/stdlib/go/models.go b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go new file mode 100644 index 0000000000..91dd1c85fd --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go new file mode 100644 index 0000000000..c1d4f2ef06 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.id, a.name +FROM bar a +` + +func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + 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/select_distinct/stdlib/query.sql b/internal/endtoend/testdata/select_distinct/stdlib/query.sql new file mode 100644 index 0000000000..8f8cafc523 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetBars :many +SELECT DISTINCT ON (a.id) a.* +FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/stdlib/schema.sql b/internal/endtoend/testdata/select_distinct/stdlib/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json b/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql new file mode 100644 index 0000000000..ae6cd0c9be --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetBars :many +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 new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/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/select_empty_column_list/mysql/stderr.txt b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt new file mode 100644 index 0000000000..2744126cd0 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_empty_column_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..91dd1c85fd --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Name sql.NullString +} 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 new file mode 100644 index 0000000000..c7ebc00934 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT FROM bar LIMIT 5 +` + +type GetBarsRow struct { +} + +func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { + rows, err := q.db.Query(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetBarsRow + for rows.Next() { + var i GetBarsRow + if err := rows.Scan(); 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_empty_column_list/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..d67332969c --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetBars :many +SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_empty_column_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..2e5e0b9352 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + ID int32 + Name pgtype.Text +} 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 new file mode 100644 index 0000000000..c7ebc00934 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT FROM bar LIMIT 5 +` + +type GetBarsRow struct { +} + +func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { + rows, err := q.db.Query(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetBarsRow + for rows.Next() { + var i GetBarsRow + if err := rows.Scan(); 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_empty_column_list/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..d67332969c --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetBars :many +SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/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/select_empty_column_list/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_empty_column_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..91dd1c85fd --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + ID int32 + Name sql.NullString +} 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 new file mode 100644 index 0000000000..288c4e4c11 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getBars = `-- name: GetBars :many +SELECT FROM bar LIMIT 5 +` + +type GetBarsRow struct { +} + +func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { + rows, err := q.db.QueryContext(ctx, getBars) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetBarsRow + for rows.Next() { + var i GetBarsRow + if err := rows.Scan(); 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_empty_column_list/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..d67332969c --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetBars :many +SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/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/select_exists/go/db.go b/internal/endtoend/testdata/select_exists/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_exists/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_exists/go/models.go b/internal/endtoend/testdata/select_exists/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/select_exists/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/select_exists/go/query.sql.go b/internal/endtoend/testdata/select_exists/go/query.sql.go deleted file mode 100644 index f1e203d85c..0000000000 --- a/internal/endtoend/testdata/select_exists/go/query.sql.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const barExists = `-- name: BarExists :one -SELECT - EXISTS ( - SELECT - 1 - FROM - bar - where - id = $1 - ) -` - -func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRowContext(ctx, barExists, id) - var exists bool - err := row.Scan(&exists) - return exists, err -} diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f7903b1f2b --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barExists = `-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { + row := q.db.QueryRow(ctx, barExists, id) + var exists bool + err := row.Scan(&exists) + return exists, err +} diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/query.sql b/internal/endtoend/testdata/select_exists/pgx/v4/query.sql new file mode 100644 index 0000000000..635b4682c2 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/query.sql @@ -0,0 +1,10 @@ +-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql b/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f7903b1f2b --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barExists = `-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { + row := q.db.QueryRow(ctx, barExists, id) + var exists bool + err := row.Scan(&exists) + return exists, err +} diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/query.sql b/internal/endtoend/testdata/select_exists/pgx/v5/query.sql new file mode 100644 index 0000000000..635b4682c2 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/query.sql @@ -0,0 +1,10 @@ +-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql b/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/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/select_exists/query.sql b/internal/endtoend/testdata/select_exists/query.sql deleted file mode 100644 index aae94835e1..0000000000 --- a/internal/endtoend/testdata/select_exists/query.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: BarExists :one -SELECT - EXISTS ( - SELECT - 1 - FROM - bar - where - id = $1 - ); diff --git a/internal/endtoend/testdata/select_exists/sqlc.json b/internal/endtoend/testdata/select_exists/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_exists/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/db.go b/internal/endtoend/testdata/select_exists/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_exists/sqlite/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..b30fa7d95a --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barExists = `-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = ? + ) +` + +func (q *Queries) BarExists(ctx context.Context, id int64) (bool, error) { + row := q.db.QueryRowContext(ctx, barExists, id) + 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 new file mode 100644 index 0000000000..5173a4418f --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/query.sql @@ -0,0 +1,10 @@ +-- name: BarExists :one +SELECT + 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 new file mode 100644 index 0000000000..cf6a8b9507 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id integer not null primary key autoincrement); diff --git a/internal/endtoend/testdata/select_exists/sqlite/sqlc.json b/internal/endtoend/testdata/select_exists/sqlite/sqlc.json new file mode 100644 index 0000000000..9655954bd4 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_exists/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_exists/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..fa42d32f60 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barExists = `-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { + row := q.db.QueryRowContext(ctx, barExists, id) + var exists bool + err := row.Scan(&exists) + return exists, err +} diff --git a/internal/endtoend/testdata/select_exists/stdlib/query.sql b/internal/endtoend/testdata/select_exists/stdlib/query.sql new file mode 100644 index 0000000000..635b4682c2 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/query.sql @@ -0,0 +1,10 @@ +-- name: BarExists :one +SELECT + EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_exists/stdlib/schema.sql b/internal/endtoend/testdata/select_exists/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/stdlib/sqlc.json b/internal/endtoend/testdata/select_exists/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/db.go b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_in_and/sqlite/go/models.go b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go new file mode 100644 index 0000000000..eabb4ea4eb --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Age sql.NullInt64 +} + +type Book struct { + ID int64 + Author string + Translator string + Year sql.NullInt64 +} + +type Translator struct { + ID int64 + Name string + Age sql.NullInt64 +} 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 new file mode 100644 index 0000000000..4a8ebb36b6 --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM + books AS b +WHERE + b.author NOT IN ( + SELECT + a.name + FROM + authors a + WHERE + a.age >= ? + ) + AND b.translator NOT IN ( + SELECT + t.name + FROM + translators t + WHERE + t.age >= ? + ) + AND b.year <= ? +` + +type DeleteAuthorParams struct { + Age sql.NullInt64 + Age_2 sql.NullInt64 + Year sql.NullInt64 +} + +func (q *Queries) DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, arg.Age, arg.Age_2, arg.Year) + return err +} diff --git a/internal/endtoend/testdata/select_in_and/sqlite/query.sql b/internal/endtoend/testdata/select_in_and/sqlite/query.sql new file mode 100644 index 0000000000..4bad135e3d --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/query.sql @@ -0,0 +1,21 @@ +-- name: DeleteAuthor :exec +DELETE FROM + books AS b +WHERE + b.author NOT IN ( + SELECT + a.name + FROM + authors a + WHERE + a.age >= ? + ) + AND b.translator NOT IN ( + SELECT + t.name + FROM + translators t + WHERE + t.age >= ? + ) + AND b.year <= ?; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_in_and/sqlite/schema.sql b/internal/endtoend/testdata/select_in_and/sqlite/schema.sql new file mode 100644 index 0000000000..76505b14c3 --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/schema.sql @@ -0,0 +1,20 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE translators ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE books ( + id integer PRIMARY KEY, + author text NOT NULL, + translator text NOT NULL, + year integer +); + diff --git a/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json b/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json new file mode 100644 index 0000000000..99b3b5f074 --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json @@ -0,0 +1 @@ +{"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/select_limit/mysql/go/db.go b/internal/endtoend/testdata/select_limit/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/db.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/go/models.go b/internal/endtoend/testdata/select_limit/mysql/go/models.go index 6ba5de081e..ef22c3818c 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/models.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 5e35166ef7..2b61d10df1 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/query.sql b/internal/endtoend/testdata/select_limit/mysql/query.sql index 4b5e81997f..1fea17c583 100644 --- a/internal/endtoend/testdata/select_limit/mysql/query.sql +++ b/internal/endtoend/testdata/select_limit/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - /* name: FooLimit :many */ SELECT a FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/select_limit/mysql/schema.sql b/internal/endtoend/testdata/select_limit/mysql/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/mysql/sqlc.json b/internal/endtoend/testdata/select_limit/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/select_limit/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_limit/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/select_limit/postgresql/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_limit/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_limit/postgresql/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/go/models.go deleted file mode 100644 index 6ba5de081e..0000000000 --- a/internal/endtoend/testdata/select_limit/postgresql/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString -} diff --git a/internal/endtoend/testdata/select_limit/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/go/query.sql.go deleted file mode 100644 index 84ce5a8d36..0000000000 --- a/internal/endtoend/testdata/select_limit/postgresql/go/query.sql.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const fooLimit = `-- name: FooLimit :many -SELECT a FROM foo -LIMIT $1 -` - -func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimit, limit) - if err != nil { - return nil, err - } - defer rows.Close() - var items []sql.NullString - for rows.Next() { - var a sql.NullString - if err := rows.Scan(&a); err != nil { - return nil, err - } - items = append(items, a) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const fooLimitOffset = `-- name: FooLimitOffset :many -SELECT a FROM foo -LIMIT $1 OFFSET $2 -` - -type FooLimitOffsetParams struct { - Limit int32 - Offset int32 -} - -func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) - if err != nil { - return nil, err - } - defer rows.Close() - var items []sql.NullString - for rows.Next() { - var a sql.NullString - if err := rows.Scan(&a); err != nil { - return nil, err - } - items = append(items, a) - } - 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_limit/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_limit/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ef22c3818c --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString +} 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 new file mode 100644 index 0000000000..056d67dbce --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,66 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooLimit = `-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1 +` + +func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, fooLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const fooLimitOffset = `-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2 +` + +type FooLimitOffsetParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, fooLimitOffset, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..11907d0636 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql @@ -0,0 +1,7 @@ +-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1; + +-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2; diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_limit/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..670033a63c --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text +} 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 new file mode 100644 index 0000000000..d499f076e4 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const fooLimit = `-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1 +` + +func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, fooLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var a pgtype.Text + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const fooLimitOffset = `-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2 +` + +type FooLimitOffsetParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, fooLimitOffset, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var a pgtype.Text + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..11907d0636 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql @@ -0,0 +1,7 @@ +-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1; + +-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2; diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/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/select_limit/postgresql/query.sql b/internal/endtoend/testdata/select_limit/postgresql/query.sql deleted file mode 100644 index 2068bc407a..0000000000 --- a/internal/endtoend/testdata/select_limit/postgresql/query.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE foo (a text); - --- name: FooLimit :many -SELECT a FROM foo -LIMIT $1; - --- name: FooLimitOffset :many -SELECT a FROM foo -LIMIT $1 OFFSET $2; diff --git a/internal/endtoend/testdata/select_limit/postgresql/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/select_limit/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json b/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_limit/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ef22c3818c --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString +} 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 new file mode 100644 index 0000000000..0ddc5a11e1 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooLimit = `-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1 +` + +func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, fooLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const fooLimitOffset = `-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2 +` + +type FooLimitOffsetParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + 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_limit/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..11907d0636 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql @@ -0,0 +1,7 @@ +-- name: FooLimit :many +SELECT a FROM foo +LIMIT $1; + +-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT $1 OFFSET $2; diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/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/select_limit/sqlite/go/db.go b/internal/endtoend/testdata/select_limit/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_limit/sqlite/go/models.go b/internal/endtoend/testdata/select_limit/sqlite/go/models.go new file mode 100644 index 0000000000..ef22c3818c --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString +} diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go new file mode 100644 index 0000000000..c4064b2c6e --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const fooLimit = `-- name: FooLimit :many +SELECT a FROM foo +LIMIT ? +` + +func (q *Queries) FooLimit(ctx context.Context, limit int64) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, fooLimit, limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const fooLimitOffset = `-- name: FooLimitOffset :many +SELECT a FROM foo +LIMIT ? OFFSET ? +` + +type FooLimitOffsetParams struct { + Limit int64 + Offset int64 +} + +func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var a sql.NullString + if err := rows.Scan(&a); err != nil { + return nil, err + } + items = append(items, a) + } + 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_limit/sqlite/query.sql b/internal/endtoend/testdata/select_limit/sqlite/query.sql new file mode 100644 index 0000000000..1fea17c583 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/query.sql @@ -0,0 +1,7 @@ +/* name: FooLimit :many */ +SELECT a FROM foo +LIMIT ?; + +/* name: FooLimitOffset :many */ +SELECT a FROM foo +LIMIT ? OFFSET ?; diff --git a/internal/endtoend/testdata/select_limit/sqlite/schema.sql b/internal/endtoend/testdata/select_limit/sqlite/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/sqlite/sqlc.json b/internal/endtoend/testdata/select_limit/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/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/select_nested_count/mysql/go/db.go b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_nested_count/mysql/go/models.go b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go new file mode 100644 index 0000000000..ff7cddbbb4 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Book struct { + ID int64 + AuthorID int64 + Title string +} 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 new file mode 100644 index 0000000000..613933c70c --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go @@ -0,0 +1,54 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +SELECT id, name, bio, ( + SELECT COUNT(id) FROM books + WHERE books.author_id = id +) AS books_count +FROM authors +` + +type GetAuthorsWithBooksCountRow struct { + ID int64 + Name string + Bio sql.NullString + BooksCount int64 +} + +func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAuthorsWithBooksCountRow + for rows.Next() { + var i GetAuthorsWithBooksCountRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.BooksCount, + ); 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_nested_count/mysql/query.sql b/internal/endtoend/testdata/select_nested_count/mysql/query.sql new file mode 100644 index 0000000000..3fe51959c3 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/query.sql @@ -0,0 +1,6 @@ +-- name: GetAuthorsWithBooksCount :many +SELECT *, ( + SELECT COUNT(id) FROM books + WHERE books.author_id = id +) AS books_count +FROM authors; diff --git a/internal/endtoend/testdata/select_nested_count/mysql/schema.sql b/internal/endtoend/testdata/select_nested_count/mysql/schema.sql new file mode 100644 index 0000000000..dffe2e984b --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/schema.sql @@ -0,0 +1,13 @@ +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 + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json b/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json new file mode 100644 index 0000000000..d3ae3f44ec --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql" + } + ] +} diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_nested_count/postgresql/go/models.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go new file mode 100644 index 0000000000..ff7cddbbb4 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Book struct { + ID int64 + AuthorID int64 + Title string +} 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 new file mode 100644 index 0000000000..613933c70c --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go @@ -0,0 +1,54 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +SELECT id, name, bio, ( + SELECT COUNT(id) FROM books + WHERE books.author_id = id +) AS books_count +FROM authors +` + +type GetAuthorsWithBooksCountRow struct { + ID int64 + Name string + Bio sql.NullString + BooksCount int64 +} + +func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAuthorsWithBooksCountRow + for rows.Next() { + var i GetAuthorsWithBooksCountRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.BooksCount, + ); 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_nested_count/postgresql/query.sql b/internal/endtoend/testdata/select_nested_count/postgresql/query.sql new file mode 100644 index 0000000000..3fe51959c3 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/query.sql @@ -0,0 +1,6 @@ +-- name: GetAuthorsWithBooksCount :many +SELECT *, ( + SELECT COUNT(id) FROM books + WHERE books.author_id = id +) AS books_count +FROM authors; diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql b/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql new file mode 100644 index 0000000000..85e8fd5572 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + author_id BIGSERIAL NOT NULL + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json b/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_nested_count/sqlite/go/models.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go new file mode 100644 index 0000000000..ff7cddbbb4 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type Book struct { + ID int64 + AuthorID int64 + Title string +} 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 new file mode 100644 index 0000000000..613933c70c --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go @@ -0,0 +1,54 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +SELECT id, name, bio, ( + SELECT COUNT(id) FROM books + WHERE books.author_id = id +) AS books_count +FROM authors +` + +type GetAuthorsWithBooksCountRow struct { + ID int64 + Name string + Bio sql.NullString + BooksCount int64 +} + +func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAuthorsWithBooksCountRow + for rows.Next() { + var i GetAuthorsWithBooksCountRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.BooksCount, + ); 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_nested_count/sqlite/query.sql b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql new file mode 100644 index 0000000000..3fe51959c3 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql @@ -0,0 +1,6 @@ +-- name: GetAuthorsWithBooksCount :many +SELECT *, ( + 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/schema.sql b/internal/endtoend/testdata/select_nested_count/sqlite/schema.sql new file mode 100644 index 0000000000..dffe2e984b --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/schema.sql @@ -0,0 +1,13 @@ +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 + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json b/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json new file mode 100644 index 0000000000..53eda65f7c --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "sqlite" + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_not_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f9e0b3050d --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barNotExists = `-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarNotExists(ctx context.Context, id int32) (bool, error) { + row := q.db.QueryRow(ctx, barNotExists, id) + var not_exists bool + err := row.Scan(¬_exists) + return not_exists, err +} diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql b/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql new file mode 100644 index 0000000000..f32ee625be --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql @@ -0,0 +1,10 @@ +-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql b/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_not_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f9e0b3050d --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barNotExists = `-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarNotExists(ctx context.Context, id int32) (bool, error) { + row := q.db.QueryRow(ctx, barNotExists, id) + var not_exists bool + err := row.Scan(¬_exists) + return not_exists, err +} diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql b/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql new file mode 100644 index 0000000000..f32ee625be --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql @@ -0,0 +1,10 @@ +-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql b/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/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/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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_not_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go new file mode 100644 index 0000000000..1344b5dab9 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..91dea13570 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barNotExists = `-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + WHERE + id = ? + ) +` + +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 new file mode 100644 index 0000000000..f7e76ae92c --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/query.sql @@ -0,0 +1,11 @@ +-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + WHERE + id = ? + ); + diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql b/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql new file mode 100644 index 0000000000..6cc3882f5a --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer not null primary key autoincrement); + diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json b/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json new file mode 100644 index 0000000000..9655954bd4 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_not_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..c1d20849df --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const barNotExists = `-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ) +` + +func (q *Queries) BarNotExists(ctx context.Context, id int32) (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/stdlib/query.sql b/internal/endtoend/testdata/select_not_exists/stdlib/query.sql new file mode 100644 index 0000000000..f32ee625be --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/query.sql @@ -0,0 +1,10 @@ +-- name: BarNotExists :one +SELECT + NOT EXISTS ( + SELECT + 1 + FROM + bar + where + id = $1 + ); diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql b/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json b/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..333ea43ea3 --- /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.30.0 + +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..02e74b6afb --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/db.go +++ b/internal/endtoend/testdata/select_star/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/mysql/go/models.go b/internal/endtoend/testdata/select_star/mysql/go/models.go index 4c02540e98..f5668bd976 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/models.go +++ b/internal/endtoend/testdata/select_star/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 062f587b58..dd10b59022 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -38,3 +40,30 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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/select_star/mysql/query.sql b/internal/endtoend/testdata/select_star/mysql/query.sql index e2f85e2a9a..4c230627d0 100644 --- a/internal/endtoend/testdata/select_star/mysql/query.sql +++ b/internal/endtoend/testdata/select_star/mysql/query.sql @@ -1,2 +1,5 @@ /* name: GetAll :many */ SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; diff --git a/internal/endtoend/testdata/select_star/postgresql/go/db.go b/internal/endtoend/testdata/select_star/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_star/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_star/postgresql/go/models.go b/internal/endtoend/testdata/select_star/postgresql/go/models.go deleted file mode 100644 index 4c02540e98..0000000000 --- a/internal/endtoend/testdata/select_star/postgresql/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type User struct { - ID int32 - FirstName string - LastName sql.NullString - Age int32 -} diff --git a/internal/endtoend/testdata/select_star/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/go/query.sql.go deleted file mode 100644 index 062f587b58..0000000000 --- a/internal/endtoend/testdata/select_star/postgresql/go/query.sql.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const getAll = `-- name: GetAll :many -SELECT id, first_name, last_name, age FROM users -` - -func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) - 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.FirstName, - &i.LastName, - &i.Age, - ); 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_star/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..f5668bd976 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..3259c4c82c --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,63 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, getIDAll) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..0952880cac --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: GetAll :many +SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_star/postgresql/schema.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/schema.sql similarity index 100% rename from internal/endtoend/testdata/select_star/postgresql/schema.sql rename to internal/endtoend/testdata/select_star/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..f68e9f60b9 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + ID int32 + FirstName string + LastName pgtype.Text + Age int32 +} 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 new file mode 100644 index 0000000000..3259c4c82c --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,63 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.Query(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, getIDAll) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..0952880cac --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: GetAll :many +SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0fe1b79a5c --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_star/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/select_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f5668bd976 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int32 + FirstName string + LastName sql.NullString + Age int32 +} 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 new file mode 100644 index 0000000000..dd10b59022 --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,69 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAll = `-- name: GetAll :many +SELECT id, first_name, last_name, age FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, getAll) + 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.FirstName, + &i.LastName, + &i.Age, + ); 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 getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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/select_star/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_star/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..0952880cac --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetAll :many +SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_star/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0fe1b79a5c --- /dev/null +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL +); diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_star/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/select_star/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/select_star/sqlite/go/db.go b/internal/endtoend/testdata/select_star/sqlite/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/models.go b/internal/endtoend/testdata/select_star/sqlite/go/models.go index 4c02540e98..dfbb4f7e0b 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest @@ -7,8 +9,8 @@ import ( ) type User struct { - ID int32 + ID int64 FirstName string LastName sql.NullString - Age int32 + Age int64 } 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 062f587b58..2c899f8fa9 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -38,3 +40,30 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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/select_star/sqlite/query.sql b/internal/endtoend/testdata/select_star/sqlite/query.sql index 237b20193b..0952880cac 100644 --- a/internal/endtoend/testdata/select_star/sqlite/query.sql +++ b/internal/endtoend/testdata/select_star/sqlite/query.sql @@ -1,2 +1,5 @@ -- name: GetAll :many SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_star/sqlite/sqlc.json b/internal/endtoend/testdata/select_star/sqlite/sqlc.json index ed5394c1ff..55a79aa223 100644 --- a/internal/endtoend/testdata/select_star/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_star/sqlite/sqlc.json @@ -6,7 +6,7 @@ "path": "go", "schema": "schema.sql", "queries": "query.sql", - "engine": "_lemon" + "engine": "sqlite" } ] } diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_star_quoted/mysql/go/models.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go new file mode 100644 index 0000000000..653314bea2 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + Camelcase sql.NullString +} 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 new file mode 100644 index 0000000000..8dcc27892e --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAll = `-- name: GetAll :many +SELECT camelcase FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var camelcase sql.NullString + if err := rows.Scan(&camelcase); err != nil { + return nil, err + } + items = append(items, camelcase) + } + 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_star_quoted/mysql/query.sql b/internal/endtoend/testdata/select_star_quoted/mysql/query.sql new file mode 100644 index 0000000000..e2f85e2a9a --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/query.sql @@ -0,0 +1,2 @@ +/* name: GetAll :many */ +SELECT * FROM users; diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/schema.sql b/internal/endtoend/testdata/select_star_quoted/mysql/schema.sql new file mode 100644 index 0000000000..8adc3dd61c --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE users ( + `CamelCase` varchar(255) +) ENGINE=InnoDB; diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/sqlc.json b/internal/endtoend/testdata/select_star_quoted/mysql/sqlc.json new file mode 100644 index 0000000000..a9e7b055a4 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "mysql" + } + ] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_star_quoted/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..aefe0b5dcd --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + CamelCase sql.NullString +} 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 new file mode 100644 index 0000000000..14fea519b9 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAll = `-- name: GetAll :many +SELECT "CamelCase" FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var CamelCase sql.NullString + if err := rows.Scan(&CamelCase); err != nil { + return nil, err + } + items = append(items, CamelCase) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d701c419da --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE users ( + "CamelCase" varchar(255) +); diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_star_quoted/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..a77b945927 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + CamelCase pgtype.Text +} 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 new file mode 100644 index 0000000000..f67bea811f --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAll = `-- name: GetAll :many +SELECT "CamelCase" FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var CamelCase pgtype.Text + if err := rows.Scan(&CamelCase); err != nil { + return nil, err + } + items = append(items, CamelCase) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d701c419da --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE users ( + "CamelCase" varchar(255) +); diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/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/select_star_quoted/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_star_quoted/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..aefe0b5dcd --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + CamelCase sql.NullString +} 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 new file mode 100644 index 0000000000..4023181a3a --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const getAll = `-- name: GetAll :many +SELECT "CamelCase" FROM users +` + +func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var CamelCase sql.NullString + if err := rows.Scan(&CamelCase); err != nil { + return nil, err + } + items = append(items, CamelCase) + } + 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_star_quoted/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..237b20193b --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetAll :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d701c419da --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE users ( + "CamelCase" varchar(255) +); diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/select_star_quoted/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/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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..f72a5da135 --- /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.30.0 + +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..1e25e8a86a --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..9ce044a0b0 --- /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.30.0 + +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..9510db3a68 --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..a7e45a1d4e --- /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.30.0 + +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..6e7e214b72 --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..a7e45a1d4e --- /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.30.0 + +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..6e7e214b72 --- /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.30.0 +// 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..cd99e4407b --- /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.30.0 + +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..6e7e214b72 --- /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.30.0 +// 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..50dff66166 --- /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.30.0 + +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..cef462dc6f --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/select_text_array/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_text_array/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_text_array/go/models.go b/internal/endtoend/testdata/select_text_array/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/select_text_array/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/go/query.sql.go b/internal/endtoend/testdata/select_text_array/go/query.sql.go deleted file mode 100644 index de74e5fa28..0000000000 --- a/internal/endtoend/testdata/select_text_array/go/query.sql.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/lib/pq" -) - -const selectTextArray = `-- name: SelectTextArray :many -SELECT $1::TEXT[] -` - -func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, selectTextArray, pq.Array(dollar_1)) - if err != nil { - return nil, err - } - defer rows.Close() - var items [][]string - for rows.Next() { - var column_1 []string - if err := rows.Scan(pq.Array(&column_1)); err != nil { - return nil, err - } - items = append(items, column_1) - } - 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_text_array/pgx/v4/go/db.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_text_array/pgx/v4/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..1c26b31f26 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTextArray = `-- name: SelectTextArray :many +SELECT $1::TEXT[] +` + +func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { + rows, err := q.db.Query(ctx, selectTextArray, dollar_1) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var column_1 []string + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_text_array/query.sql b/internal/endtoend/testdata/select_text_array/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/select_text_array/query.sql rename to internal/endtoend/testdata/select_text_array/pgx/v4/query.sql diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/schema.sql b/internal/endtoend/testdata/select_text_array/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_text_array/pgx/v5/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..1c26b31f26 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTextArray = `-- name: SelectTextArray :many +SELECT $1::TEXT[] +` + +func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { + rows, err := q.db.Query(ctx, selectTextArray, dollar_1) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var column_1 []string + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/query.sql b/internal/endtoend/testdata/select_text_array/pgx/v5/query.sql new file mode 100644 index 0000000000..2bf44b953c --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SelectTextArray :many +SELECT $1::TEXT[]; diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/schema.sql b/internal/endtoend/testdata/select_text_array/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/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/select_text_array/sqlc.json b/internal/endtoend/testdata/select_text_array/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_text_array/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/db.go b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_text_array/stdlib/go/models.go b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..eaf08b1bc5 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/lib/pq" +) + +const selectTextArray = `-- name: SelectTextArray :many +SELECT $1::TEXT[] +` + +func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { + rows, err := q.db.QueryContext(ctx, selectTextArray, pq.Array(dollar_1)) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]string + for rows.Next() { + var column_1 []string + if err := rows.Scan(pq.Array(&column_1)); err != nil { + return nil, err + } + items = append(items, column_1) + } + 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_text_array/stdlib/query.sql b/internal/endtoend/testdata/select_text_array/stdlib/query.sql new file mode 100644 index 0000000000..2bf44b953c --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SelectTextArray :many +SELECT $1::TEXT[]; diff --git a/internal/endtoend/testdata/select_text_array/stdlib/schema.sql b/internal/endtoend/testdata/select_text_array/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json b/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_union/mysql/go/db.go b/internal/endtoend/testdata/select_union/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/db.go +++ b/internal/endtoend/testdata/select_union/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/mysql/go/models.go b/internal/endtoend/testdata/select_union/mysql/go/models.go index ce7117644a..41f892cc4a 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/models.go +++ b/internal/endtoend/testdata/select_union/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest @@ -6,6 +8,11 @@ import ( "database/sql" ) +type Bar struct { + A sql.NullString + B sql.NullString +} + type Foo struct { A sql.NullString B sql.NullString 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 99e77d6795..ce48f7b961 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -93,3 +95,96 @@ 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT ? OFFSET ? +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/mysql/query.sql b/internal/endtoend/testdata/select_union/mysql/query.sql index 80dd8cc4f2..c706921bc3 100644 --- a/internal/endtoend/testdata/select_union/mysql/query.sql +++ b/internal/endtoend/testdata/select_union/mysql/query.sql @@ -1,10 +1,14 @@ -CREATE TABLE foo (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION SELECT * FROM foo; +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT ? OFFSET ?; + -- name: SelectExcept :many SELECT * FROM foo EXCEPT @@ -14,3 +18,13 @@ SELECT * FROM foo; SELECT * FROM foo INTERSECT SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union/mysql/schema.sql b/internal/endtoend/testdata/select_union/mysql/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/mysql/sqlc.json b/internal/endtoend/testdata/select_union/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/select_union/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_union/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/select_union/postgres/go/db.go b/internal/endtoend/testdata/select_union/postgres/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/select_union/postgres/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_union/postgres/go/models.go b/internal/endtoend/testdata/select_union/postgres/go/models.go deleted file mode 100644 index ce7117644a..0000000000 --- a/internal/endtoend/testdata/select_union/postgres/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/select_union/postgres/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/go/query.sql.go deleted file mode 100644 index 99e77d6795..0000000000 --- a/internal/endtoend/testdata/select_union/postgres/go/query.sql.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectExcept = `-- name: SelectExcept :many -SELECT a, b FROM foo -EXCEPT -SELECT a, b FROM foo -` - -func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectExcept) - 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 selectIntersect = `-- name: SelectIntersect :many -SELECT a, b FROM foo -INTERSECT -SELECT a, b FROM foo -` - -func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectIntersect) - 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 selectUnion = `-- name: SelectUnion :many -SELECT a, b FROM foo -UNION -SELECT a, b FROM foo -` - -func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnion) - 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 -} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json b/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_union/postgres/pgx/v4/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go new file mode 100644 index 0000000000..41f892cc4a --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + B sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..253f792c55 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go @@ -0,0 +1,172 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectExcept = `-- name: SelectExcept :many +SELECT a, b FROM foo +EXCEPT +SELECT a, b FROM foo +` + +func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectExcept) + 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 selectIntersect = `-- name: SelectIntersect :many +SELECT a, b FROM foo +INTERSECT +SELECT a, b FROM foo +` + +func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectIntersect) + 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 selectUnion = `-- name: SelectUnion :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnion) + 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 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql new file mode 100644 index 0000000000..f44f1fd2af --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql @@ -0,0 +1,30 @@ +-- name: SelectUnion :many +SELECT * FROM foo +UNION +SELECT * FROM foo; + +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + +-- name: SelectExcept :many +SELECT * FROM foo +EXCEPT +SELECT * FROM foo; + +-- name: SelectIntersect :many +SELECT * FROM foo +INTERSECT +SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json b/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_union/postgres/pgx/v5/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go new file mode 100644 index 0000000000..4d48e880e1 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + A pgtype.Text + B pgtype.Text +} + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..253f792c55 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go @@ -0,0 +1,172 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectExcept = `-- name: SelectExcept :many +SELECT a, b FROM foo +EXCEPT +SELECT a, b FROM foo +` + +func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectExcept) + 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 selectIntersect = `-- name: SelectIntersect :many +SELECT a, b FROM foo +INTERSECT +SELECT a, b FROM foo +` + +func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectIntersect) + 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 selectUnion = `-- name: SelectUnion :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnion) + 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 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql new file mode 100644 index 0000000000..f44f1fd2af --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql @@ -0,0 +1,30 @@ +-- name: SelectUnion :many +SELECT * FROM foo +UNION +SELECT * FROM foo; + +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + +-- name: SelectExcept :many +SELECT * FROM foo +EXCEPT +SELECT * FROM foo; + +-- name: SelectIntersect :many +SELECT * FROM foo +INTERSECT +SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/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/select_union/postgres/query.sql b/internal/endtoend/testdata/select_union/postgres/query.sql deleted file mode 100644 index 80dd8cc4f2..0000000000 --- a/internal/endtoend/testdata/select_union/postgres/query.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE foo (a text, b text); - --- name: SelectUnion :many -SELECT * FROM foo -UNION -SELECT * FROM foo; - --- name: SelectExcept :many -SELECT * FROM foo -EXCEPT -SELECT * FROM foo; - --- name: SelectIntersect :many -SELECT * FROM foo -INTERSECT -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/sqlc.json b/internal/endtoend/testdata/select_union/postgres/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_union/postgres/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json b/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_union/postgres/stdlib/go/models.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go new file mode 100644 index 0000000000..41f892cc4a --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + B sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..827ee31c18 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go @@ -0,0 +1,190 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectExcept = `-- name: SelectExcept :many +SELECT a, b FROM foo +EXCEPT +SELECT a, b FROM foo +` + +func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectExcept) + 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 selectIntersect = `-- name: SelectIntersect :many +SELECT a, b FROM foo +INTERSECT +SELECT a, b FROM foo +` + +func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectIntersect) + 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 selectUnion = `-- name: SelectUnion :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnion) + 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 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql new file mode 100644 index 0000000000..f44f1fd2af --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql @@ -0,0 +1,30 @@ +-- name: SelectUnion :many +SELECT * FROM foo +UNION +SELECT * FROM foo; + +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + +-- name: SelectExcept :many +SELECT * FROM foo +EXCEPT +SELECT * FROM foo; + +-- name: SelectIntersect :many +SELECT * FROM foo +INTERSECT +SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json b/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/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/select_union/sqlite/go/db.go b/internal/endtoend/testdata/select_union/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_union/sqlite/go/models.go b/internal/endtoend/testdata/select_union/sqlite/go/models.go new file mode 100644 index 0000000000..41f892cc4a --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + B sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go new file mode 100644 index 0000000000..863e55fa04 --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go @@ -0,0 +1,161 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectExcept = `-- name: SelectExcept :many +SELECT a, b FROM foo +EXCEPT +SELECT a, b FROM foo +` + +func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectExcept) + 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 selectIntersect = `-- name: SelectIntersect :many +SELECT a, b FROM foo +INTERSECT +SELECT a, b FROM foo +` + +func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectIntersect) + 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 selectUnion = `-- name: SelectUnion :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnion) + 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT ? OFFSET ? +` + +type SelectUnionWithLimitParams struct { + Limit int64 + Offset int64 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/sqlite/query.sql b/internal/endtoend/testdata/select_union/sqlite/query.sql new file mode 100644 index 0000000000..67d28d1824 --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/query.sql @@ -0,0 +1,25 @@ +-- name: SelectUnion :many +SELECT * FROM foo +UNION +SELECT * FROM foo; + +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT ? OFFSET ?; + +-- name: SelectExcept :many +SELECT * FROM foo +EXCEPT +SELECT * FROM foo; + +-- name: SelectIntersect :many +SELECT * FROM foo +INTERSECT +SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union/sqlite/schema.sql b/internal/endtoend/testdata/select_union/sqlite/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/sqlite/sqlc.json b/internal/endtoend/testdata/select_union/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/select_union/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/select_union_subquery/issue.md b/internal/endtoend/testdata/select_union_subquery/issue.md new file mode 100644 index 0000000000..138725aa27 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2260 diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_union_subquery/mysql/go/models.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go new file mode 100644 index 0000000000..ec1cb8d670 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..affaa7cdd1 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testSubqueryUnion = `-- name: TestSubqueryUnion :many +SELECT tmp.id, tmp.name, tmp.bio FROM ( + SELECT id, name, bio FROM authors + UNION + SELECT id, name, bio FROM authors +) tmp LIMIT 5 +` + +func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, testSubqueryUnion) + 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/select_union_subquery/mysql/query.sql b/internal/endtoend/testdata/select_union_subquery/mysql/query.sql new file mode 100644 index 0000000000..6eaabdcf49 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/query.sql @@ -0,0 +1,6 @@ +-- name: TestSubqueryUnion :many +SELECT tmp.* FROM ( + SELECT * FROM authors + UNION + SELECT * FROM authors +) tmp LIMIT 5; diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql b/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql new file mode 100644 index 0000000000..7793468f4e --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/sqlc.yaml b/internal/endtoend/testdata/select_union_subquery/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/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_union_subquery/postgresql/go/db.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_union_subquery/postgresql/go/models.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go new file mode 100644 index 0000000000..0b43a03de8 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int32 + Name string + Bio pgtype.Text +} 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 new file mode 100644 index 0000000000..f960e1cbd9 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testSubqueryUnion = `-- name: TestSubqueryUnion :many +SELECT tmp.id, tmp.name, tmp.bio FROM ( + SELECT id, name, bio FROM authors + UNION + SELECT id, name, bio FROM authors +) tmp LIMIT 5 +` + +func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, testSubqueryUnion) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql b/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql new file mode 100644 index 0000000000..6eaabdcf49 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql @@ -0,0 +1,6 @@ +-- name: TestSubqueryUnion :many +SELECT tmp.* FROM ( + SELECT * FROM authors + UNION + SELECT * FROM authors +) tmp LIMIT 5; diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql b/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql new file mode 100644 index 0000000000..7793468f4e --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/sqlc.yaml b/internal/endtoend/testdata/select_union_subquery/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/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/selectstatic/mysql/go/db.go b/internal/endtoend/testdata/selectstatic/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/selectstatic/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/selectstatic/mysql/go/models.go b/internal/endtoend/testdata/selectstatic/mysql/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/selectstatic/mysql/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go new file mode 100644 index 0000000000..c6cfed9b63 --- /dev/null +++ b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectStatic = `-- name: SelectStatic :one +SELECT 'a', 'b' AS b, 1 AS num, true AS truefield, 1.0 AS floater +` + +type SelectStaticRow struct { + Column1 string + B string + Num int32 + Truefield int32 + Floater float64 +} + +func (q *Queries) SelectStatic(ctx context.Context) (SelectStaticRow, error) { + row := q.db.QueryRowContext(ctx, selectStatic) + var i SelectStaticRow + err := row.Scan( + &i.Column1, + &i.B, + &i.Num, + &i.Truefield, + &i.Floater, + ) + return i, err +} diff --git a/internal/endtoend/testdata/selectstatic/mysql/query.sql b/internal/endtoend/testdata/selectstatic/mysql/query.sql new file mode 100644 index 0000000000..3a184df07c --- /dev/null +++ b/internal/endtoend/testdata/selectstatic/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: SelectStatic :one +SELECT 'a', 'b' AS b, 1 AS num, true AS truefield, 1.0 AS floater diff --git a/internal/endtoend/testdata/selectstatic/mysql/schema.sql b/internal/endtoend/testdata/selectstatic/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/selectstatic/mysql/sqlc.json b/internal/endtoend/testdata/selectstatic/mysql/sqlc.json new file mode 100644 index 0000000000..b474940a09 --- /dev/null +++ b/internal/endtoend/testdata/selectstatic/mysql/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/db.go b/internal/endtoend/testdata/show_warnings/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/show_warnings/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/show_warnings/mysql/go/models.go b/internal/endtoend/testdata/show_warnings/mysql/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/show_warnings/mysql/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go new file mode 100644 index 0000000000..00482e19f3 --- /dev/null +++ b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const showWarnings = `-- name: ShowWarnings :many +SHOW WARNINGS +` + +type ShowWarningsRow struct { + Level string + Code int32 + Message string +} + +func (q *Queries) ShowWarnings(ctx context.Context) ([]ShowWarningsRow, error) { + rows, err := q.db.QueryContext(ctx, showWarnings) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ShowWarningsRow + for rows.Next() { + var i ShowWarningsRow + if err := rows.Scan(&i.Level, &i.Code, &i.Message); 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/show_warnings/mysql/query.sql b/internal/endtoend/testdata/show_warnings/mysql/query.sql new file mode 100644 index 0000000000..fa67110549 --- /dev/null +++ b/internal/endtoend/testdata/show_warnings/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: ShowWarnings :many +SHOW WARNINGS; diff --git a/internal/endtoend/testdata/show_warnings/mysql/schema.sql b/internal/endtoend/testdata/show_warnings/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/show_warnings/mysql/sqlc.json b/internal/endtoend/testdata/show_warnings/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/show_warnings/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/single_param_conflict/mysql/go/db.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/single_param_conflict/mysql/go/models.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go new file mode 100644 index 0000000000..76309f48ac --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type User struct { + Sub string +} 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 new file mode 100644 index 0000000000..e3ba139207 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorByID = `-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1 +` + +func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthorByID, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthorIDByID = `-- name: GetAuthorIDByID :one +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 +} + +const getUser = `-- name: GetUser :one +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 +} diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/query.sql b/internal/endtoend/testdata/single_param_conflict/mysql/query.sql new file mode 100644 index 0000000000..23b454dac0 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/query.sql @@ -0,0 +1,17 @@ +-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = ? +LIMIT 1; + +-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1; + +-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = ? +LIMIT 1; diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql new file mode 100644 index 0000000000..2f49d219f3 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub VARCHAR(10) PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json b/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json new file mode 100644 index 0000000000..c7c930dbee --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/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/single_param_conflict/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/single_param_conflict/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..e42f868a67 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type User struct { + Sub uuid.UUID +} 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 new file mode 100644 index 0000000000..1912659d8b --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const getAuthorByID = `-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1 +` + +func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRow(ctx, getAuthorByID, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthorIDByID = `-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +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 +} + +const getUser = `-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +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 +} + +const setDefaultName = `-- name: SetDefaultName :one + +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +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 +} diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ca3fc5c6a4 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql @@ -0,0 +1,25 @@ +-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +LIMIT 1; + +-- https://github.com/sqlc-dev/sqlc/issues/1235 + +-- name: SetDefaultName :one +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..827c74c0d1 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "engine": "postgresql", + "sql_package": "pgx/v4", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/single_param_conflict/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..29daab34db --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type User struct { + Sub pgtype.UUID +} 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 new file mode 100644 index 0000000000..daa903d8c2 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAuthorByID = `-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1 +` + +func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRow(ctx, getAuthorByID, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthorIDByID = `-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +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 +} + +const getUser = `-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +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 +} + +const setDefaultName = `-- name: SetDefaultName :one + +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +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 +} diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ca3fc5c6a4 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql @@ -0,0 +1,25 @@ +-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +LIMIT 1; + +-- https://github.com/sqlc-dev/sqlc/issues/1235 + +-- name: SetDefaultName :one +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..fbae807cad --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "engine": "postgresql", + "sql_package": "pgx/v5", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/single_param_conflict/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..e42f868a67 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type User struct { + Sub uuid.UUID +} 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 new file mode 100644 index 0000000000..0b99078536 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const getAuthorByID = `-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1 +` + +func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthorByID, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthorIDByID = `-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +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 +} + +const getUser = `-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +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 +} + +const setDefaultName = `-- name: SetDefaultName :one + +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +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 +} diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ca3fc5c6a4 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql @@ -0,0 +1,25 @@ +-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = $1 +LIMIT 1; + +-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = $1 +LIMIT 1; + +-- https://github.com/sqlc-dev/sqlc/issues/1235 + +-- name: SetDefaultName :one +UPDATE authors +SET name = 'Default Name' +WHERE id = $1 +RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..1a9272b06c --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/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/single_param_conflict/sqlite/go/db.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/single_param_conflict/sqlite/go/models.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go new file mode 100644 index 0000000000..76309f48ac --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type User struct { + Sub string +} 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 new file mode 100644 index 0000000000..e3ba139207 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorByID = `-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1 +` + +func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthorByID, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const getAuthorIDByID = `-- name: GetAuthorIDByID :one +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 +} + +const getUser = `-- name: GetUser :one +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 +} diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql new file mode 100644 index 0000000000..23b454dac0 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql @@ -0,0 +1,17 @@ +-- name: GetAuthorIDByID :one +SELECT id +FROM authors +WHERE id = ? +LIMIT 1; + +-- name: GetAuthorByID :one +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1; + +-- name: GetUser :one +SELECT sub +FROM users +WHERE sub = ? +LIMIT 1; diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql b/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql new file mode 100644 index 0000000000..376329e101 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub TEXT PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json b/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/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/sql_syntax_calling_funcs/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/sql_syntax_calling_funcs/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/go/models.go deleted file mode 100644 index 4e2b892600..0000000000 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/go/models.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/go/query.sql.go deleted file mode 100644 index 2cc5285ddd..0000000000 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/go/query.sql.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const mixedNotation = `-- name: MixedNotation :one -SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) -` - -func (q *Queries) MixedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, mixedNotation) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} - -const namedAnyOrder = `-- name: NamedAnyOrder :one -SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) -` - -func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedAnyOrder) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} - -const namedNotation = `-- name: NamedNotation :one -SELECT concat_lower_or_upper(a => 'Hello', b => 'World') -` - -func (q *Queries) NamedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedNotation) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} - -const namedOtherOrder = `-- name: NamedOtherOrder :one -SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') -` - -func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedOtherOrder) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} - -const positionalNoDefaault = `-- name: PositionalNoDefaault :one -SELECT concat_lower_or_upper('Hello', 'World') -` - -func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, positionalNoDefaault) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} - -const positionalNotation = `-- name: PositionalNotation :one -SELECT concat_lower_or_upper('Hello', 'World', true) -` - -func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, positionalNotation) - var concat_lower_or_upper string - err := row.Scan(&concat_lower_or_upper) - return concat_lower_or_upper, err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..e0766794c9 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const mixedNotation = `-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) +` + +func (q *Queries) MixedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, mixedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedAnyOrder = `-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) +` + +func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedAnyOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedNotation = `-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World') +` + +func (q *Queries) NamedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedOtherOrder = `-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') +` + +func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedOtherOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNoDefaault = `-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World') +` + +func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, positionalNoDefaault) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNotation = `-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true) +` + +func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, positionalNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c1fc6ea341 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql @@ -0,0 +1,17 @@ +-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true); + +-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World'); + +-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World'); + +-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true); + +-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World'); + +-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..e0766794c9 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const mixedNotation = `-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) +` + +func (q *Queries) MixedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, mixedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedAnyOrder = `-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) +` + +func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedAnyOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedNotation = `-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World') +` + +func (q *Queries) NamedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedOtherOrder = `-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') +` + +func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, namedOtherOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNoDefaault = `-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World') +` + +func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, positionalNoDefaault) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNotation = `-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true) +` + +func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, positionalNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c1fc6ea341 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql @@ -0,0 +1,17 @@ +-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true); + +-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World'); + +-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World'); + +-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true); + +-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World'); + +-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/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/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest 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 new file mode 100644 index 0000000000..76911da54c --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const mixedNotation = `-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) +` + +func (q *Queries) MixedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, mixedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedAnyOrder = `-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) +` + +func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, namedAnyOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedNotation = `-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World') +` + +func (q *Queries) NamedNotation(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, namedNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const namedOtherOrder = `-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') +` + +func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, namedOtherOrder) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNoDefaault = `-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World') +` + +func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, positionalNoDefaault) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} + +const positionalNotation = `-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true) +` + +func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, positionalNotation) + var concat_lower_or_upper string + err := row.Scan(&concat_lower_or_upper) + return concat_lower_or_upper, err +} diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c1fc6ea341 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql @@ -0,0 +1,17 @@ +-- name: PositionalNotation :one +SELECT concat_lower_or_upper('Hello', 'World', true); + +-- name: PositionalNoDefaault :one +SELECT concat_lower_or_upper('Hello', 'World'); + +-- name: NamedNotation :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World'); + +-- name: NamedAnyOrder :one +SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true); + +-- name: NamedOtherOrder :one +SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World'); + +-- name: MixedNotation :one +SELECT concat_lower_or_upper('Hello', 'World', uppercase => true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/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/sql_syntax_calling_funcs/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/query.sql deleted file mode 100644 index 59a2c35138..0000000000 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/query.sql +++ /dev/null @@ -1,29 +0,0 @@ --- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html -CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) -RETURNS text -AS -$$ - SELECT CASE - WHEN $3 THEN UPPER($1 || ' ' || $2) - ELSE LOWER($1 || ' ' || $2) - END; -$$ -LANGUAGE SQL IMMUTABLE STRICT; - --- name: PositionalNotation :one -SELECT concat_lower_or_upper('Hello', 'World', true); - --- name: PositionalNoDefaault :one -SELECT concat_lower_or_upper('Hello', 'World'); - --- name: NamedNotation :one -SELECT concat_lower_or_upper(a => 'Hello', b => 'World'); - --- name: NamedAnyOrder :one -SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true); - --- name: NamedOtherOrder :one -SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World'); - --- name: MixedNotation :one -SELECT concat_lower_or_upper('Hello', 'World', uppercase => true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go index d21739e2dd..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 d44613d482..ae033111a2 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -7,6 +9,38 @@ import ( "context" ) +const complicated = `-- name: Complicated :many +WITH names AS (SELECT name from foo WHERE foo.name = ?) +SELECT name FROM names WHERE name IN (SELECT name FROM foo WHERE foo.name = ?) +` + +type ComplicatedParams struct { + Slug string +} + +func (q *Queries) Complicated(ctx context.Context, arg ComplicatedParams) ([]string, error) { + rows, err := q.db.QueryContext(ctx, complicated, arg.Slug, arg.Slug) + 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 funcParamIdent = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ? ` diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/query.sql b/internal/endtoend/testdata/sqlc_arg/mysql/query.sql index a8a16f7de9..15cb7001ca 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/mysql/query.sql @@ -1,7 +1,9 @@ -CREATE TABLE foo (name text not null); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug); /* name: FuncParamString :many */ SELECT name FROM foo WHERE name = sqlc.arg('slug'); + +/* name: Complicated :many */ +WITH names AS (SELECT name from foo WHERE foo.name = sqlc.arg('slug')) +SELECT name FROM names WHERE name IN (SELECT name FROM foo WHERE foo.name = sqlc.arg('slug')); diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql b/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/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/sqlc_arg/postgresql/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/sqlc_arg/postgresql/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/go/models.go deleted file mode 100644 index d21739e2dd..0000000000 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Name string -} diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/go/query.sql.go deleted file mode 100644 index 31ea3bf12b..0000000000 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/go/query.sql.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const funcParamIdent = `-- name: FuncParamIdent :many -SELECT name FROM foo WHERE name = $1 -` - -func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) - 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 funcParamString = `-- name: FuncParamString :many -SELECT name FROM foo WHERE name = $1 -` - -func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamString, slug) - 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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/sqlc_arg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..d870bb7cde --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1329a6e015 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamIdent, slug) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamString, slug) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..2dfaa9cd5c --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = sqlc.arg(slug); + +-- name: FuncParamString :many +SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/sqlc_arg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..d870bb7cde --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1329a6e015 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamIdent, slug) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamString, slug) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..2dfaa9cd5c --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = sqlc.arg(slug); + +-- name: FuncParamString :many +SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/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/sqlc_arg/postgresql/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/query.sql deleted file mode 100644 index 9a8e98e223..0000000000 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE foo (name text not null); - --- name: FuncParamIdent :many -SELECT name FROM foo WHERE name = sqlc.arg(slug); - --- name: FuncParamString :many -SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_arg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..d870bb7cde --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..f7b36b5389 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) + 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 funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo WHERE name = $1 +` + +func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParamString, slug) + 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 +} diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..2dfaa9cd5c --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = sqlc.arg(slug); + +-- name: FuncParamString :many +SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/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/sqlc_arg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_arg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go new file mode 100644 index 0000000000..d870bb7cde --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..1ed076d63e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = ?1 +` + +func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) + 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 funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo WHERE name = ?1 +` + +func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, funcParamString, slug) + 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 +} diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql new file mode 100644 index 0000000000..b9a01edbd9 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql @@ -0,0 +1,5 @@ +/* name: FuncParamIdent :many */ +SELECT name FROM foo WHERE name = sqlc.arg(slug); + +/* name: FuncParamString :many */ +SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/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/sqlc_arg_invalid/mysql/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql index ae901531d2..80d171b2c2 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql @@ -1,14 +1,12 @@ -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); -- name: TooManyArgs :one select id, first_name from users where id = sqlc.arg('foo', 'bar'); +-- name: TooFewArgs :one +select id, first_name from users where id = sqlc.arg(); + -- name: InvalidArgFunc :one select id, first_name from users where id = sqlc.arg(sqlc.arg(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 ebf473a70c..73966182fb 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt @@ -1,5 +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 parameter to sqlc.arg to be string or reference; got *ast.FuncCall -query.sql:16:1: query mixes positional parameters ($1) and named parameters (sqlc.arg or @arg) +query.sql:1:1: 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 diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql index 6d3044085c..397850187a 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql @@ -1,14 +1,12 @@ -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); -- name: TooManyArgs :one select id, first_name from users where id = sqlc.arg('foo', 'bar'); +-- name: TooFewArgs :one +select id, first_name from users where id = sqlc.arg(); + -- name: InvalidArgFunc :one select id, first_name from users where id = sqlc.arg(sqlc.arg(target_id)); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql new file mode 100644 index 0000000000..0a380b5f9d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE users ( + id serial, + first_name text not null +); \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json index 696ed223db..f5a835c5a6 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql" } diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt index ebf473a70c..8dbea1f949 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt @@ -1,5 +1,7 @@ # 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 parameter to sqlc.arg to be string or reference; got *ast.FuncCall -query.sql:16:1: query mixes positional parameters ($1) and named parameters (sqlc.arg or @arg) +query.sql:1:1: 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 + diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/query.sql new file mode 100644 index 0000000000..3e46d7204b --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/query.sql @@ -0,0 +1,19 @@ +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); + +-- name: TooManyArgs :one +select id, first_name from users where id = sqlc.arg('foo', 'bar'); + +-- name: TooFewArgs :one +select id, first_name from users where id = sqlc.arg(); + +-- name: InvalidArgFunc :one +select id, first_name from users where id = sqlc.arg(sqlc.arg(target_id)); + +-- name: InvalidArgPlaceholder :one +select id, first_name from users where id = sqlc.arg(?); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/sqlc.json new file mode 100644 index 0000000000..8c3dbae444 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "query.sql", + "queries": "query.sql", + "engine": "sqlite" + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt new file mode 100644 index 0000000000..be38c8b505 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt @@ -0,0 +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 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_embed/mysql/go/models.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go new file mode 100644 index 0000000000..ca7ee22488 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type BazUser struct { + ID int32 + Name string +} + +type Post struct { + ID int32 + UserID int32 +} + +type User struct { + ID int32 + Name string + Age sql.NullInt32 +} diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go new file mode 100644 index 0000000000..09f901c7b3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go @@ -0,0 +1,203 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const duplicate = `-- name: Duplicate :one +SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users +` + +type DuplicateRow struct { + User User + User_2 User +} + +func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { + row := q.db.QueryRowContext(ctx, duplicate) + var i DuplicateRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.User_2.ID, + &i.User_2.Name, + &i.User_2.Age, + ) + return i, err +} + +const join = `-- name: Join :one +SELECT users.id, users.name, users.age, posts.id, posts.user_id FROM posts +INNER JOIN users ON posts.user_id = users.id +` + +type JoinRow struct { + User User + Post Post +} + +func (q *Queries) Join(ctx context.Context) (JoinRow, error) { + row := q.db.QueryRowContext(ctx, join) + var i JoinRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.Post.ID, + &i.Post.UserID, + ) + return i, err +} + +const only = `-- name: Only :one +SELECT users.id, users.name, users.age FROM users +` + +type OnlyRow struct { + User User +} + +func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { + row := q.db.QueryRowContext(ctx, only) + var i OnlyRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAlias = `-- name: WithAlias :one +SELECT u.id, u.name, u.age FROM users u +` + +type WithAliasRow struct { + User User +} + +func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { + row := q.db.QueryRowContext(ctx, withAlias) + var i WithAliasRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAsterisk = `-- name: WithAsterisk :one +SELECT users.id, users.name, users.age, id, name, age FROM users +` + +type WithAsteriskRow struct { + User User + ID int32 + Name string + Age sql.NullInt32 +} + +func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { + row := q.db.QueryRowContext(ctx, withAsterisk) + var i WithAsteriskRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.ID, + &i.Name, + &i.Age, + ) + return i, err +} + +const withCrossSchema = `-- name: WithCrossSchema :many +SELECT users.id, users.name, users.age, bu.id, bu.name FROM users +INNER JOIN baz.users bu ON users.id = bu.id +` + +type WithCrossSchemaRow struct { + User User + BazUser BazUser +} + +func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { + rows, err := q.db.QueryContext(ctx, withCrossSchema) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithCrossSchemaRow + for rows.Next() { + var i WithCrossSchemaRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.BazUser.ID, + &i.BazUser.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 withSchema = `-- name: WithSchema :one +SELECT bu.id, bu.name FROM baz.users bu +` + +type WithSchemaRow struct { + BazUser BazUser +} + +func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { + row := q.db.QueryRowContext(ctx, withSchema) + var i WithSchemaRow + err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) + return i, err +} + +const withSubquery = `-- name: WithSubquery :many +SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users +` + +type WithSubqueryRow struct { + User User + TotalCount int64 +} + +func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { + rows, err := q.db.QueryContext(ctx, withSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithSubqueryRow + for rows.Next() { + var i WithSubqueryRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.TotalCount, + ); 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/sqlc_embed/mysql/query.sql b/internal/endtoend/testdata/sqlc_embed/mysql/query.sql new file mode 100644 index 0000000000..7822145508 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/query.sql @@ -0,0 +1,25 @@ +-- name: Only :one +SELECT sqlc.embed(users) FROM users; + +-- name: WithAlias :one +SELECT sqlc.embed(u) FROM users u; + +-- name: WithSubquery :many +SELECT sqlc.embed(users), (SELECT count(*) FROM users) AS total_count FROM users; + +-- name: WithAsterisk :one +SELECT sqlc.embed(users), * FROM users; + +-- name: Duplicate :one +SELECT sqlc.embed(users), sqlc.embed(users) FROM users; + +-- name: Join :one +SELECT sqlc.embed(users), sqlc.embed(posts) FROM posts +INNER JOIN users ON posts.user_id = users.id; + +-- name: WithSchema :one +SELECT sqlc.embed(bu) FROM baz.users bu; + +-- name: WithCrossSchema :many +SELECT sqlc.embed(users), sqlc.embed(bu) FROM users +INNER JOIN baz.users bu ON users.id = bu.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql b/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql new file mode 100644 index 0000000000..28751aa16e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql @@ -0,0 +1,19 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/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/sqlc_embed/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/sqlc_embed/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..ae771b23ab --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type BazUser struct { + ID int32 `db:"id" json:"id"` + Name string `db:"name" json:"name"` +} + +type Post struct { + ID int32 `db:"id" json:"id"` + UserID int32 `db:"user_id" json:"user_id"` +} + +type User struct { + ID int32 `db:"id" json:"id"` + Name string `db:"name" json:"name"` + Age sql.NullInt32 `db:"age" json:"age"` +} 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 new file mode 100644 index 0000000000..643d5d41d6 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go @@ -0,0 +1,197 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const duplicate = `-- name: Duplicate :one +SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users +` + +type DuplicateRow struct { + User User `db:"user" json:"user"` + User_2 User `db:"user_2" json:"user_2"` +} + +func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { + row := q.db.QueryRow(ctx, duplicate) + var i DuplicateRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.User_2.ID, + &i.User_2.Name, + &i.User_2.Age, + ) + return i, err +} + +const join = `-- name: Join :one +SELECT users.id, users.name, users.age, posts.id, posts.user_id FROM posts +INNER JOIN users ON posts.user_id = users.id +` + +type JoinRow struct { + User User `db:"user" json:"user"` + Post Post `db:"post" json:"post"` +} + +func (q *Queries) Join(ctx context.Context) (JoinRow, error) { + row := q.db.QueryRow(ctx, join) + var i JoinRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.Post.ID, + &i.Post.UserID, + ) + return i, err +} + +const only = `-- name: Only :one +SELECT users.id, users.name, users.age FROM users +` + +type OnlyRow struct { + User User `db:"user" json:"user"` +} + +func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { + row := q.db.QueryRow(ctx, only) + var i OnlyRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAlias = `-- name: WithAlias :one +SELECT u.id, u.name, u.age FROM users u +` + +type WithAliasRow struct { + User User `db:"user" json:"user"` +} + +func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { + row := q.db.QueryRow(ctx, withAlias) + var i WithAliasRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAsterisk = `-- name: WithAsterisk :one +SELECT users.id, users.name, users.age, id, name, age FROM users +` + +type WithAsteriskRow struct { + User User `db:"user" json:"user"` + ID int32 `db:"id" json:"id"` + Name string `db:"name" json:"name"` + Age sql.NullInt32 `db:"age" json:"age"` +} + +func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { + row := q.db.QueryRow(ctx, withAsterisk) + var i WithAsteriskRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.ID, + &i.Name, + &i.Age, + ) + return i, err +} + +const withCrossSchema = `-- name: WithCrossSchema :many +SELECT users.id, users.name, users.age, bu.id, bu.name FROM users +INNER JOIN baz.users bu ON users.id = bu.id +` + +type WithCrossSchemaRow struct { + User User `db:"user" json:"user"` + BazUser BazUser `db:"baz_user" json:"baz_user"` +} + +func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { + rows, err := q.db.Query(ctx, withCrossSchema) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithCrossSchemaRow + for rows.Next() { + var i WithCrossSchemaRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.BazUser.ID, + &i.BazUser.Name, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const withSchema = `-- name: WithSchema :one +SELECT bu.id, bu.name FROM baz.users bu +` + +type WithSchemaRow struct { + BazUser BazUser `db:"baz_user" json:"baz_user"` +} + +func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { + row := q.db.QueryRow(ctx, withSchema) + var i WithSchemaRow + err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) + return i, err +} + +const withSubquery = `-- name: WithSubquery :many +SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users +` + +type WithSubqueryRow struct { + User User `db:"user" json:"user"` + TotalCount int64 `db:"total_count" json:"total_count"` +} + +func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { + rows, err := q.db.Query(ctx, withSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithSubqueryRow + for rows.Next() { + var i WithSubqueryRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.TotalCount, + ); 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/sqlc_embed/postgresql/pgx/query.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql new file mode 100644 index 0000000000..7822145508 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql @@ -0,0 +1,25 @@ +-- name: Only :one +SELECT sqlc.embed(users) FROM users; + +-- name: WithAlias :one +SELECT sqlc.embed(u) FROM users u; + +-- name: WithSubquery :many +SELECT sqlc.embed(users), (SELECT count(*) FROM users) AS total_count FROM users; + +-- name: WithAsterisk :one +SELECT sqlc.embed(users), * FROM users; + +-- name: Duplicate :one +SELECT sqlc.embed(users), sqlc.embed(users) FROM users; + +-- name: Join :one +SELECT sqlc.embed(users), sqlc.embed(posts) FROM posts +INNER JOIN users ON posts.user_id = users.id; + +-- name: WithSchema :one +SELECT sqlc.embed(bu) FROM baz.users bu; + +-- name: WithCrossSchema :many +SELECT sqlc.embed(users), sqlc.embed(bu) FROM users +INNER JOIN baz.users bu ON users.id = bu.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..28751aa16e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql @@ -0,0 +1,19 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..c74e245180 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_json_tags": true, + "emit_db_tags": true + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_embed/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..401fe50193 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type BazUser struct { + ID int32 + Name string +} + +type Post struct { + ID int32 + UserID int32 + Likes []int32 +} + +type User struct { + ID int32 + Name string + Age sql.NullInt32 +} 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 new file mode 100644 index 0000000000..460f8fe490 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,206 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/lib/pq" +) + +const duplicate = `-- name: Duplicate :one +SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users +` + +type DuplicateRow struct { + User User + User_2 User +} + +func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { + row := q.db.QueryRowContext(ctx, duplicate) + var i DuplicateRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.User_2.ID, + &i.User_2.Name, + &i.User_2.Age, + ) + return i, err +} + +const join = `-- name: Join :one +SELECT users.id, users.name, users.age, posts.id, posts.user_id, posts.likes FROM posts +INNER JOIN users ON posts.user_id = users.id +` + +type JoinRow struct { + User User + Post Post +} + +func (q *Queries) Join(ctx context.Context) (JoinRow, error) { + row := q.db.QueryRowContext(ctx, join) + var i JoinRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.Post.ID, + &i.Post.UserID, + pq.Array(&i.Post.Likes), + ) + return i, err +} + +const only = `-- name: Only :one +SELECT users.id, users.name, users.age FROM users +` + +type OnlyRow struct { + User User +} + +func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { + row := q.db.QueryRowContext(ctx, only) + var i OnlyRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAlias = `-- name: WithAlias :one +SELECT u.id, u.name, u.age FROM users u +` + +type WithAliasRow struct { + User User +} + +func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { + row := q.db.QueryRowContext(ctx, withAlias) + var i WithAliasRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAsterisk = `-- name: WithAsterisk :one +SELECT users.id, users.name, users.age, id, name, age FROM users +` + +type WithAsteriskRow struct { + User User + ID int32 + Name string + Age sql.NullInt32 +} + +func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { + row := q.db.QueryRowContext(ctx, withAsterisk) + var i WithAsteriskRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.ID, + &i.Name, + &i.Age, + ) + return i, err +} + +const withCrossSchema = `-- name: WithCrossSchema :many +SELECT users.id, users.name, users.age, bu.id, bu.name FROM users +INNER JOIN baz.users bu ON users.id = bu.id +` + +type WithCrossSchemaRow struct { + User User + BazUser BazUser +} + +func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { + rows, err := q.db.QueryContext(ctx, withCrossSchema) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithCrossSchemaRow + for rows.Next() { + var i WithCrossSchemaRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.BazUser.ID, + &i.BazUser.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 withSchema = `-- name: WithSchema :one +SELECT bu.id, bu.name FROM baz.users bu +` + +type WithSchemaRow struct { + BazUser BazUser +} + +func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { + row := q.db.QueryRowContext(ctx, withSchema) + var i WithSchemaRow + err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) + return i, err +} + +const withSubquery = `-- name: WithSubquery :many +SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users +` + +type WithSubqueryRow struct { + User User + TotalCount int64 +} + +func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { + rows, err := q.db.QueryContext(ctx, withSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithSubqueryRow + for rows.Next() { + var i WithSubqueryRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.TotalCount, + ); 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/sqlc_embed/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..7822145508 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql @@ -0,0 +1,25 @@ +-- name: Only :one +SELECT sqlc.embed(users) FROM users; + +-- name: WithAlias :one +SELECT sqlc.embed(u) FROM users u; + +-- name: WithSubquery :many +SELECT sqlc.embed(users), (SELECT count(*) FROM users) AS total_count FROM users; + +-- name: WithAsterisk :one +SELECT sqlc.embed(users), * FROM users; + +-- name: Duplicate :one +SELECT sqlc.embed(users), sqlc.embed(users) FROM users; + +-- name: Join :one +SELECT sqlc.embed(users), sqlc.embed(posts) FROM posts +INNER JOIN users ON posts.user_id = users.id; + +-- name: WithSchema :one +SELECT sqlc.embed(bu) FROM baz.users bu; + +-- name: WithCrossSchema :many +SELECT sqlc.embed(users), sqlc.embed(bu) FROM users +INNER JOIN baz.users bu ON users.id = bu.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7a60bb1659 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql @@ -0,0 +1,20 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL, + likes integer[] NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/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/sqlc_embed/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_embed/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go new file mode 100644 index 0000000000..f261202cb1 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type BazUser struct { + ID int64 + Name string +} + +type Post struct { + ID int64 + UserID int64 +} + +type User struct { + ID int64 + Name string + Age sql.NullInt64 +} diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6b7b33ae28 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go @@ -0,0 +1,203 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const duplicate = `-- name: Duplicate :one +SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users +` + +type DuplicateRow struct { + User User + User_2 User +} + +func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { + row := q.db.QueryRowContext(ctx, duplicate) + var i DuplicateRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.User_2.ID, + &i.User_2.Name, + &i.User_2.Age, + ) + return i, err +} + +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.id +` + +type JoinRow struct { + User User + Post Post +} + +func (q *Queries) Join(ctx context.Context) (JoinRow, error) { + row := q.db.QueryRowContext(ctx, join) + var i JoinRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.Post.ID, + &i.Post.UserID, + ) + return i, err +} + +const only = `-- name: Only :one +SELECT users.id, users.name, users.age FROM users +` + +type OnlyRow struct { + User User +} + +func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { + row := q.db.QueryRowContext(ctx, only) + var i OnlyRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAlias = `-- name: WithAlias :one +SELECT u.id, u.name, u.age FROM users AS u +` + +type WithAliasRow struct { + User User +} + +func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { + row := q.db.QueryRowContext(ctx, withAlias) + var i WithAliasRow + err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) + return i, err +} + +const withAsterisk = `-- name: WithAsterisk :one +SELECT users.id, users.name, users.age, id, name, age FROM users +` + +type WithAsteriskRow struct { + User User + ID int64 + Name string + Age sql.NullInt64 +} + +func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { + row := q.db.QueryRowContext(ctx, withAsterisk) + var i WithAsteriskRow + err := row.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.ID, + &i.Name, + &i.Age, + ) + return i, err +} + +const withCrossSchema = `-- name: WithCrossSchema :many +SELECT u.id, u.name, u.age, bu.id, bu.name FROM users AS u +INNER JOIN baz.users bu ON u.id = bu.id +` + +type WithCrossSchemaRow struct { + User User + BazUser BazUser +} + +func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { + rows, err := q.db.QueryContext(ctx, withCrossSchema) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithCrossSchemaRow + for rows.Next() { + var i WithCrossSchemaRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.BazUser.ID, + &i.BazUser.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 withSchema = `-- name: WithSchema :one +SELECT bu.id, bu.name FROM baz.users AS bu +` + +type WithSchemaRow struct { + BazUser BazUser +} + +func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { + row := q.db.QueryRowContext(ctx, withSchema) + var i WithSchemaRow + err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) + return i, err +} + +const withSubquery = `-- name: WithSubquery :many +SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users +` + +type WithSubqueryRow struct { + User User + TotalCount int64 +} + +func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { + rows, err := q.db.QueryContext(ctx, withSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WithSubqueryRow + for rows.Next() { + var i WithSubqueryRow + if err := rows.Scan( + &i.User.ID, + &i.User.Name, + &i.User.Age, + &i.TotalCount, + ); 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/sqlc_embed/sqlite/query.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql new file mode 100644 index 0000000000..1d0a02f109 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql @@ -0,0 +1,25 @@ +-- name: Only :one +SELECT sqlc.embed(users) FROM users; + +-- name: WithAlias :one +SELECT sqlc.embed(u) FROM users AS u; + +-- name: WithSubquery :many +SELECT sqlc.embed(users), (SELECT count(*) FROM users) AS total_count FROM users; + +-- name: WithAsterisk :one +SELECT sqlc.embed(users), * FROM users; + +-- name: Duplicate :one +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.id; + +-- name: WithSchema :one +SELECT sqlc.embed(bu) FROM baz.users AS bu; + +-- name: WithCrossSchema :many +SELECT sqlc.embed(u), sqlc.embed(bu) FROM users AS u +INNER JOIN baz.users bu ON u.id = bu.id; diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql new file mode 100644 index 0000000000..5a1d371b7e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql @@ -0,0 +1,19 @@ +ATTACH ':memory:' AS baz; + +CREATE TABLE users ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE posts ( + id integer PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer PRIMARY KEY, + name text NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/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/sqlc_narg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_narg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go new file mode 100644 index 0000000000..040ef7a0ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + MaybeBar sql.NullString +} diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go new file mode 100644 index 0000000000..1cba711a58 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go @@ -0,0 +1,119 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = ? +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = ? +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = ? +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = ? +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_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/sqlc_narg/mysql/query.sql b/internal/endtoend/testdata/sqlc_narg/mysql/query.sql new file mode 100644 index 0000000000..103c7378b8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/query.sql @@ -0,0 +1,11 @@ +-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg(bar); + +-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg(maybe_bar); + +-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg('bar'); + +-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg('maybe_bar'); diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql b/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/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/sqlc_narg/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/sqlc_narg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..040ef7a0ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + MaybeBar sql.NullString +} 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 new file mode 100644 index 0000000000..a2cff4e894 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,107 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.Query(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.Query(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.Query(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..103c7378b8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql @@ -0,0 +1,11 @@ +-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg(bar); + +-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg(maybe_bar); + +-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg('bar'); + +-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg('maybe_bar'); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/sqlc_narg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..9875c2fc16 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar string + MaybeBar pgtype.Text +} 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 new file mode 100644 index 0000000000..21e8482afc --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,108 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar pgtype.Text) ([]string, error) { + rows, err := q.db.Query(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar pgtype.Text) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var maybe_bar pgtype.Text + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar pgtype.Text) ([]string, error) { + rows, err := q.db.Query(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar pgtype.Text) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var maybe_bar pgtype.Text + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..103c7378b8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql @@ -0,0 +1,11 @@ +-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg(bar); + +-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg(maybe_bar); + +-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg('bar'); + +-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg('maybe_bar'); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/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/sqlc_narg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_narg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..040ef7a0ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + MaybeBar sql.NullString +} 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 new file mode 100644 index 0000000000..f83af91b6b --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,119 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_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/sqlc_narg/postgresql/stdlib/go_strict/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go new file mode 100644 index 0000000000..2a33033883 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest_strict + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_narg/postgresql/stdlib/go_strict/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go new file mode 100644 index 0000000000..d8f6d919d7 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest_strict + +import ( + "database/sql" +) + +type Foo struct { + Bar string + MaybeBar sql.NullString +} 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 new file mode 100644 index 0000000000..a9126fa18f --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go @@ -0,0 +1,119 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest_strict + +import ( + "context" + "database/sql" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = $1 +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = $1 +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_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/sqlc_narg/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..103c7378b8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql @@ -0,0 +1,11 @@ +-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg(bar); + +-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg(maybe_bar); + +-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg('bar'); + +-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg('maybe_bar'); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..cf7329427d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f5873c14cd --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json @@ -0,0 +1,28 @@ +{ + "version": "2", + "sql": [ + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "out": "go" + } + } + }, + { + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "strict_function_checks": true, + "gen": { + "go": { + "package": "querytest_strict", + "out": "go_strict" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_narg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go new file mode 100644 index 0000000000..040ef7a0ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar string + MaybeBar sql.NullString +} diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go new file mode 100644 index 0000000000..c603bcd4ab --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go @@ -0,0 +1,119 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const identOnNonNullable = `-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = ?1 +` + +func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 identOnNullable = `-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = ?1 +` + +func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const stringOnNonNullable = `-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = ?1 +` + +func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { + rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var bar string + 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 stringOnNullable = `-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = ?1 +` + +func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var maybe_bar sql.NullString + if err := rows.Scan(&maybe_bar); err != nil { + return nil, err + } + items = append(items, maybe_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/sqlc_narg/sqlite/query.sql b/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql new file mode 100644 index 0000000000..103c7378b8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql @@ -0,0 +1,11 @@ +-- name: IdentOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg(bar); + +-- name: IdentOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg(maybe_bar); + +-- name: StringOnNonNullable :many +SELECT bar FROM foo WHERE bar = sqlc.narg('bar'); + +-- name: StringOnNullable :many +SELECT maybe_bar FROM foo WHERE maybe_bar = sqlc.narg('maybe_bar'); diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json new file mode 100644 index 0000000000..e63bc00cf9 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "querytest", + "out": "go" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_slice/mysql/go/models.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go new file mode 100644 index 0000000000..77be1976cf --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/sqlc-dev/sqlc-testdata/mysql" +) + +type Foo struct { + ID int32 + Name string + Bar sql.NullString + Mystr mysql.ID +} diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go new file mode 100644 index 0000000000..72d5617d0a --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go @@ -0,0 +1,282 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "strings" + + "github.com/sqlc-dev/sqlc-testdata/mysql" +) + +const funcNullable = `-- name: FuncNullable :many +SELECT bar FROM foo +WHERE id IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullable(ctx context.Context, favourites []int32) ([]sql.NullString, error) { + query := funcNullable + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcNullableNot = `-- name: FuncNullableNot :many +SELECT bar FROM foo +WHERE id NOT IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int32) ([]sql.NullString, error) { + query := funcNullableNot + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo +WHERE name = ? + AND id IN (/*SLICE:favourites*/?) +` + +type FuncParamIdentParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + query := funcParamIdent + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamSoloArg = `-- name: FuncParamSoloArg :many +SELECT name FROM foo +WHERE id IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int32) ([]string, error) { + query := funcParamSoloArg + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo +WHERE name = ? + AND id IN (/*SLICE:favourites*/?) +` + +type FuncParamStringParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { + query := funcParamString + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 sliceExec = `-- name: SliceExec :exec +UPDATE foo SET name = ? +WHERE id IN (/*SLICE:favourites*/?) +` + +type SliceExecParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { + query := sliceExec + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + _, err := q.db.ExecContext(ctx, query, queryParams...) + return err +} + +const typedMyStr = `-- name: TypedMyStr :many +SELECT bar FROM foo +WHERE mystr IN (/*SLICE:mystr*/?) +` + +func (q *Queries) TypedMyStr(ctx context.Context, mystr []mysql.ID) ([]sql.NullString, error) { + query := typedMyStr + var queryParams []interface{} + if len(mystr) > 0 { + for _, v := range mystr { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:mystr*/?", strings.Repeat(",?", len(mystr))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:mystr*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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/sqlc_slice/mysql/query.sql b/internal/endtoend/testdata/sqlc_slice/mysql/query.sql new file mode 100644 index 0000000000..6cf377d00d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/query.sql @@ -0,0 +1,29 @@ +/* name: FuncParamIdent :many */ +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') + AND id IN (sqlc.slice('favourites')); + +/* name: FuncParamSoloArg :many */ +SELECT name FROM foo +WHERE id IN (sqlc.slice('favourites')); + +/* name: SliceExec :exec */ +UPDATE foo SET name = sqlc.arg(slug) +WHERE id IN (sqlc.slice(favourites)); + +/* name: FuncNullable :many */ +SELECT bar FROM foo +WHERE id IN (sqlc.slice('favourites')); + +/* name: FuncNullableNot :many */ +SELECT bar FROM foo +WHERE id NOT IN (sqlc.slice('favourites')); + +/* name: TypedMyStr :many */ +SELECT bar FROM foo +WHERE mystr IN (sqlc.slice(mystr)); diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql b/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql new file mode 100644 index 0000000000..9a803f2de4 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text null, mystr text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json new file mode 100644 index 0000000000..cd360d69a0 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json @@ -0,0 +1,18 @@ +{ + "version": "1", + "packages": [ + { + "engine": "mysql", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "column": "foo.mystr", + "go_type": "github.com/sqlc-dev/sqlc-testdata/mysql.ID" + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/sqlc_slice/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..eeaab97b8d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..2def271737 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo WHERE name = $1 + AND id IN ($2) +` + +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 + } + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + +const funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo WHERE name = $1 + AND id IN ($2) +` + +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 + } + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql new file mode 100644 index 0000000000..2a5fccf1fc --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: FuncParamIdent :many +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') + 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 new file mode 100644 index 0000000000..43e6433e30 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_slice/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..eeaab97b8d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..4463788192 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "strings" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo +WHERE name = $1 + AND id IN ($2) +` + +type FuncParamIdentParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + query := funcParamIdent + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo +WHERE name = $1 + AND id IN ($2) +` + +type FuncParamStringParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { + query := funcParamString + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 +} diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3c762d3bc8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql @@ -0,0 +1,11 @@ +/* name: FuncParamIdent :many */ +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') + AND id IN (sqlc.slice('favourites')); diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..43e6433e30 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/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/sqlc_slice/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlc_slice/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go new file mode 100644 index 0000000000..392b1ce49b --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + ID int64 + Name string + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go new file mode 100644 index 0000000000..ff3ae7f5ff --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go @@ -0,0 +1,242 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "strings" +) + +const funcNullable = `-- name: FuncNullable :many +SELECT bar FROM foo +WHERE id IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullable(ctx context.Context, favourites []int64) ([]sql.NullString, error) { + query := funcNullable + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcNullableNot = `-- name: FuncNullableNot :many +SELECT bar FROM foo +WHERE id NOT IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int64) ([]sql.NullString, error) { + query := funcNullableNot + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo +WHERE name = ?1 + AND id IN (/*SLICE:favourites*/?) +` + +type FuncParamIdentParams struct { + Slug string + Favourites []int64 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + query := funcParamIdent + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamSoloArg = `-- name: FuncParamSoloArg :many +SELECT name FROM foo +WHERE id IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int64) ([]string, error) { + query := funcParamSoloArg + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamString = `-- name: FuncParamString :many +SELECT name FROM foo +WHERE name = ?1 + AND id IN (/*SLICE:favourites*/?) +` + +type FuncParamStringParams struct { + Slug string + Favourites []int64 +} + +func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { + query := funcParamString + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 sliceExec = `-- name: SliceExec :exec +UPDATE foo SET name = ?1 +WHERE id IN (/*SLICE:favourites*/?) +` + +type SliceExecParams struct { + Slug string + Favourites []int64 +} + +func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { + query := sliceExec + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + _, err := q.db.ExecContext(ctx, query, queryParams...) + return err +} diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql b/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql new file mode 100644 index 0000000000..710341e4c8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql @@ -0,0 +1,25 @@ +/* name: FuncParamIdent :many */ +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') + AND id IN (sqlc.slice('favourites')); + +/* name: FuncParamSoloArg :many */ +SELECT name FROM foo +WHERE id IN (sqlc.slice('favourites')); + +/* name: SliceExec :exec */ +UPDATE foo SET name = sqlc.arg(slug) +WHERE id IN (sqlc.slice(favourites)); + +/* name: FuncNullable :many */ +SELECT bar FROM foo +WHERE id IN (sqlc.slice('favourites')); + +/* name: FuncNullableNot :many */ +SELECT bar FROM foo +WHERE id NOT IN (sqlc.slice('favourites')); \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql new file mode 100644 index 0000000000..b01b6f5800 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text); + diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/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/sqlc_slice_prepared/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go new file mode 100644 index 0000000000..f4a04e4acd --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go @@ -0,0 +1,88 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" + "fmt" +) + +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 +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +func Prepare(ctx context.Context, db DBTX) (*Queries, error) { + q := Queries{db: db} + var err error + if q.funcParamIdentStmt, err = db.PrepareContext(ctx, funcParamIdent); err != nil { + return nil, fmt.Errorf("error preparing query FuncParamIdent: %w", err) + } + return &q, nil +} + +func (q *Queries) Close() error { + var err error + if q.funcParamIdentStmt != nil { + if cerr := q.funcParamIdentStmt.Close(); cerr != nil { + err = fmt.Errorf("error closing funcParamIdentStmt: %w", cerr) + } + } + return err +} + +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) + case stmt != nil: + return stmt.ExecContext(ctx, args...) + default: + return q.db.ExecContext(ctx, query, args...) + } +} + +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) + case stmt != nil: + return stmt.QueryContext(ctx, args...) + default: + return q.db.QueryContext(ctx, query, args...) + } +} + +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { + switch { + case stmt != nil && q.tx != nil: + return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) + case stmt != nil: + return stmt.QueryRowContext(ctx, args...) + default: + return q.db.QueryRowContext(ctx, query, args...) + } +} + +type Queries struct { + db DBTX + tx *sql.Tx + funcParamIdentStmt *sql.Stmt +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + tx: tx, + funcParamIdentStmt: q.funcParamIdentStmt, + } +} diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go new file mode 100644 index 0000000000..392b1ce49b --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + ID int64 + Name string + Bar sql.NullString +} 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 new file mode 100644 index 0000000000..af519ba1e8 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "strings" +) + +const funcParamIdent = `-- name: FuncParamIdent :many +SELECT name FROM foo +WHERE name = ?1 + AND id IN (/*SLICE:favourites*/?) +` + +type FuncParamIdentParams struct { + Slug string + Favourites []int64 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + query := funcParamIdent + var queryParams []interface{} + queryParams = append(queryParams, arg.Slug) + if len(arg.Favourites) > 0 { + for _, v := range arg.Favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(arg.Favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.query(ctx, nil, query, queryParams...) + 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 +} diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql new file mode 100644 index 0000000000..57b98577e1 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql @@ -0,0 +1,4 @@ +/* name: FuncParamIdent :many */ +SELECT name FROM foo +WHERE name = sqlc.arg(slug) + AND id IN (sqlc.slice(favourites)); diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql new file mode 100644 index 0000000000..b01b6f5800 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text); + diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json new file mode 100644 index 0000000000..fcb534e05d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_prepared_queries": true + } + ] +} \ No newline at end of file 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..cd5bbb8e08 --- /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.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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..69bf4b51b6 --- /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.30.0 + +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..5bc1ee784c --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go @@ -0,0 +1,66 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// 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..e51c45c8c1 --- /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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_table_options/sqlite/go/models.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go new file mode 100644 index 0000000000..9a7d98ae0c --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Authors1 struct { + ID int64 + Name string + Bio sql.NullString +} + +type Authors2 struct { + ID int64 + Name string + Bio sql.NullString +} + +type Authors3 struct { + ID int64 + Name string + Bio sql.NullString +} + +type Authors4 struct { + ID int64 + Name string + Bio sql.NullString +} 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 new file mode 100644 index 0000000000..a805253f1b --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors1 +WHERE id = ?1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Authors1, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Authors1 + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql new file mode 100644 index 0000000000..749f91601d --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthor :one +SELECT * FROM authors1 +WHERE id = ?1 LIMIT 1; diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql b/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql new file mode 100644 index 0000000000..bb0741a8e3 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql @@ -0,0 +1,24 @@ +CREATE TABLE authors1 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) STRICT, WITHOUT ROWID; + +CREATE TABLE authors2 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) WITHOUT ROWID, STRICT; + +CREATE TABLE authors3 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) WITHOUT ROWID; + +CREATE TABLE authors4 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) STRICT; + diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json b/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/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/star_expansion/mysql/go/db.go b/internal/endtoend/testdata/star_expansion/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/models.go b/internal/endtoend/testdata/star_expansion/mysql/go/models.go index ce7117644a..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 99d87a6cb8..0f1f3f6658 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest @@ -50,3 +52,30 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } return items, nil } + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b 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); 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/mysql/query.sql b/internal/endtoend/testdata/star_expansion/mysql/query.sql index d330c646f3..2461d01236 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b text); - /* name: StarExpansion :many */ SELECT *, *, foo.* FROM foo; + +/* name: StarQuotedExpansion :many */ +SELECT `t`.* FROM foo `t`; diff --git a/internal/endtoend/testdata/star_expansion/mysql/schema.sql b/internal/endtoend/testdata/star_expansion/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/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/star_expansion/postgresql/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/postgresql/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/go/models.go deleted file mode 100644 index ce7117644a..0000000000 --- a/internal/endtoend/testdata/star_expansion/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/go/query.sql.go deleted file mode 100644 index 99d87a6cb8..0000000000 --- a/internal/endtoend/testdata/star_expansion/postgresql/go/query.sql.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const starExpansion = `-- name: StarExpansion :many -SELECT a, b, a, b, foo.a, foo.b FROM foo -` - -type StarExpansionRow struct { - A sql.NullString - B sql.NullString - A_2 sql.NullString - B_2 sql.NullString - A_3 sql.NullString - B_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.A_2, - &i.B_2, - &i.A_3, - &i.B_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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..f3e0c2094b --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,75 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, a, b, foo.a, foo.b FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + A_2 sql.NullString + B_2 sql.NullString + A_3 sql.NullString + B_3 sql.NullString +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.Query(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.A_2, + &i.B_2, + &i.A_3, + &i.B_3, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(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); 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/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..9588332d88 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql @@ -0,0 +1,5 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..3ee86d8810 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..f30529e266 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, a, b, foo.a, foo.b FROM foo +` + +type StarExpansionRow struct { + A pgtype.Text + B pgtype.Text + A_2 pgtype.Text + B_2 pgtype.Text + A_3 pgtype.Text + B_3 pgtype.Text +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.Query(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.A_2, + &i.B_2, + &i.A_3, + &i.B_3, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(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); 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/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..9588332d88 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/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/star_expansion/postgresql/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/query.sql deleted file mode 100644 index 0305062fbd..0000000000 --- a/internal/endtoend/testdata/star_expansion/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a text, b text); - --- name: StarExpansion :many -SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/postgresql/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/star_expansion/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..a9484ac78f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, a, b, foo.a, foo.b FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + A_2 sql.NullString + B_2 sql.NullString + A_3 sql.NullString + B_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.A_2, + &i.B_2, + &i.A_3, + &i.B_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 starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b 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); 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/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..9588332d88 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/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/sqlite/go/db.go b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go new file mode 100644 index 0000000000..a9484ac78f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, a, b, foo.a, foo.b FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + A_2 sql.NullString + B_2 sql.NullString + A_3 sql.NullString + B_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.A_2, + &i.B_2, + &i.A_3, + &i.B_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 starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b 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); 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/sqlite/query.sql b/internal/endtoend/testdata/star_expansion/sqlite/query.sql new file mode 100644 index 0000000000..6249bb48b7 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; diff --git a/internal/endtoend/testdata/star_expansion/sqlite/schema.sql b/internal/endtoend/testdata/star_expansion/sqlite/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json b/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/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/go/db.go b/internal/endtoend/testdata/star_expansion_cte/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion_cte/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_cte/go/models.go b/internal/endtoend/testdata/star_expansion_cte/go/models.go deleted file mode 100644 index 3e32636373..0000000000 --- a/internal/endtoend/testdata/star_expansion_cte/go/models.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - C sql.NullString - D sql.NullString -} - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion_cte/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/go/query.sql.go deleted file mode 100644 index e7dfdf897c..0000000000 --- a/internal/endtoend/testdata/star_expansion_cte/go/query.sql.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const starExpansionCTE = `-- name: StarExpansionCTE :many -WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar -` - -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.C, &i.D); 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 starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many -WITH - a AS (SELECT a, b FROM foo), - b AS (SELECT 1::int as bar, a, b FROM a) -SELECT bar, a, b FROM b -` - -type StarExpansionTwoCTERow struct { - Bar int32 - A sql.NullString - B sql.NullString -} - -func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionTwoCTE) - if err != nil { - return nil, err - } - defer rows.Close() - var items []StarExpansionTwoCTERow - for rows.Next() { - var i StarExpansionTwoCTERow - if err := rows.Scan(&i.Bar, &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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..897f99f876 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go @@ -0,0 +1,68 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar +` + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(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.C, &i.D); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT a, b FROM foo), + b AS (SELECT 1::int as bar, a, b FROM a) +SELECT bar, a, b FROM b +` + +type StarExpansionTwoCTERow struct { + Bar int32 + A sql.NullString + B sql.NullString +} + +func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { + rows, err := q.db.Query(ctx, starExpansionTwoCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionTwoCTERow + for rows.Next() { + var i StarExpansionTwoCTERow + if err := rows.Scan(&i.Bar, &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 +} diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql new file mode 100644 index 0000000000..d7fb4cfa92 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql @@ -0,0 +1,8 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; + +-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT * FROM foo), + b AS (SELECT 1::int as bar, * FROM a) +SELECT * FROM b; diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go new file mode 100644 index 0000000000..0df50c9ca2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + C pgtype.Text + D pgtype.Text +} + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..cb49d0ecca --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go @@ -0,0 +1,69 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar +` + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { + rows, err := q.db.Query(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.C, &i.D); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT a, b FROM foo), + b AS (SELECT 1::int as bar, a, b FROM a) +SELECT bar, a, b FROM b +` + +type StarExpansionTwoCTERow struct { + Bar int32 + A pgtype.Text + B pgtype.Text +} + +func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { + rows, err := q.db.Query(ctx, starExpansionTwoCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionTwoCTERow + for rows.Next() { + var i StarExpansionTwoCTERow + if err := rows.Scan(&i.Bar, &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 +} diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql new file mode 100644 index 0000000000..d7fb4cfa92 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql @@ -0,0 +1,8 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; + +-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT * FROM foo), + b AS (SELECT 1::int as bar, * FROM a) +SELECT * FROM b; diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/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/star_expansion_cte/query.sql b/internal/endtoend/testdata/star_expansion_cte/query.sql deleted file mode 100644 index 5be315bfad..0000000000 --- a/internal/endtoend/testdata/star_expansion_cte/query.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - --- name: StarExpansionCTE :many -WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; - --- name: StarExpansionTwoCTE :many -WITH - a AS (SELECT * FROM foo), - b AS (SELECT 1::int as bar, * FROM a) -SELECT * FROM b; diff --git a/internal/endtoend/testdata/star_expansion_cte/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/star_expansion_cte/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..b9de05170d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go @@ -0,0 +1,74 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar +` + +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.C, &i.D); 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 starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT a, b FROM foo), + b AS (SELECT 1::int as bar, a, b FROM a) +SELECT bar, a, b FROM b +` + +type StarExpansionTwoCTERow struct { + Bar int32 + A sql.NullString + B sql.NullString +} + +func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { + rows, err := q.db.QueryContext(ctx, starExpansionTwoCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionTwoCTERow + for rows.Next() { + var i StarExpansionTwoCTERow + if err := rows.Scan(&i.Bar, &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 +} diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql new file mode 100644 index 0000000000..d7fb4cfa92 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; + +-- name: StarExpansionTwoCTE :many +WITH + a AS (SELECT * FROM foo), + b AS (SELECT 1::int as bar, * FROM a) +SELECT * FROM b; diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..53c5c498a6 --- /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.30.0 + +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..490760a235 --- /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.30.0 +// 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/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion_from_cte/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_from_cte/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/go/models.go deleted file mode 100644 index 3e32636373..0000000000 --- a/internal/endtoend/testdata/star_expansion_from_cte/go/models.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - C sql.NullString - D sql.NullString -} - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion_from_cte/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/go/query.sql.go deleted file mode 100644 index df7d48ca8a..0000000000 --- a/internal/endtoend/testdata/star_expansion_from_cte/go/query.sql.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const starExpansionCTE = `-- name: StarExpansionCTE :many -WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte -` - -type StarExpansionCTERow struct { - A sql.NullString - B sql.NullString -} - -func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) - if err != nil { - return nil, err - } - defer rows.Close() - var items []StarExpansionCTERow - for rows.Next() { - var i StarExpansionCTERow - 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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_from_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..bff7a6caac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte +` + +type StarExpansionCTERow struct { + A sql.NullString + B sql.NullString +} + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { + rows, err := q.db.Query(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionCTERow + for rows.Next() { + var i StarExpansionCTERow + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql new file mode 100644 index 0000000000..f91c7b7472 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_from_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go new file mode 100644 index 0000000000..0df50c9ca2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + C pgtype.Text + D pgtype.Text +} + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..e4fa778124 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte +` + +type StarExpansionCTERow struct { + A pgtype.Text + B pgtype.Text +} + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { + rows, err := q.db.Query(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionCTERow + for rows.Next() { + var i StarExpansionCTERow + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql new file mode 100644 index 0000000000..f91c7b7472 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/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/star_expansion_from_cte/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/query.sql deleted file mode 100644 index 347be0ce69..0000000000 --- a/internal/endtoend/testdata/star_expansion_from_cte/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); --- name: StarExpansionCTE :many -WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/star_expansion_from_cte/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_from_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..7dd824b9d0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte +` + +type StarExpansionCTERow struct { + A sql.NullString + B sql.NullString +} + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { + rows, err := q.db.QueryContext(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionCTERow + for rows.Next() { + var i StarExpansionCTERow + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql new file mode 100644 index 0000000000..f91c7b7472 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionCTE :many +WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 3e32636373..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 40bcf32759..6bbaa96959 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/query.sql b/internal/endtoend/testdata/star_expansion_join/mysql/query.sql index 1f0b2377bc..02da113914 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_join/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - /* name: StarExpansionJoin :many */ SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_join/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/star_expansion_join/postgresql/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_join/postgresql/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/go/models.go deleted file mode 100644 index 3e32636373..0000000000 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/go/models.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Bar struct { - C sql.NullString - D sql.NullString -} - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/go/query.sql.go deleted file mode 100644 index 40bcf32759..0000000000 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/go/query.sql.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" - "database/sql" -) - -const starExpansionJoin = `-- name: StarExpansionJoin :many -SELECT a, b, c, d FROM foo, bar -` - -type StarExpansionJoinRow struct { - A sql.NullString - B sql.NullString - C sql.NullString - D 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.C, - &i.D, - ); 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_join/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_join/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..7d631caa11 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT a, b, c, d FROM foo, bar +` + +type StarExpansionJoinRow struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullString +} + +func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { + rows, err := q.db.Query(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.C, + &i.D, + ); 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_join/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..9322d7b413 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_join/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..0df50c9ca2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Bar struct { + C pgtype.Text + D pgtype.Text +} + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..52832a0fa9 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT a, b, c, d FROM foo, bar +` + +type StarExpansionJoinRow struct { + A pgtype.Text + B pgtype.Text + C pgtype.Text + D pgtype.Text +} + +func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { + rows, err := q.db.Query(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.C, + &i.D, + ); 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_join/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..9322d7b413 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/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/star_expansion_join/postgresql/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/query.sql deleted file mode 100644 index 9234796c0e..0000000000 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); --- name: StarExpansionJoin :many -SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_join/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ba8c0a9c1d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + C sql.NullString + D sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..6bbaa96959 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT a, b, c, d FROM foo, bar +` + +type StarExpansionJoinRow struct { + A sql.NullString + B sql.NullString + C sql.NullString + D 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.C, + &i.D, + ); 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_join/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..9322d7b413 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/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_reserved/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 2e34ef8e2a..7d67becd1c 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 f5a4a274ce..d644aa972b 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql b/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql index d7a5672d7a..e4cad82754 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (`group` text, `key` text); - /* name: StarExpansionReserved :many */ SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql new file mode 100644 index 0000000000..b3408491eb --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (`group` text, `key` text); + diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_reserved/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/star_expansion_reserved/postgresql/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_reserved/postgresql/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/models.go deleted file mode 100644 index 2e34ef8e2a..0000000000 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - Group sql.NullString - Key sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/query.sql.go deleted file mode 100644 index 88a108e8ac..0000000000 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const starExpansionReserved = `-- name: StarExpansionReserved :many -SELECT "group", key FROM foo -` - -func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionReserved) - if err != nil { - return nil, err - } - defer rows.Close() - var items []Foo - for rows.Next() { - var i Foo - if err := rows.Scan(&i.Group, &i.Key); 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_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..7d67becd1c --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Group sql.NullString + Key sql.NullString +} 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 new file mode 100644 index 0000000000..4fa961bbc6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionReserved = `-- name: StarExpansionReserved :many +SELECT "group", key FROM foo +` + +func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starExpansionReserved) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Group, &i.Key); 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_reserved/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..a97dd94b98 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionReserved :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..526beb2de2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Group pgtype.Text + Key pgtype.Text +} 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 new file mode 100644 index 0000000000..4fa961bbc6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionReserved = `-- name: StarExpansionReserved :many +SELECT "group", key FROM foo +` + +func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starExpansionReserved) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Group, &i.Key); 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_reserved/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..a97dd94b98 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionReserved :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/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/star_expansion_reserved/postgresql/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/query.sql deleted file mode 100644 index 6efc2efc01..0000000000 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/query.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE foo ("group" text, key text); --- name: StarExpansionReserved :many -SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..7d67becd1c --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Group sql.NullString + Key sql.NullString +} 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 new file mode 100644 index 0000000000..bbc49099eb --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionReserved = `-- name: StarExpansionReserved :many +SELECT "group", key FROM foo +` + +func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starExpansionReserved) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Group, &i.Key); 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_reserved/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..a97dd94b98 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionReserved :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/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_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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..1551cdb9d1 --- /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.30.0 + +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..ffd6da5afc --- /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.30.0 +// 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 ce7117644a..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 0213122df2..f00d659c95 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql b/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql index 2237338679..0b66b9ee97 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); - /* name: StarExpansionSubquery :many */ SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_subquery/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/star_expansion_subquery/postgresql/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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_subquery/postgresql/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/models.go deleted file mode 100644 index ce7117644a..0000000000 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullString - B sql.NullString -} diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/query.sql.go deleted file mode 100644 index 0213122df2..0000000000 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const starExpansionSubquery = `-- name: StarExpansionSubquery :many -SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) -` - -func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) - 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 -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_subquery/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..eee7e0b9a5 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starExpansionSubquery) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..53110a5ee8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionSubquery :many +SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_subquery/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..3ee86d8810 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Text + B pgtype.Text +} 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 new file mode 100644 index 0000000000..eee7e0b9a5 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starExpansionSubquery) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..53110a5ee8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionSubquery :many +SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/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/star_expansion_subquery/postgresql/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/query.sql deleted file mode 100644 index d06367d8cd..0000000000 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a text, b text); - --- name: StarExpansionSubquery :many -SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_subquery/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} 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 new file mode 100644 index 0000000000..f00d659c95 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..53110a5ee8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: StarExpansionSubquery :many +SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/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/strict_function_checks/postgresql/query.sql b/internal/endtoend/testdata/strict_function_checks/postgresql/query.sql new file mode 100644 index 0000000000..aaadd52e66 --- /dev/null +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: F :exec +SELECT doesntexist(); diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/schema.sql b/internal/endtoend/testdata/strict_function_checks/postgresql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json b/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json new file mode 100644 index 0000000000..6cb9103c1a --- /dev/null +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "name": "querytest", + "path": "go", + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "strict_function_checks": true + } + ] +} diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/base.txt b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/base.txt new file mode 100644 index 0000000000..a8972055f6 --- /dev/null +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: function "doesntexist" does not exist diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..16996b66fd --- /dev/null +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function doesntexist() does not exist 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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 5d38c1d2d3..530968fc6b 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 3ca3b9f2c8..769c49f53c 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql b/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/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/subquery_calculated_column/postgresql/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/subquery_calculated_column/postgresql/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/models.go deleted file mode 100644 index 5d38c1d2d3..0000000000 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/models.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "database/sql" -) - -type Foo struct { - A sql.NullInt32 - B sql.NullInt32 -} diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/query.sql.go deleted file mode 100644 index 3ca3b9f2c8..0000000000 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/go/query.sql.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many -SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f -` - -func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var sum int32 - if err := rows.Scan(&sum); err != nil { - return nil, err - } - items = append(items, sum) - } - 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/subquery_calculated_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/subquery_calculated_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..530968fc6b --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullInt32 + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..ae4c42a967 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f +` + +func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, subqueryCalcColumn) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var sum int32 + if err := rows.Scan(&sum); err != nil { + return nil, err + } + items = append(items, sum) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..16f1683204 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/subquery_calculated_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..95e7754cd6 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + A pgtype.Int4 + B pgtype.Int4 +} 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 new file mode 100644 index 0000000000..ae4c42a967 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f +` + +func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, subqueryCalcColumn) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var sum int32 + if err := rows.Scan(&sum); err != nil { + return nil, err + } + items = append(items, sum) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..16f1683204 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/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/subquery_calculated_column/postgresql/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/query.sql deleted file mode 100644 index 7e1281cc8e..0000000000 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (a int, b int); - --- name: SubqueryCalcColumn :many -SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/subquery_calculated_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..530968fc6b --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullInt32 + B sql.NullInt32 +} 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 new file mode 100644 index 0000000000..769c49f53c --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f +` + +func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var sum int32 + if err := rows.Scan(&sum); err != nil { + return nil, err + } + items = append(items, sum) + } + 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/subquery_calculated_column/postgresql/stdlib/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..16f1683204 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/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/subquery_calculated_column/sqlite/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/subquery_calculated_column/sqlite/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go new file mode 100644 index 0000000000..2d8fab6f2f --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullInt64 + B sql.NullInt64 +} 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 new file mode 100644 index 0000000000..6dbafb8f41 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f +` + +func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var sum int64 + if err := rows.Scan(&sum); err != nil { + return nil, err + } + items = append(items, sum) + } + 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/subquery_calculated_column/sqlite/query.sql b/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql new file mode 100644 index 0000000000..16f1683204 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: SubqueryCalcColumn :many +SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/issue.md b/internal/endtoend/testdata/sum_type/issue.md new file mode 100644 index 0000000000..b125c05134 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1106 \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/sum_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..605dd34145 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Order struct { + ID int64 + Quantity pgtype.Numeric + OrderCatalog pgtype.Int4 +} 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 new file mode 100644 index 0000000000..1efbbbe147 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const sumOrder = `-- name: SumOrder :one +SELECT SUM(quantity) FROM orders +` + +func (q *Queries) SumOrder(ctx context.Context) (pgtype.Numeric, error) { + row := q.db.QueryRow(ctx, sumOrder) + var sum pgtype.Numeric + err := row.Scan(&sum) + return sum, err +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..7effc6e765 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SumOrder :one +SELECT SUM(quantity) FROM orders; \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..85df079afe --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE orders ( + id BIGSERIAL PRIMARY KEY, + quantity decimal NOT NULL, + order_catalog int +); \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/sum_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/sum_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" \ No newline at end of file diff --git a/internal/endtoend/testdata/syntax_errors/postgresql/stderr.txt b/internal/endtoend/testdata/syntax_errors/postgresql/stderr.txt index dc5dd9f3b1..8f766d68a4 100644 --- a/internal/endtoend/testdata/syntax_errors/postgresql/stderr.txt +++ b/internal/endtoend/testdata/syntax_errors/postgresql/stderr.txt @@ -1,4 +1,4 @@ # package querytest -query/from.sql:1:1: syntax error at or near "from" -query/select.sql:1:1: syntax error at or near "select" -query/typo.sql:1:1: syntax error at or near "selectt" +query/from.sql:2:35: syntax error at or near "from" +query/select.sql:2:29: syntax error at or near "select" +query/typo.sql:2:2: syntax error at or near "selectt" 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/table_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..c871303d2d --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type Transaction struct { + ID int64 + Uri string + ProgramID string + Data pgtype.JSONB +} 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 new file mode 100644 index 0000000000..a8f159ee8a --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgtype" +) + +const getTransaction = `-- name: GetTransaction :many +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = $1 + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id +` + +type GetTransactionParams struct { + ProgramID string + Data string +} + +type GetTransactionRow struct { + JsonbExtractPath pgtype.JSONB + JsonbAgg pgtype.JSONB +} + +func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { + rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTransactionRow + for rows.Next() { + var i GetTransactionRow + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); 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/table_function/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..99f02a70ef --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql @@ -0,0 +1,12 @@ +/* name: GetTransaction :many */ +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/table_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..10e1baa1e3 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Transaction struct { + ID int64 + Uri string + ProgramID string + Data []byte +} 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 new file mode 100644 index 0000000000..bb2e0fea33 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,54 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getTransaction = `-- name: GetTransaction :many +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = $1 + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id +` + +type GetTransactionParams struct { + ProgramID string + Data string +} + +type GetTransactionRow struct { + JsonbExtractPath []byte + JsonbAgg []byte +} + +func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { + rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTransactionRow + for rows.Next() { + var i GetTransactionRow + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); 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/table_function/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..99f02a70ef --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql @@ -0,0 +1,12 @@ +/* name: GetTransaction :many */ +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/table_function/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/table_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..6a505de96b --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "encoding/json" +) + +type Transaction struct { + ID int64 + Uri string + ProgramID string + Data json.RawMessage +} 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 new file mode 100644 index 0000000000..a3d4157ab5 --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "encoding/json" +) + +const getTransaction = `-- name: GetTransaction :many +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = $1 + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id +` + +type GetTransactionParams struct { + ProgramID string + Data string +} + +type GetTransactionRow struct { + JsonbExtractPath json.RawMessage + JsonbAgg json.RawMessage +} + +func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { + rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTransactionRow + for rows.Next() { + var i GetTransactionRow + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); 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/table_function/postgresql/stdlib/query.sql b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..99f02a70ef --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql @@ -0,0 +1,12 @@ +/* name: GetTransaction :many */ +SELECT + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) +FROM + transactions, + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions +WHERE + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/table_function/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/table_function/sqlite/go/db.go b/internal/endtoend/testdata/table_function/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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_function/sqlite/go/models.go b/internal/endtoend/testdata/table_function/sqlite/go/models.go new file mode 100644 index 0000000000..7005f62ee8 --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Transaction struct { + Uri string + ProgramID string + Data 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 new file mode 100644 index 0000000000..b4f04af9a0 --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +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 +GROUP BY transactions.rowid +LIMIT ? +` + +type GetTransactionParams struct { + ProgramID string + Data string + Limit int64 +} + +type GetTransactionRow struct { + JsonExtract interface{} + JsonGroupArray interface{} +} + +func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { + rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data, arg.Limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTransactionRow + for rows.Next() { + var i GetTransactionRow + if err := rows.Scan(&i.JsonExtract, &i.JsonGroupArray); 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/table_function/sqlite/query.sql b/internal/endtoend/testdata/table_function/sqlite/query.sql new file mode 100644 index 0000000000..867e1114cb --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/query.sql @@ -0,0 +1,13 @@ +/* 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 +GROUP BY transactions.rowid +LIMIT ?; diff --git a/internal/endtoend/testdata/table_function/sqlite/schema.sql b/internal/endtoend/testdata/table_function/sqlite/schema.sql new file mode 100644 index 0000000000..90741e70db --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE transactions ( + uri text NOT NULL, + program_id text NOT NULL, + data text NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/sqlite/sqlc.json b/internal/endtoend/testdata/table_function/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file 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..3b320aa168 --- /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.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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..b074ef45c0 --- /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.30.0 + +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..1e7221315b --- /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.30.0 +// 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..6312be57a5 --- /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 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/db.go +++ b/internal/endtoend/testdata/truncate/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/truncate/mysql/go/models.go b/internal/endtoend/testdata/truncate/mysql/go/models.go index 18039acde9..65820844a6 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/models.go +++ b/internal/endtoend/testdata/truncate/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest -import () - type Bar struct { - ID int64 + 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 4fed542a00..d465593707 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/mysql/query.sql b/internal/endtoend/testdata/truncate/mysql/query.sql index 0ced1754e1..47b8985c7a 100644 --- a/internal/endtoend/testdata/truncate/mysql/query.sql +++ b/internal/endtoend/testdata/truncate/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: Truncate :exec TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/mysql/schema.sql b/internal/endtoend/testdata/truncate/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/mysql/sqlc.json b/internal/endtoend/testdata/truncate/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/truncate/mysql/sqlc.json +++ b/internal/endtoend/testdata/truncate/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/truncate/postgresql/go/db.go b/internal/endtoend/testdata/truncate/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/truncate/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/truncate/postgresql/go/models.go b/internal/endtoend/testdata/truncate/postgresql/go/models.go deleted file mode 100644 index 7c3b98644d..0000000000 --- a/internal/endtoend/testdata/truncate/postgresql/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Bar struct { - ID int32 -} diff --git a/internal/endtoend/testdata/truncate/postgresql/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/go/query.sql.go deleted file mode 100644 index 4fed542a00..0000000000 --- a/internal/endtoend/testdata/truncate/postgresql/go/query.sql.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const truncate = `-- name: Truncate :exec -TRUNCATE bar -` - -func (q *Queries) Truncate(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, truncate) - return err -} diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/truncate/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5aea7ce64e --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const truncate = `-- name: Truncate :exec +TRUNCATE bar +` + +func (q *Queries) Truncate(ctx context.Context) error { + _, err := q.db.Exec(ctx, truncate) + return err +} diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..47b8985c7a --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: Truncate :exec +TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/truncate/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..5aea7ce64e --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const truncate = `-- name: Truncate :exec +TRUNCATE bar +` + +func (q *Queries) Truncate(ctx context.Context) error { + _, err := q.db.Exec(ctx, truncate) + return err +} diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..47b8985c7a --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: Truncate :exec +TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/truncate/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/truncate/postgresql/query.sql b/internal/endtoend/testdata/truncate/postgresql/query.sql deleted file mode 100644 index 0ced1754e1..0000000000 --- a/internal/endtoend/testdata/truncate/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: Truncate :exec -TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/truncate/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/truncate/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d465593707 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const truncate = `-- name: Truncate :exec +TRUNCATE bar +` + +func (q *Queries) Truncate(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, truncate) + return err +} diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql b/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..47b8985c7a --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Truncate :exec +TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/truncate/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/types_uuid/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/types_uuid/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..80f5f51c7d --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + + "github.com/google/uuid" +) + +type Foo struct { + Description sql.NullString + Bar uuid.NullUUID + Baz uuid.UUID +} 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 new file mode 100644 index 0000000000..60fa5945ab --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const find = `-- name: Find :one +SELECT bar FROM foo WHERE baz = $1 +` + +func (q *Queries) Find(ctx context.Context, baz uuid.UUID) (uuid.NullUUID, error) { + row := q.db.QueryRowContext(ctx, find, baz) + var bar uuid.NullUUID + err := row.Scan(&bar) + return bar, err +} + +const list = `-- name: List :many +SELECT description, bar, baz FROM foo +` + +func (q *Queries) List(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, list) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.Description, &i.Bar, &i.Baz); 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/types_uuid/postgresql/stdlib/query.sql b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b94846fce2 --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: List :many +SELECT * FROM foo; + +-- name: Find :one +SELECT bar FROM foo WHERE baz = $1; diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b6ff9d1315 --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + description text, + bar uuid, + baz uuid not null +); + diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/unknown_func/go/db.go b/internal/endtoend/testdata/unknown_func/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/unknown_func/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/unknown_func/go/models.go b/internal/endtoend/testdata/unknown_func/go/models.go deleted file mode 100644 index b443f16b28..0000000000 --- a/internal/endtoend/testdata/unknown_func/go/models.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - ID string -} diff --git a/internal/endtoend/testdata/unknown_func/go/query.sql.go b/internal/endtoend/testdata/unknown_func/go/query.sql.go deleted file mode 100644 index e756bb1de0..0000000000 --- a/internal/endtoend/testdata/unknown_func/go/query.sql.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const listFoos = `-- name: ListFoos :one -SELECT id FROM foo WHERE id = frobnicate($1) -` - -func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { - row := q.db.QueryRowContext(ctx, listFoos, frobnicate) - var id string - err := row.Scan(&id) - return id, err -} diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/exec.json b/internal/endtoend/testdata/unknown_func/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/query.sql b/internal/endtoend/testdata/unknown_func/pganalyze/query.sql new file mode 100644 index 0000000000..36b697c8bb --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql b/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/sqlc.json b/internal/endtoend/testdata/unknown_func/pganalyze/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/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/unknown_func/pganalyze/stderr.txt b/internal/endtoend/testdata/unknown_func/pganalyze/stderr.txt new file mode 100644 index 0000000000..8e63375c83 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:31: function frobnicate(unknown) does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json b/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/unknown_func/pgx/v4/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..b9b343e131 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoos = `-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1) +` + +func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { + row := q.db.QueryRow(ctx, listFoos, frobnicate) + var id string + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql b/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql new file mode 100644 index 0000000000..36b697c8bb --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql b/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json b/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json b/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/unknown_func/pgx/v5/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..b9b343e131 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoos = `-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1) +` + +func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { + row := q.db.QueryRow(ctx, listFoos, frobnicate) + var id string + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql b/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql new file mode 100644 index 0000000000..36b697c8bb --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql b/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json b/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/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/unknown_func/query.sql b/internal/endtoend/testdata/unknown_func/query.sql deleted file mode 100644 index 1ef50de406..0000000000 --- a/internal/endtoend/testdata/unknown_func/query.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE foo (id text not null); --- name: ListFoos :one -SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/sqlc.json b/internal/endtoend/testdata/unknown_func/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/unknown_func/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/unknown_func/stdlib/exec.json b/internal/endtoend/testdata/unknown_func/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/db.go b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/unknown_func/stdlib/go/models.go b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go new file mode 100644 index 0000000000..ef6e41447e --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..d88d6d8275 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoos = `-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1) +` + +func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { + row := q.db.QueryRowContext(ctx, listFoos, frobnicate) + var id string + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/unknown_func/stdlib/query.sql b/internal/endtoend/testdata/unknown_func/stdlib/query.sql new file mode 100644 index 0000000000..36b697c8bb --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/stdlib/schema.sql b/internal/endtoend/testdata/unknown_func/stdlib/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json b/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/unnest/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..746156964b --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" + + "github.com/google/uuid" +) + +type Memory struct { + ID uuid.UUID + VampireID uuid.UUID + CreatedAt time.Time + UpdatedAt sql.NullTime +} + +type Vampire struct { + ID uuid.UUID +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go new file mode 100644 index 0000000000..e461e469a0 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +type Querier interface { + CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) + GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..072b4f06e8 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,69 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +const createMemories = `-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest($1::uuid[]) AS vampire_id +RETURNING + id, vampire_id, created_at, updated_at +` + +func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) { + rows, err := q.db.Query(ctx, createMemories, vampireID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Memory + for rows.Next() { + var i Memory + if err := rows.Scan( + &i.ID, + &i.VampireID, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getVampireIDs = `-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) +` + +func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) { + rows, err := q.db.Query(ctx, getVampireIDs, vampireID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uuid.UUID + for rows.Next() { + var vampires_id uuid.UUID + if err := rows.Scan(&vampires_id); err != nil { + return nil, err + } + items = append(items, vampires_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..d06a0578b4 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/query.sql @@ -0,0 +1,9 @@ +-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest(@vampire_id::uuid[]) AS vampire_id +RETURNING + *; + +-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest(@vampire_id::uuid[]) AS vampires (id); diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..5f539d7a14 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + +CREATE TABLE memories ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid (), + vampire_id uuid REFERENCES vampires (id) NOT NULL, + created_at timestamp NOT NULL DEFAULT NOW(), + updated_at timestamp +); diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/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_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/unnest/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..4d78ae55e9 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Memory struct { + ID pgtype.UUID + VampireID pgtype.UUID + CreatedAt pgtype.Timestamp + UpdatedAt pgtype.Timestamp +} + +type Vampire struct { + ID pgtype.UUID +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go new file mode 100644 index 0000000000..8f057d9828 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +type Querier interface { + CreateMemories(ctx context.Context, vampireID []pgtype.UUID) ([]Memory, error) + GetVampireIDs(ctx context.Context, vampireID []pgtype.UUID) ([]pgtype.UUID, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..3e8cfe29e3 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,69 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createMemories = `-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest($1::uuid[]) AS vampire_id +RETURNING + id, vampire_id, created_at, updated_at +` + +func (q *Queries) CreateMemories(ctx context.Context, vampireID []pgtype.UUID) ([]Memory, error) { + rows, err := q.db.Query(ctx, createMemories, vampireID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Memory + for rows.Next() { + var i Memory + if err := rows.Scan( + &i.ID, + &i.VampireID, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getVampireIDs = `-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) +` + +func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []pgtype.UUID) ([]pgtype.UUID, error) { + rows, err := q.db.Query(ctx, getVampireIDs, vampireID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.UUID + for rows.Next() { + var vampires_id pgtype.UUID + if err := rows.Scan(&vampires_id); err != nil { + return nil, err + } + items = append(items, vampires_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..d06a0578b4 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/query.sql @@ -0,0 +1,9 @@ +-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest(@vampire_id::uuid[]) AS vampire_id +RETURNING + *; + +-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest(@vampire_id::uuid[]) AS vampires (id); diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..5f539d7a14 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + +CREATE TABLE memories ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid (), + vampire_id uuid REFERENCES vampires (id) NOT NULL, + created_at timestamp NOT NULL DEFAULT NOW(), + updated_at timestamp +); diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/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_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/unnest/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..746156964b --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" + + "github.com/google/uuid" +) + +type Memory struct { + ID uuid.UUID + VampireID uuid.UUID + CreatedAt time.Time + UpdatedAt sql.NullTime +} + +type Vampire struct { + ID uuid.UUID +} diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go new file mode 100644 index 0000000000..e461e469a0 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +type Querier interface { + CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) + GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) +} + +var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..97e187cc9a --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,76 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" + "github.com/lib/pq" +) + +const createMemories = `-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest($1::uuid[]) AS vampire_id +RETURNING + id, vampire_id, created_at, updated_at +` + +func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) { + rows, err := q.db.QueryContext(ctx, createMemories, pq.Array(vampireID)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Memory + for rows.Next() { + var i Memory + if err := rows.Scan( + &i.ID, + &i.VampireID, + &i.CreatedAt, + &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 getVampireIDs = `-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) +` + +func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) { + rows, err := q.db.QueryContext(ctx, getVampireIDs, pq.Array(vampireID)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uuid.UUID + for rows.Next() { + var vampires_id uuid.UUID + if err := rows.Scan(&vampires_id); err != nil { + return nil, err + } + items = append(items, vampires_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/unnest/postgresql/stdlib/query.sql b/internal/endtoend/testdata/unnest/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..d06a0578b4 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/query.sql @@ -0,0 +1,9 @@ +-- name: CreateMemories :many +INSERT INTO memories (vampire_id) +SELECT + unnest(@vampire_id::uuid[]) AS vampire_id +RETURNING + *; + +-- name: GetVampireIDs :many +SELECT vampires.id::uuid FROM unnest(@vampire_id::uuid[]) AS vampires (id); diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..5f539d7a14 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + +CREATE TABLE memories ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid (), + vampire_id uuid REFERENCES vampires (id) NOT NULL, + created_at timestamp NOT NULL DEFAULT NOW(), + updated_at timestamp +); diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/unnest/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..36f98f9072 --- /dev/null +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/unnest_star/issue.md b/internal/endtoend/testdata/unnest_star/issue.md new file mode 100644 index 0000000000..d0aede56b3 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1185 \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json b/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/unnest_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..63f98719bf --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Item struct { + ItemID int64 +} + +type Plan struct { + PlanID int64 +} + +type PlanItem struct { + PlanItemID int64 + PlanID int64 + 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 new file mode 100644 index 0000000000..9cfcf1b136 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getPlanItems = `-- name: GetPlanItems :many +SELECT p.plan_id, p.item_id +FROM (SELECT unnest FROM unnest($1::bigint[])) AS i(req_item_id), +LATERAL ( + SELECT plan_id, item_id + FROM plan_items + WHERE + item_id = i.req_item_id AND + ($2 = 0 OR plan_id < $2) + ORDER BY plan_id DESC + LIMIT $3 +) p +` + +type GetPlanItemsParams struct { + Ids []int64 + After pgtype.Int4 + LimitCount int64 +} + +type GetPlanItemsRow struct { + PlanID int64 + ItemID int64 +} + +func (q *Queries) GetPlanItems(ctx context.Context, arg GetPlanItemsParams) ([]GetPlanItemsRow, error) { + rows, err := q.db.Query(ctx, getPlanItems, arg.Ids, arg.After, arg.LimitCount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetPlanItemsRow + for rows.Next() { + var i GetPlanItemsRow + if err := rows.Scan(&i.PlanID, &i.ItemID); 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/unnest_star/postgresql/pgx/query.sql b/internal/endtoend/testdata/unnest_star/postgresql/pgx/query.sql new file mode 100644 index 0000000000..01b5c77430 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/query.sql @@ -0,0 +1,12 @@ +-- name: GetPlanItems :many +SELECT p.plan_id, p.item_id +FROM (SELECT * FROM unnest(@ids::bigint[])) AS i(req_item_id), +LATERAL ( + SELECT plan_id, item_id + FROM plan_items + WHERE + item_id = i.req_item_id AND + (@after = 0 OR plan_id < @after) + ORDER BY plan_id DESC + LIMIT @limit_count +) p; \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql b/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..787caf88c7 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql @@ -0,0 +1,13 @@ +create table plans ( + plan_id bigint generated by default as identity primary key +); + +create table items ( + item_id bigint generated by default as identity primary key +); + +create table plan_items ( + plan_item_id bigint generated by default as identity primary key, + plan_id bigint not null REFERENCES plans, + item_id bigint not null REFERENCES items +); \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/unnest_star/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/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" \ No newline at end of file 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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/unnest_with_ordinality/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..2067e59942 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..8bcd972db9 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + GetValues(ctx context.Context) ([]GetValuesRow, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..d1621e11fd --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getValues = `-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) +` + +type GetValuesRow struct { + ID int64 + Index int64 + Value string +} + +func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { + rows, err := q.db.Query(ctx, getValues) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetValuesRow + for rows.Next() { + var i GetValuesRow + if err := rows.Scan(&i.ID, &i.Index, &i.Value); 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/unnest_with_ordinality/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..8bed8bdada --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..2a9a261e96 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE array_values ( + id bigserial PRIMARY KEY, + values text[] NOT NULL +); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..e0530db353 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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/unnest_with_ordinality/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..2067e59942 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..8bcd972db9 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + GetValues(ctx context.Context) ([]GetValuesRow, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..d1621e11fd --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getValues = `-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) +` + +type GetValuesRow struct { + ID int64 + Index int64 + Value string +} + +func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { + rows, err := q.db.Query(ctx, getValues) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetValuesRow + for rows.Next() { + var i GetValuesRow + if err := rows.Scan(&i.ID, &i.Index, &i.Value); 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/unnest_with_ordinality/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..8bed8bdada --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..2a9a261e96 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE array_values ( + id bigserial PRIMARY KEY, + values text[] NOT NULL +); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..007fb8530f --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/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_interface": true + } + ] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/unnest_with_ordinality/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..2067e59942 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..8bcd972db9 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + GetValues(ctx context.Context) ([]GetValuesRow, error) +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..2f62f8bb0d --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getValues = `-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) +` + +type GetValuesRow struct { + ID int64 + Index int64 + Value string +} + +func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { + rows, err := q.db.QueryContext(ctx, getValues) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetValuesRow + for rows.Next() { + var i GetValuesRow + if err := rows.Scan(&i.ID, &i.Index, &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 +} diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/query.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..8bed8bdada --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/query.sql @@ -0,0 +1,3 @@ +-- name: GetValues :many +SELECT id, index::bigint, value::text +FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..2a9a261e96 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE array_values ( + id bigserial PRIMARY KEY, + values text[] NOT NULL +); diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..36f98f9072 --- /dev/null +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_interface": true + } + ] +} diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/db.go b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/unsigned_params/mysql/go/models.go b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go new file mode 100644 index 0000000000..1ff011b819 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..3654e5f7c5 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const createFoo = `-- name: CreateFoo :exec +INSERT INTO foo (id) VALUES (?) +` + +func (q *Queries) CreateFoo(ctx context.Context, id uint32) error { + _, err := q.db.ExecContext(ctx, createFoo, id) + return err +} diff --git a/internal/endtoend/testdata/unsigned_params/mysql/query.sql b/internal/endtoend/testdata/unsigned_params/mysql/query.sql new file mode 100644 index 0000000000..75f888cfe8 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: CreateFoo :exec +INSERT INTO foo (id) VALUES (?); diff --git a/internal/endtoend/testdata/unsigned_params/mysql/schema.sql b/internal/endtoend/testdata/unsigned_params/mysql/schema.sql new file mode 100644 index 0000000000..e1d9224be8 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id INT UNSIGNED NOT NULL); + diff --git a/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json b/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/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/untyped_columns/sqlite/stdlib/db/db.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/untyped_columns/sqlite/stdlib/db/models.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go new file mode 100644 index 0000000000..9f53e22d22 --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type Repro struct { + ID interface{} + Name interface{} + Seq interface{} +} 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 new file mode 100644 index 0000000000..c0f28e53c1 --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getRepro = `-- name: GetRepro :one +select id, name, seq from repro where id = ? limit 1 +` + +func (q *Queries) GetRepro(ctx context.Context, id interface{}) (Repro, error) { + row := q.db.QueryRowContext(ctx, getRepro, id) + var i Repro + err := row.Scan(&i.ID, &i.Name, &i.Seq) + return i, err +} diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql new file mode 100644 index 0000000000..b90ec62481 --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: GetRepro :one +select * from repro where id = ? limit 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql new file mode 100644 index 0000000000..5a98bb004b --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql @@ -0,0 +1,3 @@ +-- original table name in sqlite schema was sqlite_sequence, rest of def is identical +create table repro(id, name, seq); + diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json new file mode 100644 index 0000000000..58ea3c6d66 --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "gen": { + "go": { + "package": "db", + "out": "db" + } + } + } + ] +} \ No newline at end of file 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..1e00549714 --- /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.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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..6db1df433c --- /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.30.0 + +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..2533a1908e --- /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.30.0 +// 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go new file mode 100644 index 0000000000..fda938bb99 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Td3Code struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + Code sql.NullString + Hash sql.NullString + IsPrivate sql.NullBool +} + +type Td3TestCode struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} 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 new file mode 100644 index 0000000000..4a5e6b409b --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const updateCode = `-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING hash, id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type UpdateCodeParams struct { + CreatedBy string + Code sql.NullString + Hash sql.NullString + TestID int32 +} + +type UpdateCodeRow struct { + Hash sql.NullString + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} + +func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { + row := q.db.QueryRow(ctx, updateCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i UpdateCodeRow + err := row.Scan( + &i.Hash, + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/query.sql b/internal/endtoend/testdata/update_cte/pgx/v4/query.sql new file mode 100644 index 0000000000..d1f8ffac77 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/query.sql @@ -0,0 +1,19 @@ +-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING *; diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go new file mode 100644 index 0000000000..5f27f6c6bd --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Td3Code struct { + ID int32 + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz + CreatedBy string + UpdatedBy string + Code pgtype.Text + Hash pgtype.Text + IsPrivate pgtype.Bool +} + +type Td3TestCode struct { + ID int32 + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} 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 new file mode 100644 index 0000000000..90b9f28d34 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateCode = `-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING hash, id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type UpdateCodeParams struct { + CreatedBy string + Code pgtype.Text + Hash pgtype.Text + TestID int32 +} + +type UpdateCodeRow struct { + Hash pgtype.Text + ID int32 + TsCreated pgtype.Timestamptz + TsUpdated pgtype.Timestamptz + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} + +func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { + row := q.db.QueryRow(ctx, updateCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i UpdateCodeRow + err := row.Scan( + &i.Hash, + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/query.sql b/internal/endtoend/testdata/update_cte/pgx/v5/query.sql new file mode 100644 index 0000000000..d1f8ffac77 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/query.sql @@ -0,0 +1,19 @@ +-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING *; diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/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/update_cte/stdlib/go/db.go b/internal/endtoend/testdata/update_cte/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_cte/stdlib/go/models.go b/internal/endtoend/testdata/update_cte/stdlib/go/models.go new file mode 100644 index 0000000000..fda938bb99 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/go/models.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Td3Code struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + Code sql.NullString + Hash sql.NullString + IsPrivate sql.NullBool +} + +type Td3TestCode struct { + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go new file mode 100644 index 0000000000..cc8ead4fe5 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go @@ -0,0 +1,72 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const updateCode = `-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING hash, id, ts_created, ts_updated, created_by, updated_by, test_id, code_hash +` + +type UpdateCodeParams struct { + CreatedBy string + Code sql.NullString + Hash sql.NullString + TestID int32 +} + +type UpdateCodeRow struct { + Hash sql.NullString + ID int32 + TsCreated time.Time + TsUpdated time.Time + CreatedBy string + UpdatedBy string + TestID int32 + CodeHash string +} + +func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { + row := q.db.QueryRowContext(ctx, updateCode, + arg.CreatedBy, + arg.Code, + arg.Hash, + arg.TestID, + ) + var i UpdateCodeRow + err := row.Scan( + &i.Hash, + &i.ID, + &i.TsCreated, + &i.TsUpdated, + &i.CreatedBy, + &i.UpdatedBy, + &i.TestID, + &i.CodeHash, + ) + return i, err +} diff --git a/internal/endtoend/testdata/update_cte/stdlib/query.sql b/internal/endtoend/testdata/update_cte/stdlib/query.sql new file mode 100644 index 0000000000..d1f8ffac77 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/query.sql @@ -0,0 +1,19 @@ +-- name: UpdateCode :one +WITH cc AS ( + UPDATE td3.codes + SET + created_by = $1, + updated_by = $1, + code = $2, + hash = $3, + is_private = false + RETURNING hash +) +UPDATE td3.test_codes +SET + created_by = $1, + updated_by = $1, + test_id = $4, + code_hash = cc.hash + FROM cc +RETURNING *; diff --git a/internal/endtoend/testdata/update_cte/stdlib/schema.sql b/internal/endtoend/testdata/update_cte/stdlib/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/stdlib/sqlc.json b/internal/endtoend/testdata/update_cte/stdlib/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/update_inner_join/db/db.go b/internal/endtoend/testdata/update_inner_join/db/db.go index c3c034ae37..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/update_inner_join/db/db.go +++ b/internal/endtoend/testdata/update_inner_join/db/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/update_inner_join/db/models.go b/internal/endtoend/testdata/update_inner_join/db/models.go index 923f5df64a..41e5cc60de 100644 --- a/internal/endtoend/testdata/update_inner_join/db/models.go +++ b/internal/endtoend/testdata/update_inner_join/db/models.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 3c66535681..e214c2599e 100644 --- a/internal/endtoend/testdata/update_inner_join/db/query.sql.go +++ b/internal/endtoend/testdata/update_inner_join/db/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_inner_join/query.sql b/internal/endtoend/testdata/update_inner_join/query.sql index 003a814986..2e88d46ca2 100644 --- a/internal/endtoend/testdata/update_inner_join/query.sql +++ b/internal/endtoend/testdata/update_inner_join/query.sql @@ -1,12 +1,2 @@ -CREATE TABLE x ( - a text, - b text -); - -CREATE TABLE y ( - a text, - b text -); - -- name: UpdateXWithY :exec UPDATE x INNER JOIN y ON y.a = x.a SET x.b = y.b; diff --git a/internal/endtoend/testdata/update_inner_join/schema.sql b/internal/endtoend/testdata/update_inner_join/schema.sql new file mode 100644 index 0000000000..d8c6d8de5e --- /dev/null +++ b/internal/endtoend/testdata/update_inner_join/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE x ( + a text, + b text +); + +CREATE TABLE y ( + a text, + b text +); + diff --git a/internal/endtoend/testdata/update_inner_join/sqlc.json b/internal/endtoend/testdata/update_inner_join/sqlc.json index 72d8821559..32a13d6fc6 100644 --- a/internal/endtoend/testdata/update_inner_join/sqlc.json +++ b/internal/endtoend/testdata/update_inner_join/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_join/mysql/db/db.go b/internal/endtoend/testdata/update_join/mysql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_join/mysql/db/models.go b/internal/endtoend/testdata/update_join/mysql/db/models.go new file mode 100644 index 0000000000..ebf0df7b7b --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type JoinTable struct { + ID uint64 + PrimaryTableID uint64 + OtherTableID uint64 + IsActive bool +} + +type PrimaryTable struct { + ID uint64 + UserID 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 new file mode 100644 index 0000000000..3d27f3eb47 --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const updateJoin = `-- name: UpdateJoin :exec +UPDATE join_table as jt + JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ? +` + +type UpdateJoinParams struct { + IsActive bool + ID uint64 + UserID uint64 +} + +func (q *Queries) UpdateJoin(ctx context.Context, arg UpdateJoinParams) error { + _, err := q.db.ExecContext(ctx, updateJoin, arg.IsActive, arg.ID, arg.UserID) + return err +} + +const updateLeftJoin = `-- name: UpdateLeftJoin :exec +UPDATE join_table as jt + LEFT JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ? +` + +type UpdateLeftJoinParams struct { + IsActive bool + ID uint64 + UserID uint64 +} + +func (q *Queries) UpdateLeftJoin(ctx context.Context, arg UpdateLeftJoinParams) error { + _, err := q.db.ExecContext(ctx, updateLeftJoin, arg.IsActive, arg.ID, arg.UserID) + return err +} + +const updateRightJoin = `-- name: UpdateRightJoin :exec +UPDATE join_table as jt + RIGHT JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ? +` + +type UpdateRightJoinParams struct { + IsActive bool + ID uint64 + UserID uint64 +} + +func (q *Queries) UpdateRightJoin(ctx context.Context, arg UpdateRightJoinParams) error { + _, err := q.db.ExecContext(ctx, updateRightJoin, arg.IsActive, arg.ID, arg.UserID) + return err +} diff --git a/internal/endtoend/testdata/update_join/mysql/query.sql b/internal/endtoend/testdata/update_join/mysql/query.sql new file mode 100644 index 0000000000..cf7cf36f54 --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/query.sql @@ -0,0 +1,23 @@ +-- name: UpdateJoin :exec +UPDATE join_table as jt + JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ?; + +-- name: UpdateLeftJoin :exec +UPDATE join_table as jt + LEFT JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ?; + +-- name: UpdateRightJoin :exec +UPDATE join_table as jt + RIGHT JOIN primary_table as pt + ON jt.primary_table_id = pt.id +SET jt.is_active = ? +WHERE jt.id = ? + AND pt.user_id = ?; diff --git a/internal/endtoend/testdata/update_join/mysql/schema.sql b/internal/endtoend/testdata/update_join/mysql/schema.sql new file mode 100644 index 0000000000..89d517e184 --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE primary_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + user_id bigint(20) unsigned NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE join_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + primary_table_id bigint(20) unsigned NOT NULL, + other_table_id bigint(20) unsigned NOT NULL, + is_active tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/update_join/mysql/sqlc.json b/internal/endtoend/testdata/update_join/mysql/sqlc.json new file mode 100644 index 0000000000..421770653f --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "mysql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/update_join/postgresql/db/db.go b/internal/endtoend/testdata/update_join/postgresql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_join/postgresql/db/models.go b/internal/endtoend/testdata/update_join/postgresql/db/models.go new file mode 100644 index 0000000000..0e93ad23ba --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type JoinTable struct { + ID int32 + PrimaryTableID int32 + OtherTableID int32 + IsActive bool +} + +type PrimaryTable struct { + ID int32 + UserID 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 new file mode 100644 index 0000000000..f1da19118a --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const updateJoin = `-- name: UpdateJoin :exec +UPDATE join_table +SET is_active = $1 +FROM primary_table +WHERE join_table.id = $2 + AND primary_table.user_id = $3 + AND join_table.primary_table_id = primary_table.id +` + +type UpdateJoinParams struct { + IsActive bool + ID int32 + UserID int32 +} + +func (q *Queries) UpdateJoin(ctx context.Context, arg UpdateJoinParams) error { + _, err := q.db.ExecContext(ctx, updateJoin, arg.IsActive, arg.ID, arg.UserID) + return err +} diff --git a/internal/endtoend/testdata/update_join/postgresql/query.sql b/internal/endtoend/testdata/update_join/postgresql/query.sql new file mode 100644 index 0000000000..57bfb22f6f --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/query.sql @@ -0,0 +1,7 @@ +-- name: UpdateJoin :exec +UPDATE join_table +SET is_active = $1 +FROM primary_table +WHERE join_table.id = $2 + AND primary_table.user_id = $3 + AND join_table.primary_table_id = primary_table.id; diff --git a/internal/endtoend/testdata/update_join/postgresql/schema.sql b/internal/endtoend/testdata/update_join/postgresql/schema.sql new file mode 100644 index 0000000000..49e27f84c1 --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE primary_table ( + id INT PRIMARY KEY, + user_id INT NOT NULL +); + +CREATE TABLE join_table ( + id INT PRIMARY KEY, + primary_table_id INT NOT NULL, + other_table_id INT NOT NULL, + is_active BOOLEAN NOT NULL +); + diff --git a/internal/endtoend/testdata/update_join/postgresql/sqlc.json b/internal/endtoend/testdata/update_join/postgresql/sqlc.json new file mode 100644 index 0000000000..ba0fc2454c --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/update_set/myql/go/db.go b/internal/endtoend/testdata/update_set/myql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set/myql/go/db.go +++ b/internal/endtoend/testdata/update_set/myql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/myql/go/models.go b/internal/endtoend/testdata/update_set/myql/go/models.go index 1484d8fc4e..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/myql/go/models.go +++ b/internal/endtoend/testdata/update_set/myql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 b42c977b1e..99f8a5cbad 100644 --- a/internal/endtoend/testdata/update_set/myql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/myql/go/query.sql.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/myql/query.sql b/internal/endtoend/testdata/update_set/myql/query.sql index 5b2fb0e625..0f6603f503 100644 --- a/internal/endtoend/testdata/update_set/myql/query.sql +++ b/internal/endtoend/testdata/update_set/myql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - /* name: UpdateSet :exec */ UPDATE foo SET name = ? WHERE slug = ?; diff --git a/internal/endtoend/testdata/update_set/myql/schema.sql b/internal/endtoend/testdata/update_set/myql/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/myql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/myql/sqlc.json b/internal/endtoend/testdata/update_set/myql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/update_set/myql/sqlc.json +++ b/internal/endtoend/testdata/update_set/myql/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/update_set/postgresql/go/db.go b/internal/endtoend/testdata/update_set/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/update_set/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/update_set/postgresql/go/models.go b/internal/endtoend/testdata/update_set/postgresql/go/models.go deleted file mode 100644 index 1484d8fc4e..0000000000 --- a/internal/endtoend/testdata/update_set/postgresql/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Name string - Slug string -} diff --git a/internal/endtoend/testdata/update_set/postgresql/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/go/query.sql.go deleted file mode 100644 index 75a004e48e..0000000000 --- a/internal/endtoend/testdata/update_set/postgresql/go/query.sql.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const updateSet = `-- name: UpdateSet :exec -UPDATE foo SET name = $2 WHERE slug = $1 -` - -type UpdateSetParams struct { - Slug string - Name string -} - -func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.ExecContext(ctx, updateSet, arg.Slug, arg.Name) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_set/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..a392f8a4d3 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSet = `-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1 +` + +type UpdateSetParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { + _, err := q.db.Exec(ctx, updateSet, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..a41419840f --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_set/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..a392f8a4d3 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSet = `-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1 +` + +type UpdateSetParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { + _, err := q.db.Exec(ctx, updateSet, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..a41419840f --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/update_set/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/update_set/postgresql/query.sql b/internal/endtoend/testdata/update_set/postgresql/query.sql deleted file mode 100644 index 94e2f11c1d..0000000000 --- a/internal/endtoend/testdata/update_set/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (name text not null, slug text not null); - --- name: UpdateSet :exec -UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/sqlc.json deleted file mode 100644 index de427d069f..0000000000 --- a/internal/endtoend/testdata/update_set/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "engine": "postgresql", - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_set/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..bc6bce3952 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSet = `-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1 +` + +type UpdateSetParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { + _, err := q.db.ExecContext(ctx, updateSet, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql b/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..a41419840f --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSet :exec +UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/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/update_set/sqlite/go/db.go b/internal/endtoend/testdata/update_set/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_set/sqlite/go/models.go b/internal/endtoend/testdata/update_set/sqlite/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..99f8a5cbad --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSet = `-- name: UpdateSet :exec +UPDATE foo SET name = ? WHERE slug = ? +` + +type UpdateSetParams struct { + Name string + Slug string +} + +func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { + _, err := q.db.ExecContext(ctx, updateSet, arg.Name, arg.Slug) + return err +} diff --git a/internal/endtoend/testdata/update_set/sqlite/query.sql b/internal/endtoend/testdata/update_set/sqlite/query.sql new file mode 100644 index 0000000000..0f6603f503 --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/query.sql @@ -0,0 +1,2 @@ +/* name: UpdateSet :exec */ +UPDATE foo SET name = ? WHERE slug = ?; diff --git a/internal/endtoend/testdata/update_set/sqlite/schema.sql b/internal/endtoend/testdata/update_set/sqlite/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/sqlite/sqlc.json b/internal/endtoend/testdata/update_set/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/update_set/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/update_set_multiple/mysql/go/db.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go index 6a99519302..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package querytest 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 1484d8fc4e..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go @@ -1,9 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 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 af27efbe7f..7337a63ee1 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,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/query.sql b/internal/endtoend/testdata/update_set_multiple/mysql/query.sql index a049f90c05..4ea1be4cfc 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET name = ?, slug = ?; diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql b/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json b/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/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/update_set_multiple/postgresql/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/go/db.go deleted file mode 100644 index 6a99519302..0000000000 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/go/db.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import ( - "context" - "database/sql" -) - -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 -} - -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/update_set_multiple/postgresql/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/go/models.go deleted file mode 100644 index 1484d8fc4e..0000000000 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/go/models.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. - -package querytest - -import () - -type Foo struct { - Name string - Slug string -} diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/go/query.sql.go deleted file mode 100644 index c51bd8ddc3..0000000000 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/go/query.sql.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// source: query.sql - -package querytest - -import ( - "context" -) - -const updateSetMultiple = `-- name: UpdateSetMultiple :exec -UPDATE foo SET (name, slug) = ($2, $1) -` - -type UpdateSetMultipleParams struct { - Slug string - Name string -} - -func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Slug, arg.Name) - return err -} 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 new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) 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_set_multiple/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..80f80a3d4d --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSetMultiple = `-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1) +` + +type UpdateSetMultipleParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { + _, err := q.db.Exec(ctx, updateSetMultiple, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..c5e471fd1b --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "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 +} + +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_set_multiple/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..80f80a3d4d --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSetMultiple = `-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1) +` + +type UpdateSetMultipleParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { + _, err := q.db.Exec(ctx, updateSetMultiple, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..c5e471fd1b --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/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/update_set_multiple/postgresql/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/query.sql deleted file mode 100644 index fcb6b24415..0000000000 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (name text not null, slug text not null); - --- name: UpdateSetMultiple :exec -UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/sqlc.json deleted file mode 100644 index c72b6132d5..0000000000 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/sqlc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_set_multiple/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..10dc784a4c --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSetMultiple = `-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1) +` + +type UpdateSetMultipleParams struct { + Slug string + Name string +} + +func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { + _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Slug, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..c5e471fd1b --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSetMultiple :exec +UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/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/update_set_multiple/sqlite/go/db.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_set_multiple/sqlite/go/models.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go new file mode 100644 index 0000000000..ee2c5c5577 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..7337a63ee1 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateSetMultiple = `-- name: UpdateSetMultiple :exec +UPDATE foo SET name = ?, slug = ? +` + +type UpdateSetMultipleParams struct { + Name string + Slug string +} + +func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { + _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Name, arg.Slug) + return err +} diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql b/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql new file mode 100644 index 0000000000..4ea1be4cfc --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: UpdateSetMultiple :exec +UPDATE foo SET name = ?, slug = ?; diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql b/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json b/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json new file mode 100644 index 0000000000..d4963e751f --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/issue.md b/internal/endtoend/testdata/update_set_on_conflict/issue.md new file mode 100644 index 0000000000..27f06c09ab --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1128 \ No newline at end of file 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 new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..3f9e9d9b86 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- 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 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 new file mode 100644 index 0000000000..3ff1ccd6b3 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE servers ( + code varchar PRIMARY KEY, + name text NOT NULL +); \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/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" \ No newline at end of file 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 new file mode 100644 index 0000000000..adbb13a418 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:15: column "name_typo" of relation "servers" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/db.go b/internal/endtoend/testdata/update_two_table/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/update_two_table/mysql/go/models.go b/internal/endtoend/testdata/update_two_table/mysql/go/models.go new file mode 100644 index 0000000000..9caf3b15cb --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "time" +) + +type Author struct { + Name string + DeletedAt time.Time + CreatedAt time.Time + UpdatedAt time.Time +} + +type Book struct { + IsAmazing bool + DeletedAt time.Time + CreatedAt time.Time + UpdatedAt time.Time +} 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 new file mode 100644 index 0000000000..2415782612 --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteAuthor = `-- name: DeleteAuthor :exec +UPDATE + authors, + books +SET + authors.deleted_at = now(), + books.deleted_at = now() +WHERE + books.is_amazing = 1 + AND authors.name = ? +` + +func (q *Queries) DeleteAuthor(ctx context.Context, name string) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, name) + return err +} diff --git a/internal/endtoend/testdata/update_two_table/mysql/query.sql b/internal/endtoend/testdata/update_two_table/mysql/query.sql new file mode 100644 index 0000000000..3f5c5de63a --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/query.sql @@ -0,0 +1,10 @@ +-- name: DeleteAuthor :exec +UPDATE + authors, + books +SET + authors.deleted_at = now(), + books.deleted_at = now() +WHERE + books.is_amazing = 1 + AND authors.name = sqlc.arg(name); \ No newline at end of file diff --git a/internal/endtoend/testdata/update_two_table/mysql/schema.sql b/internal/endtoend/testdata/update_two_table/mysql/schema.sql new file mode 100644 index 0000000000..ae7e76111c --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/schema.sql @@ -0,0 +1,15 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1590 +CREATE TABLE authors ( + name text NOT NULL, + deleted_at datetime NOT NULL, + created_at datetime NOT NULL, + updated_at datetime NOT NULL +); + +CREATE TABLE books ( + is_amazing tinyint(1) NOT NULL, + deleted_at datetime NOT NULL, + created_at datetime NOT NULL, + updated_at datetime NOT NULL +); + diff --git a/internal/endtoend/testdata/update_two_table/mysql/sqlc.json b/internal/endtoend/testdata/update_two_table/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/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/upsert/sqlite/go/db.go b/internal/endtoend/testdata/upsert/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/upsert/sqlite/go/models.go b/internal/endtoend/testdata/upsert/sqlite/go/models.go new file mode 100644 index 0000000000..87f7059062 --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Location struct { + ID int64 + Name string + Address string + ZipCode int64 + Latitude float64 + Longitude float64 +} diff --git a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go new file mode 100644 index 0000000000..36115f665b --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const upsertLocation = `-- name: UpsertLocation :exec +INSERT INTO locations ( + 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 +` + +type UpsertLocationParams struct { + Name string + Address string + ZipCode int64 + Latitude float64 + Longitude float64 +} + +func (q *Queries) UpsertLocation(ctx context.Context, arg UpsertLocationParams) error { + _, err := q.db.ExecContext(ctx, upsertLocation, + arg.Name, + arg.Address, + arg.ZipCode, + arg.Latitude, + arg.Longitude, + ) + return err +} diff --git a/internal/endtoend/testdata/upsert/sqlite/query.sql b/internal/endtoend/testdata/upsert/sqlite/query.sql new file mode 100644 index 0000000000..c34d70b407 --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/query.sql @@ -0,0 +1,15 @@ +/* name: UpsertLocation :exec */ +INSERT INTO locations ( + 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; diff --git a/internal/endtoend/testdata/upsert/sqlite/schema.sql b/internal/endtoend/testdata/upsert/sqlite/schema.sql new file mode 100644 index 0000000000..0ed6d048e5 --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1728 + +CREATE TABLE IF NOT EXISTS locations ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + address TEXT NOT NULL, + zip_code INT NOT NULL, + latitude REAL NOT NULL, + longitude REAL NOT NULL, + UNIQUE(name) +); + diff --git a/internal/endtoend/testdata/upsert/sqlite/sqlc.json b/internal/endtoend/testdata/upsert/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/upsert/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/valid_group_by_reference/mysql/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/valid_group_by_reference/mysql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go new file mode 100644 index 0000000000..55aeb10d28 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type WeatherMetric struct { + Time time.Time + TimezoneShift sql.NullInt32 + CityName sql.NullString + TempC sql.NullFloat64 + FeelsLikeC sql.NullFloat64 + TempMinC sql.NullFloat64 + TempMaxC sql.NullFloat64 + PressureHpa sql.NullFloat64 + HumidityPercent sql.NullFloat64 + WindSpeedMs sql.NullFloat64 + WindDeg sql.NullInt32 + Rain1hMm sql.NullFloat64 + Rain3hMm sql.NullFloat64 + Snow1hMm sql.NullFloat64 + Snow3hMm sql.NullFloat64 + CloudsPercent sql.NullInt32 + WeatherTypeID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..4c1efd763e --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go @@ -0,0 +1,112 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name as full_name, bio +FROM authors +GROUP BY full_name +` + +type ListAuthorsRow struct { + ID int64 + FullName string + Bio sql.NullString +} + +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.FullName, &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 listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors +GROUP BY name +` + +func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + 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 listMetrics = `-- name: ListMetrics :many +SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE DATE_SUB(NOW(), INTERVAL 6 MONTH) +GROUP BY bucket, city_name +ORDER BY bucket DESC +` + +type ListMetricsRow struct { + Bucket interface{} + CityName sql.NullString + Avg interface{} +} + +func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { + rows, err := q.db.QueryContext(ctx, listMetrics) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListMetricsRow + for rows.Next() { + var i ListMetricsRow + if err := rows.Scan(&i.Bucket, &i.CityName, &i.Avg); 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/valid_group_by_reference/mysql/query.sql b/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql new file mode 100644 index 0000000000..9776cb058b --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql @@ -0,0 +1,16 @@ +-- name: ListAuthors :many +SELECT id, name as full_name, bio +FROM authors +GROUP BY full_name; + +-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors +GROUP BY name; + +-- name: ListMetrics :many +SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE DATE_SUB(NOW(), INTERVAL 6 MONTH) +GROUP BY bucket, city_name +ORDER BY bucket DESC; diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql new file mode 100644 index 0000000000..db03e0d24a --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(10) NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c FLOAT NULL, + feels_like_c FLOAT NULL, + temp_min_c FLOAT NULL, + temp_max_c FLOAT NULL, + pressure_hpa FLOAT NULL, + humidity_percent FLOAT NULL, + wind_speed_ms FLOAT NULL, + wind_deg INT NULL, + rain_1h_mm FLOAT NULL, + rain_3h_mm FLOAT NULL, + snow_1h_mm FLOAT NULL, + snow_3h_mm FLOAT NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json new file mode 100644 index 0000000000..0390f67889 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/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/valid_group_by_reference/pganalyzer/exec.json b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/valid_group_by_reference/pganalyzer/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go new file mode 100644 index 0000000000..55aeb10d28 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type WeatherMetric struct { + Time time.Time + TimezoneShift sql.NullInt32 + CityName sql.NullString + TempC sql.NullFloat64 + FeelsLikeC sql.NullFloat64 + TempMinC sql.NullFloat64 + TempMaxC sql.NullFloat64 + PressureHpa sql.NullFloat64 + HumidityPercent sql.NullFloat64 + WindSpeedMs sql.NullFloat64 + WindDeg sql.NullInt32 + Rain1hMm sql.NullFloat64 + Rain3hMm sql.NullFloat64 + Snow1hMm sql.NullFloat64 + Snow3hMm sql.NullFloat64 + CloudsPercent sql.NullInt32 + WeatherTypeID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..def227c020 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go @@ -0,0 +1,105 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors +` + +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 +} + +const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors +` + +func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + 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 listMetrics = `-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC +` + +type ListMetricsRow struct { + Bucket time.Time + CityName sql.NullString + Avg float64 +} + +func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { + rows, err := q.db.QueryContext(ctx, listMetrics) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListMetricsRow + for rows.Next() { + var i ListMetricsRow + if err := rows.Scan(&i.Bucket, &i.CityName, &i.Avg); 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/valid_group_by_reference/pganalyzer/query.sql b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/query.sql new file mode 100644 index 0000000000..839f5414c9 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/query.sql @@ -0,0 +1,14 @@ +-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC; diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql new file mode 100644 index 0000000000..910e1da151 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP WITHOUT TIME ZONE NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c DOUBLE PRECISION NULL, + feels_like_c DOUBLE PRECISION NULL, + temp_min_c DOUBLE PRECISION NULL, + temp_max_c DOUBLE PRECISION NULL, + pressure_hpa DOUBLE PRECISION NULL, + humidity_percent DOUBLE PRECISION NULL, + wind_speed_ms DOUBLE PRECISION NULL, + wind_deg INT NULL, + rain_1h_mm DOUBLE PRECISION NULL, + rain_3h_mm DOUBLE PRECISION NULL, + snow_1h_mm DOUBLE PRECISION NULL, + snow_3h_mm DOUBLE PRECISION NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/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/valid_group_by_reference/postgresql/exec.json b/internal/endtoend/testdata/valid_group_by_reference/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/valid_group_by_reference/postgresql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go new file mode 100644 index 0000000000..55aeb10d28 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type WeatherMetric struct { + Time time.Time + TimezoneShift sql.NullInt32 + CityName sql.NullString + TempC sql.NullFloat64 + FeelsLikeC sql.NullFloat64 + TempMinC sql.NullFloat64 + TempMaxC sql.NullFloat64 + PressureHpa sql.NullFloat64 + HumidityPercent sql.NullFloat64 + WindSpeedMs sql.NullFloat64 + WindDeg sql.NullInt32 + Rain1hMm sql.NullFloat64 + Rain3hMm sql.NullFloat64 + Snow1hMm sql.NullFloat64 + Snow3hMm sql.NullFloat64 + CloudsPercent sql.NullInt32 + WeatherTypeID sql.NullInt32 +} 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 new file mode 100644 index 0000000000..07e773a507 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go @@ -0,0 +1,104 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors +` + +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 +} + +const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors +` + +func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + 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 listMetrics = `-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC +` + +type ListMetricsRow struct { + Bucket int64 + CityName sql.NullString + Avg float64 +} + +func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { + rows, err := q.db.QueryContext(ctx, listMetrics) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListMetricsRow + for rows.Next() { + var i ListMetricsRow + if err := rows.Scan(&i.Bucket, &i.CityName, &i.Avg); 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/valid_group_by_reference/postgresql/query.sql b/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql new file mode 100644 index 0000000000..839f5414c9 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql @@ -0,0 +1,14 @@ +-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC; diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql new file mode 100644 index 0000000000..910e1da151 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP WITHOUT TIME ZONE NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c DOUBLE PRECISION NULL, + feels_like_c DOUBLE PRECISION NULL, + temp_min_c DOUBLE PRECISION NULL, + temp_max_c DOUBLE PRECISION NULL, + pressure_hpa DOUBLE PRECISION NULL, + humidity_percent DOUBLE PRECISION NULL, + wind_speed_ms DOUBLE PRECISION NULL, + wind_deg INT NULL, + rain_1h_mm DOUBLE PRECISION NULL, + rain_3h_mm DOUBLE PRECISION NULL, + snow_1h_mm DOUBLE PRECISION NULL, + snow_3h_mm DOUBLE PRECISION NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/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/vet_disable/exec.json b/internal/endtoend/testdata/vet_disable/exec.json new file mode 100644 index 0000000000..07753636ee --- /dev/null +++ b/internal/endtoend/testdata/vet_disable/exec.json @@ -0,0 +1,3 @@ +{ + "command": "vet" +} diff --git a/internal/endtoend/testdata/vet_disable/query.sql b/internal/endtoend/testdata/vet_disable/query.sql new file mode 100644 index 0000000000..50052de26b --- /dev/null +++ b/internal/endtoend/testdata/vet_disable/query.sql @@ -0,0 +1,29 @@ +-- name: RunVetAll :exec +SELECT true; + +-- name: SkipVetAll :exec +-- @sqlc-vet-disable +SELECT true; + +-- 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 new file mode 100644 index 0000000000..1e53bd7f2f --- /dev/null +++ b/internal/endtoend/testdata/vet_disable/sqlc.yaml @@ -0,0 +1,21 @@ +version: 2 +sql: + - schema: "query.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "db" + 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 new file mode 100644 index 0000000000..3d9a6169f8 --- /dev/null +++ b/internal/endtoend/testdata/vet_disable/stderr.txt @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000000..f2c0982087 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package test + +import ( + "context" + "database/sql" +) + +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 +} + +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/vet_explain/mysql/db/models.go b/internal/endtoend/testdata/vet_explain/mysql/db/models.go new file mode 100644 index 0000000000..09b57f3649 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/db/models.go @@ -0,0 +1,137 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package test + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + "time" +) + +type DebugCenum string + +const ( + DebugCenumOne DebugCenum = "one" + DebugCenumTwo DebugCenum = "two" + DebugCenumThree DebugCenum = "three" +) + +func (e *DebugCenum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = DebugCenum(s) + case string: + *e = DebugCenum(s) + default: + return fmt.Errorf("unsupported scan type for DebugCenum: %T", src) + } + return nil +} + +type NullDebugCenum struct { + DebugCenum DebugCenum + Valid bool // Valid is true if DebugCenum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullDebugCenum) Scan(value interface{}) error { + if value == nil { + ns.DebugCenum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.DebugCenum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullDebugCenum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.DebugCenum), nil +} + +type DebugCset string + +const ( + DebugCsetOne DebugCset = "one" + DebugCsetTwo DebugCset = "two" + DebugCsetThree DebugCset = "three" +) + +func (e *DebugCset) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = DebugCset(s) + case string: + *e = DebugCset(s) + default: + return fmt.Errorf("unsupported scan type for DebugCset: %T", src) + } + return nil +} + +type NullDebugCset struct { + DebugCset DebugCset + Valid bool // Valid is true if DebugCset is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullDebugCset) Scan(value interface{}) error { + if value == nil { + ns.DebugCset, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.DebugCset.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullDebugCset) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.DebugCset), nil +} + +type Debug struct { + ID int64 + Csmallint int16 + Cint int32 + Cinteger int32 + Cdecimal string + Cnumeric string + Cfloat float64 + Creal float64 + Cdoubleprecision float64 + Cdouble float64 + Cdec string + Cfixed string + Ctinyint int8 + Cbool bool + Cmediumint int32 + Cbit interface{} + Cdate time.Time + Cdatetime time.Time + Ctimestamp time.Time + Ctime time.Time + Cyear int16 + Cchar string + Cvarchar string + Cbinary []byte + Cvarbinary []byte + Ctinyblob []byte + Cblob []byte + Cmediumblob []byte + Clongblob []byte + Ctinytext string + Ctext string + Cmediumtext string + Clongtext string + Cenum NullDebugCenum + Cset DebugCset + Cjson json.RawMessage +} diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go new file mode 100644 index 0000000000..cef6fbff90 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go @@ -0,0 +1,443 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package test + +import ( + "context" + "encoding/json" + "time" +) + +const selectByCbinary = `-- name: SelectByCbinary :one +SELECT id FROM debug +WHERE Cbinary = ? LIMIT 1 +` + +func (q *Queries) SelectByCbinary(ctx context.Context, cbinary []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCbinary, cbinary) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCbit = `-- name: SelectByCbit :one +SELECT id FROM debug +WHERE Cbit = ? LIMIT 1 +` + +func (q *Queries) SelectByCbit(ctx context.Context, cbit interface{}) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCbit, cbit) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCblob = `-- name: SelectByCblob :one +SELECT id FROM debug +WHERE Cblob = ? LIMIT 1 +` + +func (q *Queries) SelectByCblob(ctx context.Context, cblob []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCblob, cblob) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCbool = `-- name: SelectByCbool :one +SELECT id FROM debug +WHERE Cbool = ? LIMIT 1 +` + +func (q *Queries) SelectByCbool(ctx context.Context, cbool bool) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCbool, cbool) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCchar = `-- name: SelectByCchar :one +SELECT id FROM debug +WHERE Cchar = ? LIMIT 1 +` + +func (q *Queries) SelectByCchar(ctx context.Context, cchar string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCchar, cchar) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdate = `-- name: SelectByCdate :one +SELECT id FROM debug +WHERE Cdate = ? LIMIT 1 +` + +func (q *Queries) SelectByCdate(ctx context.Context, cdate time.Time) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdate, cdate) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdatetime = `-- name: SelectByCdatetime :one +SELECT id FROM debug +WHERE Cdatetime = ? LIMIT 1 +` + +func (q *Queries) SelectByCdatetime(ctx context.Context, cdatetime time.Time) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdatetime, cdatetime) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdec = `-- name: SelectByCdec :one +SELECT id FROM debug +WHERE Cdec = ? LIMIT 1 +` + +func (q *Queries) SelectByCdec(ctx context.Context, cdec string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdec, cdec) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdecimal = `-- name: SelectByCdecimal :one +SELECT id FROM debug +WHERE Cdecimal = ? LIMIT 1 +` + +func (q *Queries) SelectByCdecimal(ctx context.Context, cdecimal string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdecimal, cdecimal) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdouble = `-- name: SelectByCdouble :one +SELECT id FROM debug +WHERE Cdouble = ? LIMIT 1 +` + +func (q *Queries) SelectByCdouble(ctx context.Context, cdouble float64) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdouble, cdouble) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCdoubleprecision = `-- name: SelectByCdoubleprecision :one +SELECT id FROM debug +WHERE Cdoubleprecision = ? LIMIT 1 +` + +func (q *Queries) SelectByCdoubleprecision(ctx context.Context, cdoubleprecision float64) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCdoubleprecision, cdoubleprecision) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCenum = `-- name: SelectByCenum :one +SELECT id FROM debug +WHERE Cenum = ? LIMIT 1 +` + +func (q *Queries) SelectByCenum(ctx context.Context, cenum NullDebugCenum) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCenum, cenum) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCfixed = `-- name: SelectByCfixed :one +SELECT id FROM debug +WHERE Cfixed = ? LIMIT 1 +` + +func (q *Queries) SelectByCfixed(ctx context.Context, cfixed string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCfixed, cfixed) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCfloat = `-- name: SelectByCfloat :one +SELECT id FROM debug +WHERE Cfloat = ? LIMIT 1 +` + +func (q *Queries) SelectByCfloat(ctx context.Context, cfloat float64) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCfloat, cfloat) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCint = `-- name: SelectByCint :one +SELECT id FROM debug +WHERE Cint = ? LIMIT 1 +` + +func (q *Queries) SelectByCint(ctx context.Context, cint int32) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCint, cint) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCinteger = `-- name: SelectByCinteger :one +SELECT id FROM debug +WHERE Cinteger = ? LIMIT 1 +` + +func (q *Queries) SelectByCinteger(ctx context.Context, cinteger int32) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCinteger, cinteger) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCjson = `-- name: SelectByCjson :one +SELECT id FROM debug +WHERE Cjson = ? LIMIT 1 +` + +func (q *Queries) SelectByCjson(ctx context.Context, cjson json.RawMessage) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCjson, cjson) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByClongblob = `-- name: SelectByClongblob :one +SELECT id FROM debug +WHERE Clongblob = ? LIMIT 1 +` + +func (q *Queries) SelectByClongblob(ctx context.Context, clongblob []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByClongblob, clongblob) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByClongtext = `-- name: SelectByClongtext :one +SELECT id FROM debug +WHERE Clongtext = ? LIMIT 1 +` + +func (q *Queries) SelectByClongtext(ctx context.Context, clongtext string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByClongtext, clongtext) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCmediumblob = `-- name: SelectByCmediumblob :one +SELECT id FROM debug +WHERE Cmediumblob = ? LIMIT 1 +` + +func (q *Queries) SelectByCmediumblob(ctx context.Context, cmediumblob []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCmediumblob, cmediumblob) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCmediumint = `-- name: SelectByCmediumint :one +SELECT id FROM debug +WHERE Cmediumint = ? LIMIT 1 +` + +func (q *Queries) SelectByCmediumint(ctx context.Context, cmediumint int32) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCmediumint, cmediumint) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCmediumtext = `-- name: SelectByCmediumtext :one +SELECT id FROM debug +WHERE Cmediumtext = ? LIMIT 1 +` + +func (q *Queries) SelectByCmediumtext(ctx context.Context, cmediumtext string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCmediumtext, cmediumtext) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCnumeric = `-- name: SelectByCnumeric :one +SELECT id FROM debug +WHERE Cnumeric = ? LIMIT 1 +` + +func (q *Queries) SelectByCnumeric(ctx context.Context, cnumeric string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCnumeric, cnumeric) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCreal = `-- name: SelectByCreal :one +SELECT id FROM debug +WHERE Creal = ? LIMIT 1 +` + +func (q *Queries) SelectByCreal(ctx context.Context, creal float64) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCreal, creal) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCset = `-- name: SelectByCset :one +SELECT id FROM debug +WHERE Cset = ? LIMIT 1 +` + +func (q *Queries) SelectByCset(ctx context.Context, cset DebugCset) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCset, cset) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCsmallint = `-- name: SelectByCsmallint :one +SELECT id FROM debug +WHERE Csmallint = ? LIMIT 1 +` + +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) + return id, err +} + +const selectByCtext = `-- name: SelectByCtext :one +SELECT id FROM debug +WHERE Ctext = ? LIMIT 1 +` + +func (q *Queries) SelectByCtext(ctx context.Context, ctext string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCtext, ctext) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCtime = `-- name: SelectByCtime :one +SELECT id FROM debug +WHERE Ctime = ? LIMIT 1 +` + +func (q *Queries) SelectByCtime(ctx context.Context, ctime time.Time) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCtime, ctime) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCtimestamp = `-- name: SelectByCtimestamp :one +SELECT id FROM debug +WHERE Ctimestamp = ? LIMIT 1 +` + +func (q *Queries) SelectByCtimestamp(ctx context.Context, ctimestamp time.Time) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCtimestamp, ctimestamp) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCtinyblob = `-- name: SelectByCtinyblob :one +SELECT id FROM debug +WHERE Ctinyblob = ? LIMIT 1 +` + +func (q *Queries) SelectByCtinyblob(ctx context.Context, ctinyblob []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCtinyblob, ctinyblob) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCtinyint = `-- name: SelectByCtinyint :one +SELECT id FROM debug +WHERE Ctinyint = ? LIMIT 1 +` + +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) + return id, err +} + +const selectByCtinytext = `-- name: SelectByCtinytext :one +SELECT id FROM debug +WHERE Ctinytext = ? LIMIT 1 +` + +func (q *Queries) SelectByCtinytext(ctx context.Context, ctinytext string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCtinytext, ctinytext) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCvarbinary = `-- name: SelectByCvarbinary :one +SELECT id FROM debug +WHERE Cvarbinary = ? LIMIT 1 +` + +func (q *Queries) SelectByCvarbinary(ctx context.Context, cvarbinary []byte) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCvarbinary, cvarbinary) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCvarchar = `-- name: SelectByCvarchar :one +SELECT id FROM debug +WHERE Cvarchar = ? LIMIT 1 +` + +func (q *Queries) SelectByCvarchar(ctx context.Context, cvarchar string) (int64, error) { + row := q.db.QueryRowContext(ctx, selectByCvarchar, cvarchar) + var id int64 + err := row.Scan(&id) + return id, err +} + +const selectByCyear = `-- name: SelectByCyear :one +SELECT id FROM debug +WHERE Cyear = ? LIMIT 1 +` + +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) + return id, err +} + +const selectById = `-- name: SelectById :one +SELECT id FROM debug +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 +} diff --git a/internal/endtoend/testdata/vet_explain/mysql/query.sql b/internal/endtoend/testdata/vet_explain/mysql/query.sql new file mode 100644 index 0000000000..9712dd7478 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/query.sql @@ -0,0 +1,290 @@ +-- name: SelectById :one +SELECT id FROM debug +WHERE id = ? LIMIT 1; + +-- name: SelectByCsmallint :one +SELECT id FROM debug +WHERE Csmallint = ? LIMIT 1; + +-- name: SelectByCint :one +SELECT id FROM debug +WHERE Cint = ? LIMIT 1; + +-- name: SelectByCinteger :one +SELECT id FROM debug +WHERE Cinteger = ? LIMIT 1; + +-- name: SelectByCdecimal :one +SELECT id FROM debug +WHERE Cdecimal = ? LIMIT 1; + +-- name: SelectByCnumeric :one +SELECT id FROM debug +WHERE Cnumeric = ? LIMIT 1; + +-- name: SelectByCfloat :one +SELECT id FROM debug +WHERE Cfloat = ? LIMIT 1; + +-- name: SelectByCreal :one +SELECT id FROM debug +WHERE Creal = ? LIMIT 1; + +-- name: SelectByCdoubleprecision :one +SELECT id FROM debug +WHERE Cdoubleprecision = ? LIMIT 1; + +-- name: SelectByCdouble :one +SELECT id FROM debug +WHERE Cdouble = ? LIMIT 1; + +-- name: SelectByCdec :one +SELECT id FROM debug +WHERE Cdec = ? LIMIT 1; + +-- name: SelectByCfixed :one +SELECT id FROM debug +WHERE Cfixed = ? LIMIT 1; + +-- name: SelectByCtinyint :one +SELECT id FROM debug +WHERE Ctinyint = ? LIMIT 1; + +-- name: SelectByCbool :one +SELECT id FROM debug +WHERE Cbool = ? LIMIT 1; + +-- name: SelectByCmediumint :one +SELECT id FROM debug +WHERE Cmediumint = ? LIMIT 1; + +-- name: SelectByCbit :one +SELECT id FROM debug +WHERE Cbit = ? LIMIT 1; + +-- name: SelectByCdate :one +SELECT id FROM debug +WHERE Cdate = ? LIMIT 1; + +-- name: SelectByCdatetime :one +SELECT id FROM debug +WHERE Cdatetime = ? LIMIT 1; + +-- name: SelectByCtimestamp :one +SELECT id FROM debug +WHERE Ctimestamp = ? LIMIT 1; + +-- name: SelectByCtime :one +SELECT id FROM debug +WHERE Ctime = ? LIMIT 1; + +-- name: SelectByCyear :one +SELECT id FROM debug +WHERE Cyear = ? LIMIT 1; + +-- name: SelectByCchar :one +SELECT id FROM debug +WHERE Cchar = ? LIMIT 1; + +-- name: SelectByCvarchar :one +SELECT id FROM debug +WHERE Cvarchar = ? LIMIT 1; + +-- name: SelectByCbinary :one +SELECT id FROM debug +WHERE Cbinary = ? LIMIT 1; + +-- name: SelectByCvarbinary :one +SELECT id FROM debug +WHERE Cvarbinary = ? LIMIT 1; + +-- name: SelectByCtinyblob :one +SELECT id FROM debug +WHERE Ctinyblob = ? LIMIT 1; + +-- name: SelectByCblob :one +SELECT id FROM debug +WHERE Cblob = ? LIMIT 1; + +-- name: SelectByCmediumblob :one +SELECT id FROM debug +WHERE Cmediumblob = ? LIMIT 1; + +-- name: SelectByClongblob :one +SELECT id FROM debug +WHERE Clongblob = ? LIMIT 1; + +-- name: SelectByCtinytext :one +SELECT id FROM debug +WHERE Ctinytext = ? LIMIT 1; + +-- name: SelectByCtext :one +SELECT id FROM debug +WHERE Ctext = ? LIMIT 1; + +-- name: SelectByCmediumtext :one +SELECT id FROM debug +WHERE Cmediumtext = ? LIMIT 1; + +-- name: SelectByClongtext :one +SELECT id FROM debug +WHERE Clongtext = ? LIMIT 1; + +-- name: SelectByCenum :one +SELECT id FROM debug +WHERE Cenum = ? LIMIT 1; + +-- name: SelectByCset :one +SELECT id FROM debug +WHERE Cset = ? LIMIT 1; + +-- name: SelectByCjson :one +SELECT id FROM debug +WHERE Cjson = ? LIMIT 1; + +-- +-- + +-- -- name: DeleteById :exec +-- DELETE FROM debug +-- WHERE id = ?; + +-- -- name: DeleteByCsmallint :exec +-- DELETE FROM debug +-- WHERE Csmallint = ? LIMIT 1; + +-- -- name: DeleteByCint :exec +-- DELETE FROM debug +-- WHERE Cint = ? LIMIT 1; + +-- -- name: DeleteByCinteger :exec +-- DELETE FROM debug +-- WHERE Cinteger = ? LIMIT 1; + +-- -- name: DeleteByCdecimal :exec +-- DELETE FROM debug +-- WHERE Cdecimal = ? LIMIT 1; + +-- -- name: DeleteByCnumeric :exec +-- DELETE FROM debug +-- WHERE Cnumeric = ? LIMIT 1; + +-- -- name: DeleteByCfloat :exec +-- DELETE FROM debug +-- WHERE Cfloat = ? LIMIT 1; + +-- -- name: DeleteByCreal :exec +-- DELETE FROM debug +-- WHERE Creal = ? LIMIT 1; + +-- -- name: DeleteByCdoubleprecision :exec +-- DELETE FROM debug +-- WHERE Cdoubleprecision = ? LIMIT 1; + +-- -- name: DeleteByCdouble :exec +-- DELETE FROM debug +-- WHERE Cdouble = ? LIMIT 1; + +-- -- name: DeleteByCdec :exec +-- DELETE FROM debug +-- WHERE Cdec = ? LIMIT 1; + +-- -- name: DeleteByCfixed :exec +-- DELETE FROM debug +-- WHERE Cfixed = ? LIMIT 1; + +-- -- name: DeleteByCtinyint :exec +-- DELETE FROM debug +-- WHERE Ctinyint = ? LIMIT 1; + +-- -- name: DeleteByCbool :exec +-- DELETE FROM debug +-- WHERE Cbool = ? LIMIT 1; + +-- -- name: DeleteByCmediumint :exec +-- DELETE FROM debug +-- WHERE Cmediumint = ? LIMIT 1; + +-- -- name: DeleteByCbit :exec +-- DELETE FROM debug +-- WHERE Cbit = ? LIMIT 1; + +-- -- name: DeleteByCdate :exec +-- DELETE FROM debug +-- WHERE Cdate = ? LIMIT 1; + +-- -- name: DeleteByCdatetime :exec +-- DELETE FROM debug +-- WHERE Cdatetime = ? LIMIT 1; + +-- -- name: DeleteByCtimestamp :exec +-- DELETE FROM debug +-- WHERE Ctimestamp = ? LIMIT 1; + +-- -- name: DeleteByCtime :exec +-- DELETE FROM debug +-- WHERE Ctime = ? LIMIT 1; + +-- -- name: DeleteByCyear :exec +-- DELETE FROM debug +-- WHERE Cyear = ? LIMIT 1; + +-- -- name: DeleteByCchar :exec +-- DELETE FROM debug +-- WHERE Cchar = ? LIMIT 1; + +-- -- name: DeleteByCvarchar :exec +-- DELETE FROM debug +-- WHERE Cvarchar = ?; + +-- -- name: DeleteByCbinary :exec +-- DELETE FROM debug +-- WHERE Cbinary = ? LIMIT 1; + +-- -- name: DeleteByCvarbinary :exec +-- DELETE FROM debug +-- WHERE Cvarbinary = ? LIMIT 1; + +-- -- name: DeleteByCtinyblob :exec +-- DELETE FROM debug +-- WHERE Ctinyblob = ? LIMIT 1; + +-- -- name: DeleteByCblob :exec +-- DELETE FROM debug +-- WHERE Cblob = ? LIMIT 1; + +-- -- name: DeleteByCmediumblob :exec +-- DELETE FROM debug +-- WHERE Cmediumblob = ? LIMIT 1; + +-- -- name: DeleteByClongblob :exec +-- DELETE FROM debug +-- WHERE Clongblob = ? LIMIT 1; + +-- -- name: DeleteByCtinytext :exec +-- DELETE FROM debug +-- WHERE Ctinytext = ? LIMIT 1; + +-- -- name: DeleteByCtext :exec +-- DELETE FROM debug +-- WHERE Ctext = ? LIMIT 1; + +-- -- name: DeleteByCmediumtext :exec +-- DELETE FROM debug +-- WHERE Cmediumtext = ? LIMIT 1; + +-- -- name: DeleteByClongtext :exec +-- DELETE FROM debug +-- WHERE Clongtext = ? LIMIT 1; + +-- -- name: DeleteByCenum :exec +-- DELETE FROM debug +-- WHERE Cenum = ? LIMIT 1; + +-- -- name: DeleteByCset :exec +-- DELETE FROM debug +-- WHERE Cset = ? LIMIT 1; + +-- -- name: DeleteByCjson :exec +-- DELETE FROM debug +-- WHERE Cjson = ? LIMIT 1; diff --git a/internal/endtoend/testdata/vet_explain/mysql/schema.sql b/internal/endtoend/testdata/vet_explain/mysql/schema.sql new file mode 100644 index 0000000000..3a7476b603 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/schema.sql @@ -0,0 +1,38 @@ +CREATE TABLE debug ( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + Csmallint smallint not null, + Cint int not null, + Cinteger integer not null, + Cdecimal decimal(1,1) not null, + Cnumeric numeric(2,1) not null, + Cfloat float not null, + Creal real not null, + Cdoubleprecision double precision not null, + Cdouble double not null, + Cdec dec(3,2) not null, + Cfixed fixed(5,5) not null, + Ctinyint tinyint not null, + Cbool bool not null, + Cmediumint mediumint not null, + Cbit bit not null, + Cdate date not null, + Cdatetime datetime not null, + Ctimestamp timestamp not null, + Ctime time not null, + Cyear year not null, + Cchar char(1) not null, + Cvarchar varchar(1) not null, + Cbinary binary(1) not null, + Cvarbinary varbinary(1) not null, + Ctinyblob tinyblob not null, + Cblob blob not null, + Cmediumblob mediumblob not null, + Clongblob longblob not null, + Ctinytext tinytext NOT NULL, + Ctext text NOT NULL, + Cmediumtext mediumtext NOT NULL, + Clongtext longtext NOT NULL, + Cenum ENUM('one', 'two', 'three'), + Cset SET('one', 'two', 'three') NOT NULL, + Cjson JSON NOT NULL +); \ No newline at end of file diff --git a/internal/endtoend/testdata/vet_explain/mysql/sqlc.yaml b/internal/endtoend/testdata/vet_explain/mysql/sqlc.yaml new file mode 100644 index 0000000000..8e83a1c606 --- /dev/null +++ b/internal/endtoend/testdata/vet_explain/mysql/sqlc.yaml @@ -0,0 +1,16 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "mysql" + database: + uri: root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/test?multiStatements=true&parseTime=true + gen: + go: + package: "test" + out: "db" + rules: + - test +rules: + - name: test + rule: "!has(mysql.explain)" diff --git a/internal/endtoend/testdata/vet_failures/exec.json b/internal/endtoend/testdata/vet_failures/exec.json new file mode 100644 index 0000000000..07753636ee --- /dev/null +++ b/internal/endtoend/testdata/vet_failures/exec.json @@ -0,0 +1,3 @@ +{ + "command": "vet" +} diff --git a/internal/endtoend/testdata/vet_failures/query.sql b/internal/endtoend/testdata/vet_failures/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/vet_failures/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/vet_failures/schema.sql b/internal/endtoend/testdata/vet_failures/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/vet_failures/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/vet_failures/sqlc.yaml b/internal/endtoend/testdata/vet_failures/sqlc.yaml new file mode 100644 index 0000000000..b1cff78c30 --- /dev/null +++ b/internal/endtoend/testdata/vet_failures/sqlc.yaml @@ -0,0 +1,31 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + rules: + - no-pg + - no-delete + - only-one-param + - no-exec +rules: + - name: no-pg + message: "invalid engine: postgresql" + rule: | + config.engine == "postgresql" + - name: no-delete + message: "don't use delete statements" + rule: | + query.sql.contains("DELETE") + - name: only-one-param + message: "too many parameters" + rule: | + query.params.size() > 1 + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" diff --git a/internal/endtoend/testdata/vet_failures/stderr.txt b/internal/endtoend/testdata/vet_failures/stderr.txt new file mode 100644 index 0000000000..584c460b8e --- /dev/null +++ b/internal/endtoend/testdata/vet_failures/stderr.txt @@ -0,0 +1,7 @@ +query.sql: GetAuthor: no-pg: invalid engine: postgresql +query.sql: ListAuthors: no-pg: invalid engine: postgresql +query.sql: CreateAuthor: no-pg: invalid engine: postgresql +query.sql: CreateAuthor: only-one-param: too many parameters +query.sql: DeleteAuthor: no-pg: invalid engine: postgresql +query.sql: DeleteAuthor: no-delete: don't use delete statements +query.sql: DeleteAuthor: no-exec: don't use exec diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/db.go b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/sqlite/go/models.go b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go new file mode 100644 index 0000000000..c2d2118717 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Ft struct { + B string +} + +type Tbl struct { + A int64 + B sql.NullString + C sql.NullString + D sql.NullString + E sql.NullInt64 +} + +type TblFt struct { + B string + C string +} diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go new file mode 100644 index 0000000000..dab27d29cf --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go @@ -0,0 +1,248 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const deleteTblFt = `-- name: DeleteTblFt :exec +DELETE FROM tbl_ft WHERE b = ? +` + +func (q *Queries) DeleteTblFt(ctx context.Context, b string) error { + _, err := q.db.ExecContext(ctx, deleteTblFt, b) + return err +} + +const insertTblFt = `-- name: InsertTblFt :exec +INSERT INTO tbl_ft(b, c) VALUES(?, ?) +` + +type InsertTblFtParams struct { + B string + C string +} + +func (q *Queries) InsertTblFt(ctx context.Context, arg InsertTblFtParams) error { + _, err := q.db.ExecContext(ctx, insertTblFt, arg.B, arg.C) + return err +} + +const selectAllColsFt = `-- name: SelectAllColsFt :many +SELECT b FROM ft +WHERE b MATCH ? +` + +func (q *Queries) SelectAllColsFt(ctx context.Context, b string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, selectAllColsFt, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var b string + if err := rows.Scan(&b); err != nil { + return nil, err + } + items = append(items, b) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const selectAllColsTblFt = `-- name: SelectAllColsTblFt :many +SELECT b, c FROM tbl_ft +WHERE b MATCH ? +` + +func (q *Queries) SelectAllColsTblFt(ctx context.Context, b string) ([]TblFt, error) { + rows, err := q.db.QueryContext(ctx, selectAllColsTblFt, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TblFt + for rows.Next() { + var i TblFt + if err := rows.Scan(&i.B, &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 selectBm25Func = `-- name: SelectBm25Func :many +SELECT b, c, bm25(tbl_ft, 2.0) FROM tbl_ft +WHERE b MATCH ? ORDER BY bm25(tbl_ft) +` + +type SelectBm25FuncRow struct { + B string + C string + Bm25 float64 +} + +func (q *Queries) SelectBm25Func(ctx context.Context, b string) ([]SelectBm25FuncRow, error) { + rows, err := q.db.QueryContext(ctx, selectBm25Func, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SelectBm25FuncRow + for rows.Next() { + var i SelectBm25FuncRow + if err := rows.Scan(&i.B, &i.C, &i.Bm25); 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 selectHightlighFunc = `-- name: SelectHightlighFunc :many +SELECT highlight(tbl_ft, 0, '', '') FROM tbl_ft +WHERE b MATCH ? +` + +func (q *Queries) SelectHightlighFunc(ctx context.Context, b string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, selectHightlighFunc, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var highlight string + if err := rows.Scan(&highlight); err != nil { + return nil, err + } + items = append(items, highlight) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const selectOneColFt = `-- name: SelectOneColFt :many +SELECT b FROM ft +WHERE b = ? +` + +func (q *Queries) SelectOneColFt(ctx context.Context, b string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, selectOneColFt, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var b string + if err := rows.Scan(&b); err != nil { + return nil, err + } + items = append(items, b) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const selectOneColTblFt = `-- name: SelectOneColTblFt :many +SELECT c FROM tbl_ft +WHERE b = ? +` + +func (q *Queries) SelectOneColTblFt(ctx context.Context, b string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, selectOneColTblFt, b) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var c string + if err := rows.Scan(&c); err != nil { + return nil, err + } + items = append(items, c) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const selectSnippetFunc = `-- name: SelectSnippetFunc :many +SELECT snippet(tbl_ft, 0, '', '', 'aa', ?) FROM tbl_ft +` + +func (q *Queries) SelectSnippetFunc(ctx context.Context, snippet int64) ([]string, error) { + rows, err := q.db.QueryContext(ctx, selectSnippetFunc, snippet) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var snippet string + if err := rows.Scan(&snippet); err != nil { + return nil, err + } + items = append(items, snippet) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateTblFt = `-- name: UpdateTblFt :exec +UPDATE tbl_ft SET c = ? WHERE b = ? +` + +type UpdateTblFtParams struct { + C string + B string +} + +func (q *Queries) UpdateTblFt(ctx context.Context, arg UpdateTblFtParams) error { + _, err := q.db.ExecContext(ctx, updateTblFt, arg.C, arg.B) + return err +} diff --git a/internal/endtoend/testdata/virtual_table/sqlite/query.sql b/internal/endtoend/testdata/virtual_table/sqlite/query.sql new file mode 100644 index 0000000000..ad8eeeae40 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/query.sql @@ -0,0 +1,35 @@ +-- name: SelectAllColsFt :many +SELECT b FROM ft +WHERE b MATCH ?; + +-- name: SelectAllColsTblFt :many +SELECT b, c FROM tbl_ft +WHERE b MATCH ?; + +-- name: SelectOneColFt :many +SELECT b FROM ft +WHERE b = ?; + +-- name: SelectOneColTblFt :many +SELECT c FROM tbl_ft +WHERE b = ?; + +-- name: SelectHightlighFunc :many +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); + +-- name: UpdateTblFt :exec +UPDATE tbl_ft SET c = ? WHERE b = ?; + +-- name: DeleteTblFt :exec +DELETE FROM tbl_ft WHERE b = ?; + +-- name: InsertTblFt :exec +INSERT INTO tbl_ft(b, c) VALUES(?, ?); diff --git a/internal/endtoend/testdata/virtual_table/sqlite/schema.sql b/internal/endtoend/testdata/virtual_table/sqlite/schema.sql new file mode 100644 index 0000000000..5d3e0a3f8b --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/schema.sql @@ -0,0 +1,15 @@ +CREATE TABLE tbl(a INTEGER PRIMARY KEY, b TEXT, c TEXT, d TEXT, e INTEGER); + +CREATE VIRTUAL TABLE tbl_ft USING fts5(b, c UNINDEXED, content='tbl', content_rowid='a'); + +CREATE VIRTUAL TABLE ft USING fts5(b); + +CREATE TRIGGER tbl_ai AFTER INSERT ON tbl BEGIN + INSERT INTO tbl_ft(rowid, b, c) VALUES (new.a, new.b, new.c); +END; + +INSERT INTO tbl VALUES(1, 'xx yy cc', 't', 'a', 11); +INSERT INTO tbl VALUES(2, 'aa bb', 't', 'a', 22); + +INSERT INTO ft VALUES('xx cc'); +INSERT INTO ft VALUES('cc bb'); diff --git a/internal/endtoend/testdata/virtual_table/sqlite/sqlc.yaml b/internal/endtoend/testdata/virtual_table/sqlite/sqlc.yaml new file mode 100644 index 0000000000..50f9bbaab3 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table/sqlite/sqlc.yaml @@ -0,0 +1,9 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: sqlite + gen: + go: + package: querytest + out: go \ No newline at end of file diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/gen/hello.txt b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/gen/hello.txt new file mode 100644 index 0000000000..5e1c309dae --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/gen/hello.txt @@ -0,0 +1 @@ +Hello World \ No newline at end of file diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/query.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/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_greeter/schema.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/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_greeter/sqlc.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/sqlc.json new file mode 100644 index 0000000000..2385cc5a4b --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter/sqlc.json @@ -0,0 +1,25 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "greeter" + } + ] + } + ], + "plugins": [ + { + "name": "greeter", + "wasm": { + "url": "https://github.com/sqlc-dev/sqlc-gen-greeter/releases/download/v0.1.0/sqlc-gen-greeter.wasm", + "sha256": "afc486dac2068d741d7a4110146559d12a013fd0286f42a2fc7dcd802424ad07" + } + } + ] +} 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 new file mode 100644 index 0000000000..fa4beb305c --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json @@ -0,0 +1,6 @@ +{ + "env": [ + "SQLC_VERSION=v1.30.0", + "SQLC_DUMMY_VALUE=true" + ] +} diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/query.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/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_test/schema.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/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_test/sqlc.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/sqlc.json new file mode 100644 index 0000000000..38e6773a25 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/sqlc.json @@ -0,0 +1,26 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "test" + } + ] + } + ], + "plugins": [ + { + "name": "test", + "env": ["SQLC_DUMMY_VALUE"], + "wasm": { + "url": "https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm", + "sha256": "138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790" + } + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +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 +} + +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/where_collate/sqlite/go/models.go b/internal/endtoend/testdata/where_collate/sqlite/go/models.go new file mode 100644 index 0000000000..33d29619ca --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +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 new file mode 100644 index 0000000000..52633252b3 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAccountByName = `-- name: GetAccountByName :one +SELECT id, name FROM accounts +WHERE name = ? COLLATE NOCASE +LIMIT 1 +` + +func (q *Queries) GetAccountByName(ctx context.Context, name string) (Account, error) { + row := q.db.QueryRowContext(ctx, getAccountByName, name) + var i Account + err := row.Scan(&i.ID, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/where_collate/sqlite/query.sql b/internal/endtoend/testdata/where_collate/sqlite/query.sql new file mode 100644 index 0000000000..647c3ebc07 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: GetAccountByName :one +SELECT * FROM accounts +WHERE name = ? COLLATE NOCASE +LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/where_collate/sqlite/schema.sql b/internal/endtoend/testdata/where_collate/sqlite/schema.sql new file mode 100644 index 0000000000..00a9defc2c --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE accounts ( + id TEXT NOT NULL PRIMARY KEY, + name TEXT NOT NULL UNIQUE, + + UNIQUE (name COLLATE NOCASE) +); + diff --git a/internal/endtoend/testdata/where_collate/sqlite/sqlc.json b/internal/endtoend/testdata/where_collate/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/where_collate/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/wrap_errors/mysql/db/db.go b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /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.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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..24e47df1ef --- /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.30.0 + +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..1cf96f1534 --- /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.30.0 +// 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..e1f93c6f1d --- /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.30.0 + +package authors + +import ( + "context" + + "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 +} + +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..7845b91a3d --- /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.30.0 + +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..82fee58e9c --- /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.30.0 +// 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..fc409f7e3f --- /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.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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..24e47df1ef --- /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.30.0 + +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..e7026afd76 --- /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.30.0 +// 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..fc409f7e3f --- /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.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +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 +} + +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..24e47df1ef --- /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.30.0 + +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..766671117c --- /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.30.0 +// 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 6f21c94ed1..9c19dd4a09 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/db.go +++ b/internal/endtoend/testdata/yaml_overrides/go/db.go @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/yaml_overrides/go/models.go b/internal/endtoend/testdata/yaml_overrides/go/models.go index bf8ca8c54b..051e7672e0 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/models.go +++ b/internal/endtoend/testdata/yaml_overrides/go/models.go @@ -1,10 +1,12 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 package override import ( - "github.com/kyleconroy/sqlc-testdata/pkg" "github.com/lib/pq" + "github.com/sqlc-dev/sqlc-testdata/pkg" ) type Foo struct { 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..0faba2cde4 --- /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.30.0 +// 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/testdata/yaml_overrides/sqlc.yaml b/internal/endtoend/testdata/yaml_overrides/sqlc.yaml index 9763b01fc7..3bc1c1f391 100644 --- a/internal/endtoend/testdata/yaml_overrides/sqlc.yaml +++ b/internal/endtoend/testdata/yaml_overrides/sqlc.yaml @@ -5,7 +5,7 @@ packages: schema: "sql/" queries: "sql/" overrides: - - go_type: "github.com/kyleconroy/sqlc-testdata/pkg.CustomType" + - go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" column: "foo.retyped" - go_type: "github.com/lib/pq.StringArray" column: "foo.langs" diff --git a/internal/endtoend/vet_test.go b/internal/endtoend/vet_test.go new file mode 100644 index 0000000000..011c032c2e --- /dev/null +++ b/internal/endtoend/vet_test.go @@ -0,0 +1,82 @@ +//go:build examples + +package main + +import ( + "bytes" + "context" + "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) { + schemaFile := filepath.Join(path, "schema.sql") + if _, err := os.Stat(schemaFile); !os.IsNotExist(err) { + return schemaFile, true + } + schemaDir := filepath.Join(path, "schema") + if _, err := os.Stat(schemaDir); !os.IsNotExist(err) { + return schemaDir, true + } + return "", false +} + +func TestExamplesVet(t *testing.T) { + t.Parallel() + ctx := context.Background() + + examples, err := filepath.Abs(filepath.Join("..", "..", "examples")) + if err != nil { + t.Fatal(err) + } + + files, err := os.ReadDir(examples) + if err != nil { + t.Fatal(err) + } + + for _, replay := range files { + if !replay.IsDir() { + continue + } + tc := replay.Name() + 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, "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 + opts := &cmd.Options{ + Stderr: &stderr, + Env: cmd.Env{}, + } + err := cmd.Vet(ctx, path, "", opts) + if err != nil { + t.Fatalf("sqlc vet failed: %s %s", err, stderr.String()) + } + }) + } +} 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..ba2817e2bb --- /dev/null +++ b/internal/engine/clickhouse/convert.go @@ -0,0 +1,1020 @@ +package clickhouse + +import ( + "strconv" + "strings" + + chast "github.com/sqlc-dev/doubleclick/ast" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type cc struct { + paramCount int +} + +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 { + if aliased, ok := cte.(*chast.AliasedExpr); ok { + cteNode := &ast.CommonTableExpr{ + Ctename: &aliased.Alias, + } + // CTE expression may be a Subquery containing the actual SELECT + if subq, ok := aliased.Expr.(*chast.Subquery); ok { + cteNode.Ctequery = c.convert(subq.Query) + } else { + // Fallback: treat the expression itself as the query + cteNode.Ctequery = c.convertExpr(aliased.Expr) + } + 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: expr.Pos().Offset, + } + + 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{}}, + }, + } + } + case *chast.AliasedExpr: + res.Name = &e.Alias + res.Val = c.convertExpr(e.Expr) + case *chast.Identifier: + if e.Alias != "" { + res.Name = &e.Alias + } + res.Val = c.convertIdentifier(e) + case *chast.FunctionCall: + if e.Alias != "" { + res.Name = &e.Alias + } + res.Val = c.convertFunctionCall(e) + default: + res.Val = c.convertExpr(expr) + } + + return res +} + +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: + return c.convertFunctionCall(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: n.Pos().Offset, + } +} + +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: n.Pos().Offset, + } + 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: n.Pos().Offset, + } + 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: n.Pos().Offset, + } + 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: n.Pos().Offset, + } + } + return &ast.A_Const{ + Val: &ast.Integer{Ival: 0}, + Location: n.Pos().Offset, + } + case chast.LiteralNull: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: n.Pos().Offset, + } + default: + return &ast.A_Const{ + Location: n.Pos().Offset, + } + } +} + +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: n.Pos().Offset, + } + } + + // Handle other operators + return &ast.A_Expr{ + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Op}}, + }, + Lexpr: c.convertExpr(n.Left), + Rexpr: c.convertExpr(n.Right), + Location: n.Pos().Offset, + } +} + +func (c *cc) convertFunctionCall(n *chast.FunctionCall) *ast.FuncCall { + fc := &ast.FuncCall{ + Funcname: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Name}}, + }, + Location: n.Pos().Offset, + 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 { + c.paramCount++ + // Use the parameter name if available + name := n.Name + if name == "" { + name = strconv.Itoa(c.paramCount) + } + return &ast.ParamRef{ + Number: c.paramCount, + Location: n.Pos().Offset, + } +} + +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: n.Pos().Offset, + } +} + +func (c *cc) convertCaseExpr(n *chast.CaseExpr) *ast.CaseExpr { + ce := &ast.CaseExpr{ + Location: n.Pos().Offset, + } + + // 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: n.Pos().Offset, + } + + if n.Type != nil { + tc.TypeName = &ast.TypeName{ + Name: n.Type.Name, + } + } + + 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: n.Pos().Offset, + } +} + +func (c *cc) convertInExpr(n *chast.InExpr) *ast.In { + in := &ast.In{ + Expr: c.convertExpr(n.Expr), + Not: n.Not, + Location: n.Pos().Offset, + } + + // 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: n.Pos().Offset, + } + 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: n.Pos().Offset, + } +} + +func (c *cc) convertSubquery(n *chast.Subquery) *ast.SubLink { + return &ast.SubLink{ + SubLinkType: ast.EXISTS_SUBLINK, + Subselect: c.convert(n.Query), + } +} + +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: n.Pos().Offset, + } + } + + return &ast.A_Expr{ + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Op}}, + }, + Rexpr: c.convertExpr(n.Operand), + Location: n.Pos().Offset, + } +} + +func (c *cc) convertOrderByElement(n *chast.OrderByElement) *ast.SortBy { + sortBy := &ast.SortBy{ + Node: c.convertExpr(n.Expression), + Location: n.Expression.Pos().Offset, + } + + 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 + for _, col := range n.Columns { + 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{} +} + +func (c *cc) convertColumnDeclaration(n *chast.ColumnDeclaration) *ast.ColumnDef { + colDef := &ast.ColumnDef{ + Colname: identifier(n.Name), + IsNotNull: isNotNull(n), + } + + if n.Type != nil { + colDef.TypeName = &ast.TypeName{ + Name: n.Type.Name, + } + // Handle type parameters (e.g., Decimal(10, 2)) + if len(n.Type.Parameters) > 0 { + colDef.TypeName.Typmods = &ast.List{} + for _, param := range n.Type.Parameters { + colDef.TypeName.Typmods.Items = append(colDef.TypeName.Typmods.Items, c.convertExpr(param)) + } + } + } + + // 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 +} + +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/format.go b/internal/engine/clickhouse/format.go new file mode 100644 index 0000000000..c103c7803f --- /dev/null +++ b/internal/engine/clickhouse/format.go @@ -0,0 +1,35 @@ +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) string { + return "?" +} + +// NamedParam returns the named parameter placeholder for the given name. +// ClickHouse uses {name:Type} syntax for named parameters. +func (p *Parser) NamedParam(name string) string { + return "{" + name + ":String}" +} + +// 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..282089f31d --- /dev/null +++ b/internal/engine/clickhouse/parse.go @@ -0,0 +1,64 @@ +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 + for _, stmt := range stmtNodes { + converter := &cc{} + out := converter.convert(stmt) + if _, ok := out.(*ast.TODO); ok { + continue + } + + // Get position information from the statement + pos := stmt.Pos() + end := stmt.End() + stmtLen := end.Offset - pos.Offset + + stmts = append(stmts, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: out, + StmtLocation: pos.Offset, + StmtLen: stmtLen, + }, + }) + } + + return stmts, nil +} + +// 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/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..20142fafaa --- /dev/null +++ b/internal/engine/dolphin/CLAUDE.md @@ -0,0 +1,224 @@ +# Dolphin Engine (MySQL) - Claude Code Guide + +The dolphin engine handles MySQL parsing and AST conversion using the TiDB parser. + +## Architecture + +### Parser Flow +``` +SQL String → TiDB Parser → TiDB AST → sqlc AST → Analysis/Codegen +``` + +### Key Files +- `convert.go` - Converts TiDB AST nodes to sqlc AST nodes +- `format.go` - MySQL-specific formatting (identifiers, types, parameters) +- `parse.go` - Entry point for parsing MySQL SQL + +## TiDB Parser + +The TiDB parser (`github.com/pingcap/tidb/pkg/parser`) is used for MySQL parsing: + +```go +import ( + pcast "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/parser/mysql" + "github.com/pingcap/tidb/pkg/parser/types" +) +``` + +### Common TiDB 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: sqlc.arg() not converted in ON DUPLICATE KEY UPDATE +**Cause**: `InsertStmt` case in `rewrite.go` didn't traverse `OnDuplicateKeyUpdate` +**Solution**: Add `a.apply(n, "OnDuplicateKeyUpdate", nil, n.OnDuplicateKeyUpdate)` + +### Issue: MySQL @variable being treated as parameter +**Cause**: Converting `VariableExpr` to `A_Expr` with `@` operator +**Solution**: Use `ast.VariableExpr` instead, which is not detected by `named.IsParamSign()` + +### 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/catalog.go b/internal/engine/dolphin/catalog.go index f3368ccc69..e7872f7c95 100644 --- a/internal/engine/dolphin/catalog.go +++ b/internal/engine/dolphin/catalog.go @@ -1,7 +1,7 @@ package dolphin import ( - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) func NewCatalog() *catalog.Catalog { diff --git a/internal/engine/dolphin/convert.go b/internal/engine/dolphin/convert.go index 2f4db8342c..1f68358ce4 100644 --- a/internal/engine/dolphin/convert.go +++ b/internal/engine/dolphin/convert.go @@ -1,17 +1,18 @@ package dolphin import ( - "fmt" "log" + "strconv" "strings" - pcast "github.com/pingcap/parser/ast" - "github.com/pingcap/parser/opcode" - driver "github.com/pingcap/parser/test_driver" - "github.com/pingcap/parser/types" + pcast "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/parser/mysql" + "github.com/pingcap/tidb/pkg/parser/opcode" + driver "github.com/pingcap/tidb/pkg/parser/test_driver" + "github.com/pingcap/tidb/pkg/parser/types" - "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) type cc struct { @@ -25,6 +26,14 @@ func todo(n pcast.Node) *ast.TODO { 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 (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { alt := &ast.AlterTableStmt{ Table: parseTableName(n.Table), @@ -35,19 +44,10 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { case pcast.AlterTableAddColumns: for _, def := range spec.NewColumns { name := def.Name.String() - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeStr(def.Tp.Tp)}, - IsNotNull: isNotNull(def), - } - if def.Tp.Flen >= 0 { - length := def.Tp.Flen - columnDef.Length = &length - } alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_AddColumn, - Def: &columnDef, + Def: convertColumnDef(def), }) } @@ -60,20 +60,24 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { }) case pcast.AlterTableChangeColumn: - // spew.Dump("change column", spec) + oldName := spec.OldColumnName.String() + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &oldName, + Subtype: ast.AT_DropColumn, + }) + + for _, def := range spec.NewColumns { + name := def.Name.String() + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AddColumn, + Def: convertColumnDef(def), + }) + } case pcast.AlterTableModifyColumn: for _, def := range spec.NewColumns { name := def.Name.String() - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeStr(def.Tp.Tp)}, - IsNotNull: isNotNull(def), - } - if def.Tp.Flen >= 0 { - length := def.Tp.Flen - columnDef.Length = &length - } alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_DropColumn, @@ -81,7 +85,7 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_AddColumn, - Def: &columnDef, + Def: convertColumnDef(def), }) } @@ -110,7 +114,7 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { default: if debug.Active { - fmt.Printf("dolphin.convert: Unknown alter table cmd %v\n", spec.Tp) + log.Printf("dolphin.convert: Unknown alter table cmd %v\n", spec.Tp) } continue } @@ -119,7 +123,7 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { } func (c *cc) convertAssignment(n *pcast.Assignment) *ast.ResTarget { - name := n.Column.Name.String() + name := identifier(n.Column.Name.String()) return &ast.ResTarget{ Name: &name, Val: c.convert(n.Expr), @@ -184,8 +188,14 @@ 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), @@ -216,36 +226,7 @@ func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node { create.ReferTable = parseTableName(n.ReferTable) } for _, def := range n.Cols { - var vals *ast.List - if len(def.Tp.Elems) > 0 { - vals = &ast.List{} - for i := range def.Tp.Elems { - vals.Items = append(vals.Items, &ast.String{ - Str: def.Tp.Elems[i], - }) - } - } - comment := "" - for _, opt := range def.Options { - switch opt.Tp { - case pcast.ColumnOptionComment: - if value, ok := opt.Expr.(*driver.ValueExpr); ok { - comment = value.GetString() - } - } - } - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeStr(def.Tp.Tp)}, - IsNotNull: isNotNull(def), - Comment: comment, - Vals: vals, - } - if def.Tp.Flen >= 0 { - length := def.Tp.Flen - columnDef.Length = &length - } - create.Cols = append(create.Cols, &columnDef) + create.Cols = append(create.Cols, convertColumnDef(def)) } for _, opt := range n.Options { switch opt.Tp { @@ -256,26 +237,89 @@ func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node { return create } +func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef { + var vals *ast.List + if len(def.Tp.GetElems()) > 0 { + vals = &ast.List{} + for i := range def.Tp.GetElems() { + vals.Items = append(vals.Items, &ast.String{ + Str: def.Tp.GetElems()[i], + }) + } + } + comment := "" + for _, opt := range def.Options { + switch opt.Tp { + case pcast.ColumnOptionComment: + if value, ok := opt.Expr.(*driver.ValueExpr); 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)}, + }, + } + } + + columnDef := ast.ColumnDef{ + Colname: def.Name.String(), + TypeName: typeName, + IsNotNull: isNotNull(def), + IsUnsigned: isUnsigned(def), + Comment: comment, + Vals: vals, + } + if def.Tp.GetFlen() >= 0 { + length := def.Tp.GetFlen() + columnDef.Length = &length + } + + return &columnDef +} + func (c *cc) convertColumnNameExpr(n *pcast.ColumnNameExpr) *ast.ColumnRef { var items []ast.Node if schema := n.Name.Schema.String(); schema != "" { - items = append(items, &ast.String{Str: schema}) + items = append(items, NewIdentifier(schema)) } if table := n.Name.Table.String(); table != "" { - items = append(items, &ast.String{Str: table}) + items = append(items, NewIdentifier(table)) } - items = append(items, &ast.String{Str: n.Name.Name.String()}) + items = append(items, NewIdentifier(n.Name.Name.String())) return &ast.ColumnRef{ Fields: &ast.List{ Items: items, }, + Location: n.OriginTextPosition(), } } func (c *cc) convertColumnNames(cols []*pcast.ColumnName) *ast.List { list := &ast.List{Items: []ast.Node{}} for i := range cols { - name := cols[i].Name.String() + name := identifier(cols[i].Name.String()) list.Items = append(list.Items, &ast.ResTarget{ Name: &name, }) @@ -284,28 +328,58 @@ func (c *cc) convertColumnNames(cols []*pcast.ColumnName) *ast.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") + stmt := &ast.DeleteStmt{ + WhereClause: c.convert(n.Where), + ReturningList: &ast.List{}, + WithClause: c.convertWithClause(n.With), } - rel := rels.Items[0] - rangeVar, ok := rel.(*ast.RangeVar) - if !ok { - panic("expected range var") + + if n.Limit != nil { + stmt.LimitCount = c.convert(n.Limit.Count) } - return &ast.DeleteStmt{ - Relation: rangeVar, - WhereClause: c.convert(n.Where), - ReturningList: &ast.List{}, + // 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, NewIdentifier(table.Schema.String())) + } + items = append(items, 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 { - // TODO: Remove once views are supported. - if n.IsView { - return todo(n) - } drop := &ast.DropTableStmt{IfExists: n.IfExists} for _, name := range n.Tables { drop.Tables = append(drop.Tables, parseTableName(name)) @@ -314,16 +388,22 @@ func (c *cc) convertDropTableStmt(n *pcast.DropTableStmt) ast.Node { } func (c *cc) convertRenameTableStmt(n *pcast.RenameTableStmt) ast.Node { - return &ast.RenameTableStmt{ - Table: parseTableName(n.OldTable), - NewName: &parseTableName(n.NewTable).Name, + 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, + }) } + 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 } @@ -343,9 +423,36 @@ func (c *cc) convertFuncCallExpr(n *pcast.FuncCallExpr) ast.Node { // TODO: Deprecate the usage of Funcname items := []ast.Node{} if schema != "" { - items = append(items, &ast.String{Str: schema}) + items = append(items, NewIdentifier(schema)) + } + items = append(items, NewIdentifier(name)) + + // 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: name, + }, + Funcname: &ast.List{ + Items: items, + }, + Location: n.OriginTextPosition(), + } + } } - items = append(items, &ast.String{Str: name}) args := &ast.List{} for _, arg := range n.Args { @@ -382,7 +489,6 @@ func (c *cc) convertInsertStmt(n *pcast.InsertStmt) *ast.InsertStmt { panic("expected range var") } - // debug.Dump(n) insert := &ast.InsertStmt{ Relation: rangeVar, Cols: c.convertColumnNames(n.Columns), @@ -398,6 +504,18 @@ func (c *cc) convertInsertStmt(n *pcast.InsertStmt) *ast.InsertStmt { ValuesLists: c.convertLists(n.Lists), } } + + if n.OnDuplicate != nil { + targetList := &ast.List{} + for _, a := range n.OnDuplicate { + targetList.Items = append(targetList.Items, c.convertAssignment(a)) + } + insert.OnDuplicateKeyUpdate = &ast.OnDuplicateKeyUpdate{ + TargetList: targetList, + Location: n.OriginTextPosition(), + } + } + return insert } @@ -431,7 +549,8 @@ func (c *cc) convertSelectField(n *pcast.SelectField) *ast.ResTarget { } var name *string if n.AsName.O != "" { - name = &n.AsName.O + asname := identifier(n.AsName.O) + name = &asname } return &ast.ResTarget{ // TODO: Populate Indirection field @@ -442,13 +561,23 @@ func (c *cc) convertSelectField(n *pcast.SelectField) *ast.ResTarget { } func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { + windowClause := &ast.List{Items: make([]ast.Node, 0)} + orderByClause := c.convertOrderByClause(n.OrderBy) + if orderByClause != nil { + windowClause.Items = append(windowClause.Items, orderByClause) + } + op, all := c.convertSetOprType(n.AfterSetOperator) stmt := &ast.SelectStmt{ - TargetList: c.convertFieldList(n.Fields), - FromClause: c.convertTableRefsClause(n.From), - WhereClause: c.convert(n.Where), - Op: op, - All: all, + TargetList: c.convertFieldList(n.Fields), + FromClause: c.convertTableRefsClause(n.From), + GroupClause: c.convertGroupByClause(n.GroupBy), + HavingClause: c.convertHavingClause(n.Having), + WhereClause: c.convert(n.Where), + WithClause: c.convertWithClause(n.With), + WindowClause: windowClause, + Op: op, + All: all, } if n.Limit != nil { stmt.LimitCount = c.convert(n.Limit.Count) @@ -458,7 +587,11 @@ func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { } 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 { @@ -468,56 +601,127 @@ func (c *cc) convertTableRefsClause(n *pcast.TableRefsClause) *ast.List { return c.convertJoin(n.TableRefs) } -func (c *cc) convertUpdateStmt(n *pcast.UpdateStmt) *ast.UpdateStmt { - rels := c.convertTableRefsClause(n.TableRefs) - if len(rels.Items) != 1 { - panic("expected one range var") +func (c *cc) convertCommonTableExpression(n *pcast.CommonTableExpression) *ast.CommonTableExpr { + if n == nil { + return nil } - var rangeVar *ast.RangeVar - switch rel := rels.Items[0].(type) { + name := n.Name.String() - // Special case for joins in updates - case *ast.JoinExpr: - left, ok := rel.Larg.(*ast.RangeVar) - if !ok { - panic("expected range var") - } - rangeVar = left + columns := &ast.List{} + for _, col := range n.ColNameList { + columns.Items = append(columns.Items, NewIdentifier(col.String())) + } - case *ast.RangeVar: - rangeVar = rel + // 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) + } - default: - panic("expected range var") + return &ast.CommonTableExpr{ + Ctename: &name, + Ctequery: cteQuery, + Ctecolnames: columns, } +} + +func (c *cc) convertWithClause(n *pcast.WithClause) *ast.WithClause { + if n == nil { + return nil + } + list := &ast.List{} + for _, n := range n.CTEs { + list.Items = append(list.Items, c.convertCommonTableExpression(n)) + } + + return &ast.WithClause{ + Ctes: list, + Recursive: n.IsRecursive, + Location: n.OriginTextPosition(), + } +} + +func (c *cc) convertUpdateStmt(n *pcast.UpdateStmt) *ast.UpdateStmt { + rels := c.convertTableRefsClause(n.TableRefs) + if len(rels.Items) != 1 { + panic("expected one range var") + } + + relations := &ast.List{} + convertToRangeVarList(rels, relations) // TargetList list := &ast.List{} for _, a := range n.List { list.Items = append(list.Items, c.convertAssignment(a)) } - return &ast.UpdateStmt{ - Relation: rangeVar, + stmt := &ast.UpdateStmt{ + Relations: relations, TargetList: list, WhereClause: c.convert(n.Where), FromClause: &ast.List{}, ReturningList: &ast.List{}, + WithClause: c.convertWithClause(n.With), + } + if n.Limit != nil { + stmt.LimitCount = c.convert(n.Limit.Count) } + 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: + return &ast.A_Const{ + Val: &ast.Integer{ + Ival: n.Datum.GetInt64(), + }, + Location: n.OriginTextPosition(), + } + + case mysql.TypeDouble, + mysql.TypeFloat, + mysql.TypeNewDecimal: + return &ast.A_Const{ + Val: &ast.Float{ + 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: + } return &ast.A_Const{ Val: &ast.String{ Str: n.Datum.GetString(), }, + Location: n.OriginTextPosition(), } } func (c *cc) convertWildCardField(n *pcast.WildCardField) *ast.ColumnRef { items := []ast.Node{} if t := n.Table.String(); t != "" { - items = append(items, &ast.String{Str: t}) + items = append(items, NewIdentifier(t)) } items = append(items, &ast.A_Star{}) @@ -540,15 +744,27 @@ func (c *cc) convertAggregateFuncExpr(n *pcast.AggregateFuncExpr) *ast.FuncCall }, Funcname: &ast.List{ Items: []ast.Node{ - &ast.String{ - Str: name, - }, + NewIdentifier(name), }, }, Args: &ast.List{}, AggOrder: &ast.List{}, } - for _, a := range n.Args { + + // 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].(*driver.ValueExpr); ok { + separator = value.GetString() + args = args[:len(args)-1] + } + } + + for _, a := range args { if value, ok := a.(*driver.ValueExpr); ok { if value.GetInt64() == int64(1) { fn.AggStar = true @@ -560,6 +776,12 @@ func (c *cc) convertAggregateFuncExpr(n *pcast.AggregateFuncExpr) *ast.FuncCall if n.Distinct { fn.AggDistinct = true } + + // Store separator for GROUP_CONCAT (only if non-default) + if name == "group_concat" && separator != "" && separator != "," { + fn.Separator = &separator + } + return fn } @@ -592,7 +814,13 @@ func (c *cc) convertBeginStmt(n *pcast.BeginStmt) ast.Node { } func (c *cc) convertBetweenExpr(n *pcast.BetweenExpr) ast.Node { - return todo(n) + return &ast.BetweenExpr{ + Expr: c.convert(n.Expr), + Left: c.convert(n.Left), + Right: c.convert(n.Right), + Location: n.OriginTextPosition(), + Not: n.Not, + } } func (c *cc) convertBinlogStmt(n *pcast.BinlogStmt) ast.Node { @@ -600,15 +828,30 @@ func (c *cc) convertBinlogStmt(n *pcast.BinlogStmt) ast.Node { } func (c *cc) convertByItem(n *pcast.ByItem) ast.Node { - return todo(n) + switch n.Expr.(type) { + case *pcast.PositionExpr: + return c.convertPositionExpr(n.Expr.(*pcast.PositionExpr)) + case *pcast.ColumnNameExpr: + return c.convertColumnNameExpr(n.Expr.(*pcast.ColumnNameExpr)) + default: + return todo(n) + } } func (c *cc) convertCaseExpr(n *pcast.CaseExpr) ast.Node { - return todo(n) -} - -func (c *cc) convertChangeStmt(n *pcast.ChangeStmt) ast.Node { - return todo(n) + if n == nil { + return nil + } + list := &ast.List{Items: []ast.Node{}} + for _, n := range n.WhenClauses { + list.Items = append(list.Items, c.convertWhenClause(n)) + } + return &ast.CaseExpr{ + Arg: c.convert(n.Value), + Args: list, + Defresult: c.convert(n.ElseClause), + Location: n.OriginTextPosition(), + } } func (c *cc) convertCleanupTableLockStmt(n *pcast.CleanupTableLockStmt) ast.Node { @@ -645,7 +888,7 @@ func (c *cc) convertCreateBindingStmt(n *pcast.CreateBindingStmt) ast.Node { func (c *cc) convertCreateDatabaseStmt(n *pcast.CreateDatabaseStmt) ast.Node { return &ast.CreateSchemaStmt{ - Name: &n.Name, + Name: &n.Name.O, IfNotExists: n.IfNotExists, } } @@ -667,7 +910,14 @@ func (c *cc) convertCreateUserStmt(n *pcast.CreateUserStmt) ast.Node { } func (c *cc) convertCreateViewStmt(n *pcast.CreateViewStmt) ast.Node { - return todo(n) + return &ast.ViewStmt{ + View: c.convertTableName(n.ViewName), + Aliases: &ast.List{}, + Query: c.convert(n.Select), + Replace: n.OrReplace, + Options: &ast.List{}, + WithCheckOption: ast.ViewCheckOption(n.CheckOption), + } } func (c *cc) convertDeallocateStmt(n *pcast.DeallocateStmt) ast.Node { @@ -694,7 +944,7 @@ func (c *cc) convertDropDatabaseStmt(n *pcast.DropDatabaseStmt) ast.Node { return &ast.DropSchemaStmt{ MissingOk: !n.IfExists, Schemas: []*ast.String{ - {Str: n.Name}, + NewIdentifier(n.Name.O), }, } } @@ -748,7 +998,22 @@ func (c *cc) convertFrameClause(n *pcast.FrameClause) ast.Node { } func (c *cc) convertFuncCastExpr(n *pcast.FuncCastExpr) ast.Node { - return todo(n) + typeName := types.TypeStr(n.Tp.GetType()) + + // 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" + } + } + + return &ast.TypeCast{ + Arg: c.convert(n.Expr), + TypeName: &ast.TypeName{Name: typeName}, + } } func (c *cc) convertGetFormatSelectorExpr(n *pcast.GetFormatSelectorExpr) ast.Node { @@ -763,16 +1028,26 @@ func (c *cc) convertGrantStmt(n *pcast.GrantStmt) ast.Node { return todo(n) } -func (c *cc) convertGroupByClause(n *pcast.GroupByClause) ast.Node { - return todo(n) -} +func (c *cc) convertGroupByClause(n *pcast.GroupByClause) *ast.List { + if n == nil { + return &ast.List{} + } -func (c *cc) convertHavingClause(n *pcast.HavingClause) ast.Node { - return todo(n) + var items []ast.Node + for _, item := range n.Items { + items = append(items, c.convertByItem(item)) + } + + return &ast.List{ + Items: items, + } } -func (c *cc) convertIndexAdviseStmt(n *pcast.IndexAdviseStmt) ast.Node { - return todo(n) +func (c *cc) convertHavingClause(n *pcast.HavingClause) ast.Node { + if n == nil { + return nil + } + return c.convert(n.Expr) } func (c *cc) convertIndexLockAndAlgorithm(n *pcast.IndexLockAndAlgorithm) ast.Node { @@ -784,7 +1059,18 @@ func (c *cc) convertIndexPartSpecification(n *pcast.IndexPartSpecification) ast. } func (c *cc) convertIsNullExpr(n *pcast.IsNullExpr) ast.Node { - return todo(n) + op := ast.BoolExprTypeIsNull + if n.Not { + op = ast.BoolExprTypeIsNotNull + } + return &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{ + Items: []ast.Node{ + c.convert(n.Expr), + }, + }, + } } func (c *cc) convertIsTruthExpr(n *pcast.IsTruthExpr) ast.Node { @@ -796,11 +1082,30 @@ func (c *cc) convertJoin(n *pcast.Join) *ast.List { return &ast.List{} } if n.Right != nil && n.Left != nil { + // MySQL doesn't have a FULL join type + joinType := ast.JoinType(n.Tp) + if joinType >= ast.JoinTypeFull { + 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{ - 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), }}, } } @@ -835,7 +1140,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 { @@ -858,14 +1186,30 @@ func (c *cc) convertOnUpdateOpt(n *pcast.OnUpdateOpt) ast.Node { } func (c *cc) convertOrderByClause(n *pcast.OrderByClause) ast.Node { - return todo(n) + if n == nil { + return nil + } + list := &ast.List{Items: []ast.Node{}} + for _, item := range n.Items { + list.Items = append(list.Items, c.convert(item.Expr)) + } + return list } 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 { @@ -873,23 +1217,50 @@ func (c *cc) convertPartitionByClause(n *pcast.PartitionByClause) ast.Node { } func (c *cc) convertPatternInExpr(n *pcast.PatternInExpr) ast.Node { - return todo(n) -} + var list []ast.Node + var val ast.Node -func (c *cc) convertPatternLikeExpr(n *pcast.PatternLikeExpr) ast.Node { - return todo(n) + expr := c.convert(n.Expr) + + for _, v := range n.List { + val = c.convert(v) + if val != nil { + list = append(list, val) + } + } + + sel := c.convert(n.Sel) + + in := &ast.In{ + Expr: expr, + List: list, + Not: n.Not, + Sel: sel, + Location: n.OriginTextPosition(), + } + + return in } -func (c *cc) convertPatternRegexpExpr(n *pcast.PatternRegexpExpr) ast.Node { - return todo(n) +func (c *cc) convertPatternLikeExpr(n *pcast.PatternLikeOrIlikeExpr) ast.Node { + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind(9), + Name: &ast.List{ + Items: []ast.Node{ + &ast.String{Str: "~~"}, + }, + }, + Lexpr: c.convert(n.Expr), + Rexpr: c.convert(n.Pattern), + } } -func (c *cc) convertPlacementSpec(n *pcast.PlacementSpec) ast.Node { +func (c *cc) convertPatternRegexpExpr(n *pcast.PatternRegexpExpr) ast.Node { return todo(n) } 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 { @@ -969,26 +1340,54 @@ func (c *cc) convertSetOprType(n *pcast.SetOprType) (op ast.SetOperation, all bo // into a tree. It is called for UNION, INTERSECT or EXCLUDE operation. // // Given an union with the following nodes: -// [Select{1}, Select{2}, Select{3}, Select{4}] +// +// [Select{1}, Select{2}, Select{3}, Select{4}] // // The function will return: -// Select{ -// Larg: Select{ -// Larg: Select{ -// Larg: Select{1}, -// Rarg: Select{2}, -// Op: Union -// }, -// Rarg: Select{3}, -// Op: Union, -// }, -// Rarg: Select{4}, -// Op: Union, -// } +// +// Select{ +// Larg: Select{ +// Larg: Select{ +// Larg: Select{1}, +// Rarg: Select{2}, +// Op: Union +// }, +// Rarg: Select{3}, +// Op: Union, +// }, +// Rarg: Select{4}, +// Op: Union, +// } 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) @@ -998,6 +1397,7 @@ func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { WhereClause: nil, Op: op, All: all, + WithClause: c.convertWithClause(n.With), } for _, stmt := range selectStmts { // We move Op and All from the child to the parent. @@ -1020,6 +1420,7 @@ func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { Rarg: stmt, Op: op, All: all, + WithClause: c.convertWithClause(n.With), } } } @@ -1029,7 +1430,12 @@ func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { func (c *cc) convertSetOprStmt(n *pcast.SetOprStmt) ast.Node { if n.SelectList != nil { - return c.convertSetOprSelectList(n.SelectList) + 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) + } + return sn } return todo(n) } @@ -1047,7 +1453,32 @@ func (c *cc) convertSetStmt(n *pcast.SetStmt) ast.Node { } func (c *cc) convertShowStmt(n *pcast.ShowStmt) ast.Node { - return todo(n) + if n.Tp != pcast.ShowWarnings { + return todo(n) + } + level := "level" + code := "code" + message := "message" + stmt := &ast.SelectStmt{ + FromClause: &ast.List{}, + TargetList: &ast.List{ + Items: []ast.Node{ + &ast.ResTarget{ + Name: &level, + Val: &ast.A_Const{Val: &ast.String{}}, + }, + &ast.ResTarget{ + Name: &code, + Val: &ast.A_Const{Val: &ast.Integer{}}, + }, + &ast.ResTarget{ + Name: &message, + Val: &ast.A_Const{Val: &ast.String{}}, + }, + }, + }, + } + return stmt } func (c *cc) convertShutdownStmt(n *pcast.ShutdownStmt) ast.Node { @@ -1059,8 +1490,8 @@ func (c *cc) convertSplitRegionStmt(n *pcast.SplitRegionStmt) ast.Node { } func (c *cc) convertTableName(n *pcast.TableName) *ast.RangeVar { - schema := n.Schema.String() - rel := n.Name.String() + schema := identifier(n.Schema.String()) + rel := identifier(n.Name.String()) return &ast.RangeVar{ Schemaname: &schema, Relname: &rel, @@ -1082,7 +1513,7 @@ func (c *cc) convertTableSource(node *pcast.TableSource) ast.Node { alias := node.AsName.String() switch n := node.Source.(type) { - case *pcast.SelectStmt: + case *pcast.SelectStmt, *pcast.SetOprStmt: rs := &ast.RangeSubselect{ Subquery: c.convert(n), } @@ -1146,11 +1577,23 @@ 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 { - return todo(n) + if n == nil { + return nil + } + return &ast.CaseWhen{ + Expr: c.convert(n.Expr), + Result: c.convert(n.Result), + Location: n.OriginTextPosition(), + } } func (c *cc) convertWindowFuncExpr(n *pcast.WindowFuncExpr) ast.Node { @@ -1161,6 +1604,48 @@ func (c *cc) convertWindowSpec(n *pcast.WindowSpec) ast.Node { return todo(n) } +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)) + } + } + var args ast.List + for _, a := range n.Procedure.Args { + args.Items = append(args.Items, c.convert(a)) + } + return &ast.CallStmt{ + FuncCall: &ast.FuncCall{ + Func: &ast.FuncName{ + Schema: n.Procedure.Schema.L, + Name: n.Procedure.FnName.L, + }, + Funcname: &funcname, + Args: &args, + Location: n.OriginTextPosition(), + }, + } +} + +func (c *cc) convertProcedureInfo(n *pcast.ProcedureInfo) ast.Node { + var params ast.List + for _, sp := range n.ProcedureParam { + paramName := sp.ParamName + params.Items = append(params.Items, &ast.FuncParam{ + Name: ¶mName, + Type: &ast.TypeName{Name: types.TypeToStr(sp.ParamType.GetType(), sp.ParamType.GetCharset())}, + }) + } + return &ast.CreateFunctionStmt{ + Params: ¶ms, + Func: &ast.FuncName{ + Schema: n.ProcedureName.Schema.L, + Name: n.ProcedureName.Name.L, + }, + } +} + func (c *cc) convert(node pcast.Node) ast.Node { switch n := node.(type) { @@ -1215,12 +1700,12 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.ByItem: return c.convertByItem(n) + case *pcast.CallStmt: + return c.convertCallStmt(n) + case *pcast.CaseExpr: return c.convertCaseExpr(n) - case *pcast.ChangeStmt: - return c.convertChangeStmt(n) - case *pcast.CleanupTableLockStmt: return c.convertCleanupTableLockStmt(n) @@ -1356,9 +1841,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) @@ -1419,15 +1901,12 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.PatternInExpr: return c.convertPatternInExpr(n) - case *pcast.PatternLikeExpr: + case *pcast.PatternLikeOrIlikeExpr: return c.convertPatternLikeExpr(n) case *pcast.PatternRegexpExpr: return c.convertPatternRegexpExpr(n) - case *pcast.PlacementSpec: - return c.convertPlacementSpec(n) - case *pcast.PositionExpr: return c.convertPositionExpr(n) @@ -1437,6 +1916,9 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.PrivElem: return c.convertPrivElem(n) + case *pcast.ProcedureInfo: + return c.convertProcedureInfo(n) + case *pcast.RecoverTableStmt: return c.convertRecoverTableStmt(n) diff --git a/internal/engine/dolphin/format.go b/internal/engine/dolphin/format.go new file mode 100644 index 0000000000..9c6346756c --- /dev/null +++ b/internal/engine/dolphin/format.go @@ -0,0 +1,43 @@ +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) string { + return "?" +} + +// NamedParam returns the named parameter placeholder for the given name. +// MySQL doesn't have native named parameters, so we use ? (positional). +// The actual parameter names are handled by sqlc's rewrite phase. +func (p *Parser) NamedParam(name string) 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 397fdafe88..537f7ad64f 100644 --- a/internal/engine/dolphin/parse.go +++ b/internal/engine/dolphin/parse.go @@ -3,17 +3,16 @@ package dolphin import ( "errors" "io" - "io/ioutil" "regexp" "strconv" "strings" - "github.com/pingcap/parser" - _ "github.com/pingcap/parser/test_driver" + "github.com/pingcap/tidb/pkg/parser" + _ "github.com/pingcap/tidb/pkg/parser/test_driver" - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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 { @@ -50,7 +49,7 @@ func normalizeErr(err error) error { } func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - blob, err := ioutil.ReadAll(r) + blob, err := io.ReadAll(r) if err != nil { return nil, err } @@ -70,11 +69,16 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { text := stmtNodes[i].Text() loc := strings.Index(string(blob), text) + stmtLen := len(text) + if text[stmtLen-1] == ';' { + stmtLen -= 1 // Subtract one to remove semicolon + } + stmts = append(stmts, ast.Statement{ Raw: &ast.RawStmt{ Stmt: out, StmtLocation: loc, - StmtLen: len(text) - 1, // Subtract one to remove semicolon + StmtLen: stmtLen, }, }) } @@ -82,8 +86,8 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { } // 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/stdlib.go b/internal/engine/dolphin/stdlib.go index f03e9556a3..46ce500eb5 100644 --- a/internal/engine/dolphin/stdlib.go +++ b/internal/engine/dolphin/stdlib.go @@ -1,8 +1,8 @@ package dolphin import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) func defaultSchema(name string) *catalog.Schema { @@ -630,6 +630,22 @@ func defaultSchema(name string) *catalog.Schema { { Type: &ast.TypeName{Name: "any"}, }, + { + Type: &ast.TypeName{Name: "any"}, + }, + }, + ReturnType: &ast.TypeName{Name: "date"}, + }, + { + // DATE_ADD with INTERVAL expression (2 args) + Name: "DATE_ADD", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "date"}, + }, + { + Type: &ast.TypeName{Name: "interval"}, + }, }, ReturnType: &ast.TypeName{Name: "date"}, }, @@ -666,6 +682,22 @@ func defaultSchema(name string) *catalog.Schema { { Type: &ast.TypeName{Name: "any"}, }, + { + Type: &ast.TypeName{Name: "any"}, + }, + }, + ReturnType: &ast.TypeName{Name: "date"}, + }, + { + // DATE_SUB with INTERVAL expression (2 args) + Name: "DATE_SUB", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "date"}, + }, + { + Type: &ast.TypeName{Name: "interval"}, + }, }, ReturnType: &ast.TypeName{Name: "date"}, }, @@ -1063,8 +1095,13 @@ func defaultSchema(name string) *catalog.Schema { { Type: &ast.TypeName{Name: "any"}, }, + { + Type: &ast.TypeName{Name: "any"}, + Mode: ast.FuncParamVariadic, + }, }, - ReturnType: &ast.TypeName{Name: "any"}, + ReturnType: &ast.TypeName{Name: "text"}, + ReturnTypeNullable: true, }, { Name: "GTID_SUBSET", @@ -1795,6 +1832,15 @@ func defaultSchema(name string) *catalog.Schema { 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{ @@ -2368,6 +2414,15 @@ func defaultSchema(name string) *catalog.Schema { Args: []*catalog.Argument{}, ReturnType: &ast.TypeName{Name: "datetime"}, }, + { + Name: "NEXTVAL", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "any"}, + }, + }, + ReturnType: &ast.TypeName{Name: "int"}, + }, { Name: "NOW", Args: []*catalog.Argument{ @@ -5282,7 +5337,7 @@ func defaultSchema(name string) *catalog.Schema { Type: &ast.TypeName{Name: "datetime"}, }, }, - ReturnType: &ast.TypeName{Name: "datetime"}, + ReturnType: &ast.TypeName{Name: "int"}, }, { Name: "TIME_FORMAT", diff --git a/internal/engine/dolphin/utils.go b/internal/engine/dolphin/utils.go index 01cc2fa9ff..e920489e6a 100644 --- a/internal/engine/dolphin/utils.go +++ b/internal/engine/dolphin/utils.go @@ -1,73 +1,16 @@ package dolphin import ( - pcast "github.com/pingcap/parser/ast" + pcast "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/parser/mysql" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) -type nodeSearch struct { - list []pcast.Node - check func(pcast.Node) bool -} - -func (s *nodeSearch) Enter(n pcast.Node) (pcast.Node, bool) { - if s.check(n) { - s.list = append(s.list, n) - } - return n, false // skipChildren -} - -func (s *nodeSearch) Leave(n pcast.Node) (pcast.Node, bool) { - return n, true // ok -} - -func collect(root pcast.Node, f func(pcast.Node) bool) []pcast.Node { - if root == nil { - return nil - } - ns := &nodeSearch{check: f} - root.Accept(ns) - return ns.list -} - -type nodeVisit struct { - fn func(pcast.Node) -} - -func (s *nodeVisit) Enter(n pcast.Node) (pcast.Node, bool) { - s.fn(n) - return n, false // skipChildren -} - -func (s *nodeVisit) Leave(n pcast.Node) (pcast.Node, bool) { - return n, true // ok -} - -func visit(root pcast.Node, f func(pcast.Node)) { - if root == nil { - return - } - ns := &nodeVisit{fn: f} - root.Accept(ns) -} - -// Maybe not useful? -func text(nodes []pcast.Node) []string { - str := make([]string, len(nodes)) - for i := range nodes { - if nodes[i] == nil { - continue - } - str[i] = nodes[i].Text() - } - return str -} - func parseTableName(n *pcast.TableName) *ast.TableName { return &ast.TableName{ - Schema: n.Schema.String(), - Name: n.Name.String(), + Schema: identifier(n.Schema.String()), + Name: identifier(n.Name.String()), } } @@ -76,9 +19,9 @@ func toList(node pcast.Node) *ast.List { switch n := node.(type) { case *pcast.TableName: if schema := n.Schema.String(); schema != "" { - items = append(items, &ast.String{Str: schema}) + items = append(items, NewIdentifier(schema)) } - items = append(items, &ast.String{Str: n.Name.String()}) + items = append(items, NewIdentifier(n.Name.String())) default: return nil } @@ -96,3 +39,56 @@ func isNotNull(n *pcast.ColumnDef) bool { } return false } + +func convertToRangeVarList(list *ast.List, result *ast.List) { + if len(list.Items) == 0 { + return + } + switch rel := list.Items[0].(type) { + + // Special case for joins in updates + case *ast.JoinExpr: + left, ok := rel.Larg.(*ast.RangeVar) + 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") + } + } + if left != nil { + result.Items = append(result.Items, left) + } + + right, ok := rel.Rarg.(*ast.RangeVar) + 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") + } + } + if right != nil { + result.Items = append(result.Items, right) + } + + case *ast.RangeVar: + result.Items = append(result.Items, rel) + + case *ast.RangeSubselect: + result.Items = append(result.Items, rel) + + default: + panic("expected range var") + } +} + +func isUnsigned(n *pcast.ColumnDef) bool { + return mysql.HasUnsignedFlag(n.Tp.GetFlag()) +} diff --git a/internal/engine/postgresql/analyzer/analyze.go b/internal/engine/postgresql/analyzer/analyze.go new file mode 100644 index 0000000000..ee03e4d3c5 --- /dev/null +++ b/internal/engine/postgresql/analyzer/analyze.go @@ -0,0 +1,547 @@ +package analyzer + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgxpool" + + core "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +type Analyzer struct { + db config.Database + client dbmanager.Client + pool *pgxpool.Pool + dbg opts.Debug + replacer *shfmt.Replacer + formats sync.Map + columns sync.Map + tables sync.Map +} + +func New(client dbmanager.Client, db config.Database) *Analyzer { + return &Analyzer{ + db: db, + dbg: opts.DebugFromEnv(), + client: client, + replacer: shfmt.NewReplacer(nil), + } +} + +const columnQuery = ` +SELECT + pg_catalog.format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS data_type, + pg_attribute.attnotnull as not_null, + pg_attribute.attndims as array_dims +FROM + pg_catalog.pg_attribute +WHERE + attrelid = $1 + AND attnum = $2; +` + +const tableQuery = ` +SELECT + pg_class.relname as table_name, + pg_namespace.nspname as schema_name +FROM + pg_catalog.pg_class +JOIN + pg_catalog.pg_namespace ON pg_namespace.oid = pg_class.relnamespace +WHERE + pg_class.oid = $1; +` + +type pgTable struct { + TableName string `db:"table_name"` + SchemaName string `db:"schema_name"` +} + +// Cache these types in memory +func (a *Analyzer) tableInfo(ctx context.Context, oid uint32) (*pgTable, error) { + ctbl, ok := a.tables.Load(oid) + if ok { + return ctbl.(*pgTable), nil + } + rows, err := a.pool.Query(ctx, tableQuery, oid) + if err != nil { + return nil, err + } + tbl, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[pgTable]) + if err != nil { + return nil, err + } + a.tables.Store(oid, &tbl) + return &tbl, nil +} + +type pgColumn struct { + DataType string `db:"data_type"` + NotNull bool `db:"not_null"` + ArrayDims int `db:"array_dims"` +} + +type columnKey struct { + OID uint32 + Attr uint16 +} + +// Cache these types in memory +func (a *Analyzer) columnInfo(ctx context.Context, field pgconn.FieldDescription) (*pgColumn, error) { + key := columnKey{field.TableOID, field.TableAttributeNumber} + cinfo, ok := a.columns.Load(key) + if ok { + return cinfo.(*pgColumn), nil + } + rows, err := a.pool.Query(ctx, columnQuery, field.TableOID, int16(field.TableAttributeNumber)) + if err != nil { + return nil, err + } + col, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[pgColumn]) + if err != nil { + return nil, err + } + a.columns.Store(key, &col) + return &col, nil +} + +type formatKey struct { + OID uint32 + Modified int32 +} + +// TODO: Use PGX to do the lookup for basic OID types +func (a *Analyzer) formatType(ctx context.Context, oid uint32, modifier int32) (string, error) { + key := formatKey{oid, modifier} + ftyp, ok := a.formats.Load(key) + if ok { + return ftyp.(string), nil + } + rows, err := a.pool.Query(ctx, `SELECT format_type($1, $2)`, oid, modifier) + if err != nil { + return "", err + } + dt, err := pgx.CollectOneRow(rows, pgx.RowTo[string]) + if err != nil { + return "", err + } + a.formats.Store(key, dt) + return dt, err +} + +// TODO: This is bad +func rewriteType(dt string) string { + switch { + case strings.HasPrefix(dt, "character("): + return "pg_catalog.bpchar" + case strings.HasPrefix(dt, "character varying"): + return "pg_catalog.varchar" + case strings.HasPrefix(dt, "bit varying"): + return "pg_catalog.varbit" + case strings.HasPrefix(dt, "bit("): + return "pg_catalog.bit" + } + switch dt { + case "bpchar": + return "pg_catalog.bpchar" + case "timestamp without time zone": + return "pg_catalog.timestamp" + case "timestamp with time zone": + return "pg_catalog.timestamptz" + case "time without time zone": + return "pg_catalog.time" + case "time with time zone": + return "pg_catalog.timetz" + } + return dt +} + +func parseType(dt string) (string, bool, int) { + size := 0 + for { + trimmed := strings.TrimSuffix(dt, "[]") + if trimmed == dt { + return rewriteType(dt), size > 0, size + } + size += 1 + dt = trimmed + } +} + +// Don't create a database per query +func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrations []string, ps *named.ParamSet) (*core.Analysis, error) { + extractSqlErr := func(e error) error { + var pgErr *pgconn.PgError + if errors.As(e, &pgErr) { + return &sqlerr.Error{ + Code: pgErr.Code, + Message: pgErr.Message, + Location: max(n.Pos()+int(pgErr.Position)-1, 0), + } + } + return e + } + + if a.pool == nil { + var uri string + if a.db.Managed { + if a.client == nil { + return nil, fmt.Errorf("client is nil") + } + edb, err := a.client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: "postgresql", + Migrations: migrations, + }) + if err != nil { + return nil, err + } + uri = edb.Uri + } else if a.dbg.OnlyManagedDatabases { + return nil, fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") + } else { + uri = a.replacer.Replace(a.db.URI) + } + conf, err := pgxpool.ParseConfig(uri) + if err != nil { + return nil, err + } + pool, err := pgxpool.NewWithConfig(ctx, conf) + if err != nil { + return nil, err + } + a.pool = pool + } + + c, err := a.pool.Acquire(ctx) + if err != nil { + return nil, err + } + defer c.Release() + + // TODO: Pick a random name + desc, err := c.Conn().Prepare(ctx, "foo", query) + if err != nil { + return nil, extractSqlErr(err) + } + + if err := c.Conn().Deallocate(ctx, "foo"); err != nil { + return nil, err + } + + var result core.Analysis + for _, field := range desc.Fields { + if field.TableOID > 0 { + col, err := a.columnInfo(ctx, field) + if err != nil { + return nil, err + } + // debug.Dump(i, field, col) + tbl, err := a.tableInfo(ctx, field.TableOID) + if err != nil { + return nil, err + } + dt, isArray, dims := parseType(col.DataType) + notNull := col.NotNull + name := field.Name + result.Columns = append(result.Columns, &core.Column{ + Name: name, + OriginalName: field.Name, + DataType: dt, + NotNull: notNull, + IsArray: isArray, + ArrayDims: int32(max(col.ArrayDims, dims)), + Table: &core.Identifier{ + Schema: tbl.SchemaName, + Name: tbl.TableName, + }, + }) + } else { + dataType, err := a.formatType(ctx, field.DataTypeOID, field.TypeModifier) + if err != nil { + return nil, err + } + // debug.Dump(i, field, dataType) + notNull := false + name := field.Name + dt, isArray, dims := parseType(dataType) + result.Columns = append(result.Columns, &core.Column{ + Name: name, + OriginalName: field.Name, + DataType: dt, + NotNull: notNull, + IsArray: isArray, + ArrayDims: int32(dims), + }) + } + } + + for i, oid := range desc.ParamOIDs { + dataType, err := a.formatType(ctx, oid, -1) + if err != nil { + return nil, err + } + notNull := false + dt, isArray, dims := parseType(dataType) + name := "" + if ps != nil { + name, _ = ps.NameFor(i + 1) + } + result.Params = append(result.Params, &core.Parameter{ + Number: int32(i + 1), + Column: &core.Column{ + Name: name, + DataType: dt, + IsArray: isArray, + ArrayDims: int32(dims), + NotNull: notNull, + }, + }) + } + + return &result, nil +} + +func (a *Analyzer) Close(_ context.Context) error { + if a.pool != nil { + a.pool.Close() + } + return nil +} + +// SQL queries for schema introspection +const introspectTablesQuery = ` +SELECT + n.nspname AS schema_name, + c.relname AS table_name, + a.attname AS column_name, + pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type, + a.attnotnull AS not_null, + a.attndims AS array_dims, + COALESCE( + (SELECT true FROM pg_index i + WHERE i.indrelid = c.oid + AND i.indisprimary + AND a.attnum = ANY(i.indkey)), + false + ) AS is_primary_key +FROM + pg_catalog.pg_class c +JOIN + pg_catalog.pg_namespace n ON n.oid = c.relnamespace +JOIN + pg_catalog.pg_attribute a ON a.attrelid = c.oid +WHERE + c.relkind IN ('r', 'v', 'p') -- tables, views, partitioned tables + AND a.attnum > 0 -- skip system columns + AND NOT a.attisdropped + AND n.nspname = ANY($1) +ORDER BY + n.nspname, c.relname, a.attnum +` + +const introspectEnumsQuery = ` +SELECT + n.nspname AS schema_name, + t.typname AS type_name, + e.enumlabel AS enum_value +FROM + pg_catalog.pg_type t +JOIN + pg_catalog.pg_namespace n ON n.oid = t.typnamespace +JOIN + pg_catalog.pg_enum e ON e.enumtypid = t.oid +WHERE + t.typtype = 'e' + AND n.nspname = ANY($1) +ORDER BY + n.nspname, t.typname, e.enumsortorder +` + +type introspectedColumn struct { + SchemaName string `db:"schema_name"` + TableName string `db:"table_name"` + ColumnName string `db:"column_name"` + DataType string `db:"data_type"` + NotNull bool `db:"not_null"` + ArrayDims int `db:"array_dims"` + IsPrimaryKey bool `db:"is_primary_key"` +} + +type introspectedEnum struct { + SchemaName string `db:"schema_name"` + TypeName string `db:"type_name"` + EnumValue string `db:"enum_value"` +} + +// IntrospectSchema queries the database to build a catalog containing +// tables, columns, and enum types for the specified schemas. +func (a *Analyzer) IntrospectSchema(ctx context.Context, schemas []string) (*catalog.Catalog, error) { + if a.pool == nil { + return nil, fmt.Errorf("database connection not initialized") + } + + c, err := a.pool.Acquire(ctx) + if err != nil { + return nil, err + } + defer c.Release() + + // Query tables and columns + rows, err := c.Query(ctx, introspectTablesQuery, schemas) + if err != nil { + return nil, fmt.Errorf("introspect tables: %w", err) + } + columns, err := pgx.CollectRows(rows, pgx.RowToStructByName[introspectedColumn]) + if err != nil { + return nil, fmt.Errorf("collect table rows: %w", err) + } + + // Query enums + enumRows, err := c.Query(ctx, introspectEnumsQuery, schemas) + if err != nil { + return nil, fmt.Errorf("introspect enums: %w", err) + } + enums, err := pgx.CollectRows(enumRows, pgx.RowToStructByName[introspectedEnum]) + if err != nil { + return nil, fmt.Errorf("collect enum rows: %w", err) + } + + // Build catalog + cat := &catalog.Catalog{ + DefaultSchema: "public", + SearchPath: schemas, + } + + // Create schema map for quick lookup + schemaMap := make(map[string]*catalog.Schema) + for _, schemaName := range schemas { + schema := &catalog.Schema{Name: schemaName} + cat.Schemas = append(cat.Schemas, schema) + schemaMap[schemaName] = schema + } + + // Group columns by table + tableMap := make(map[string]*catalog.Table) + for _, col := range columns { + key := col.SchemaName + "." + col.TableName + tbl, exists := tableMap[key] + if !exists { + tbl = &catalog.Table{ + Rel: &ast.TableName{ + Schema: col.SchemaName, + Name: col.TableName, + }, + } + tableMap[key] = tbl + if schema, ok := schemaMap[col.SchemaName]; ok { + schema.Tables = append(schema.Tables, tbl) + } + } + + dt, isArray, dims := parseType(col.DataType) + tbl.Columns = append(tbl.Columns, &catalog.Column{ + Name: col.ColumnName, + Type: ast.TypeName{Name: dt}, + IsNotNull: col.NotNull, + IsArray: isArray || col.ArrayDims > 0, + ArrayDims: max(dims, col.ArrayDims), + }) + } + + // Group enum values by type + enumMap := make(map[string]*catalog.Enum) + for _, e := range enums { + key := e.SchemaName + "." + e.TypeName + enum, exists := enumMap[key] + if !exists { + enum = &catalog.Enum{ + Name: e.TypeName, + } + enumMap[key] = enum + if schema, ok := schemaMap[e.SchemaName]; ok { + schema.Types = append(schema.Types, enum) + } + } + enum.Vals = append(enum.Vals, e.EnumValue) + } + + return cat, nil +} + +// EnsureConn initializes the database connection pool if not already done. +// This is useful for database-only mode where we need to connect before analyzing queries. +func (a *Analyzer) EnsureConn(ctx context.Context, migrations []string) error { + if a.pool != nil { + return nil + } + + var uri string + if a.db.Managed { + if a.client == nil { + return fmt.Errorf("client is nil") + } + edb, err := a.client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: "postgresql", + Migrations: migrations, + }) + if err != nil { + return err + } + uri = edb.Uri + } else if a.dbg.OnlyManagedDatabases { + return fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") + } else { + uri = a.replacer.Replace(a.db.URI) + } + + conf, err := pgxpool.ParseConfig(uri) + if err != nil { + return err + } + pool, err := pgxpool.NewWithConfig(ctx, conf) + if err != nil { + return err + } + a.pool = pool + return nil +} + +// GetColumnNames implements the expander.ColumnGetter interface. +// It prepares a query and returns the column names from the result set description. +func (a *Analyzer) GetColumnNames(ctx context.Context, query string) ([]string, error) { + if a.pool == nil { + return nil, fmt.Errorf("database connection not initialized") + } + + conn, err := a.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 +} diff --git a/internal/engine/postgresql/catalog.go b/internal/engine/postgresql/catalog.go index 354a05a184..3c262122a2 100644 --- a/internal/engine/postgresql/catalog.go +++ b/internal/engine/postgresql/catalog.go @@ -1,21 +1,19 @@ package postgresql -import "github.com/kyleconroy/sqlc/internal/sql/catalog" +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 +} func NewCatalog() *catalog.Catalog { c := catalog.New("public") c.Schemas = append(c.Schemas, pgTemp()) c.Schemas = append(c.Schemas, genPGCatalog()) + c.Schemas = append(c.Schemas, genInformationSchema()) c.SearchPath = []string{"pg_catalog"} c.LoadExtension = loadExtension return c } - -// The generated pg_catalog is very slow to compare because it has so -// many entries. For testing, don't include it. -func newTestCatalog() *catalog.Catalog { - c := catalog.New("public") - c.Schemas = append(c.Schemas, pgTemp()) - c.LoadExtension = loadExtension - return c -} diff --git a/internal/engine/postgresql/catalog_test.go b/internal/engine/postgresql/catalog_test.go index 537cdb857e..875ea7e458 100644 --- a/internal/engine/postgresql/catalog_test.go +++ b/internal/engine/postgresql/catalog_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" "github.com/google/go-cmp/cmp" ) diff --git a/internal/engine/postgresql/contrib/adminpack.go b/internal/engine/postgresql/contrib/adminpack.go index 45cd9a1e38..1e47e12434 100644 --- a/internal/engine/postgresql/contrib/adminpack.go +++ b/internal/engine/postgresql/contrib/adminpack.go @@ -3,69 +3,80 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Adminpack() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "pg_file_rename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, +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"}, - }, + 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_unlink", - Args: []*catalog.Argument{ - { - 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: "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: "void"}, + }, + { + Name: "pg_file_unlink", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, - { - Name: "pg_logdir_ls", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, + 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 index 98b116449f..156cb43eb7 100644 --- a/internal/engine/postgresql/contrib/amcheck.go +++ b/internal/engine/postgresql/contrib/amcheck.go @@ -3,79 +3,116 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Amcheck() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "bt_index_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, +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_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"}, }, - 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"}, }, - 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: "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"}, }, - } + 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 index f4a33affe7..54a5000a26 100644 --- a/internal/engine/postgresql/contrib/btree_gin.go +++ b/internal/engine/postgresql/contrib/btree_gin.go @@ -3,37 +3,39 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func BtreeGin() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "gin_enum_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, +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"}, + }, + { + Name: "gin_numeric_cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "numeric"}, + }, + { + Type: &ast.TypeName{Name: "numeric"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - } + 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 index 6cebee5de6..b5b3ddaf6f 100644 --- a/internal/engine/postgresql/contrib/btree_gist.go +++ b/internal/engine/postgresql/contrib/btree_gist.go @@ -3,247 +3,267 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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: "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"}, - }, - } + s.Funcs = funcsBtreeGist return s } diff --git a/internal/engine/postgresql/contrib/citext.go b/internal/engine/postgresql/contrib/citext.go index f0c7519dc7..d5749cacdf 100644 --- a/internal/engine/postgresql/contrib/citext.go +++ b/internal/engine/postgresql/contrib/citext.go @@ -3,568 +3,570 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - 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"}, - }, - { - 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_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"}, - }, - { - 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_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: "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: "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"}, - }, - } + s.Funcs = funcsCitext return s } diff --git a/internal/engine/postgresql/contrib/cube.go b/internal/engine/postgresql/contrib/cube.go index 687eb93e2c..cb883db658 100644 --- a/internal/engine/postgresql/contrib/cube.go +++ b/internal/engine/postgresql/contrib/cube.go @@ -3,382 +3,393 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - 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[]"}, - }, - { - 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: "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: "cube"}, - }, - { - 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_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"}, - }, - } + s.Funcs = funcsCube return s } diff --git a/internal/engine/postgresql/contrib/dblink.go b/internal/engine/postgresql/contrib/dblink.go index c5208cf1e2..b24cd16a52 100644 --- a/internal/engine/postgresql/contrib/dblink.go +++ b/internal/engine/postgresql/contrib/dblink.go @@ -3,486 +3,503 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - 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", - 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: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - 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"}, - }, - { - 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: "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: "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{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_disconnect", - Args: []*catalog.Argument{}, - 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: "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: "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: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_connections", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - 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"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_result", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - 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"}, - }, - { - 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"}, - }, - }, - 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_send_query", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - } + s.Funcs = funcsDblink return s } diff --git a/internal/engine/postgresql/contrib/earthdistance.go b/internal/engine/postgresql/contrib/earthdistance.go index e9c25d0dd1..5c0bfa7cd5 100644 --- a/internal/engine/postgresql/contrib/earthdistance.go +++ b/internal/engine/postgresql/contrib/earthdistance.go @@ -3,102 +3,104 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Earthdistance() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, - }, +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: "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: "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: "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: "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: "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: "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"}, + }, + { + Name: "sec_to_gc", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "double precision"}, }, - ReturnType: &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 index ec4621ba3b..36d6db31d5 100644 --- a/internal/engine/postgresql/contrib/file_fdw.go +++ b/internal/engine/postgresql/contrib/file_fdw.go @@ -3,30 +3,32 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func FileFdw() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, - }, +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"}, }, - } + 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 index b2174ebf03..fcf0ddea83 100644 --- a/internal/engine/postgresql/contrib/fuzzystrmatch.go +++ b/internal/engine/postgresql/contrib/fuzzystrmatch.go @@ -3,145 +3,147 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Fuzzystrmatch() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "difference", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, +var funcsFuzzystrmatch = []*catalog.Function{ + { + Name: "difference", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "dmetaphone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "dmetaphone", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "dmetaphone_alt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "dmetaphone_alt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "levenshtein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "levenshtein", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - Name: "metaphone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "metaphone", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, + }, }, - { - Name: "soundex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "soundex", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "text_soundex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &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 index a3ad1b27a9..77403f1913 100644 --- a/internal/engine/postgresql/contrib/hstore.go +++ b/internal/engine/postgresql/contrib/hstore.go @@ -3,508 +3,520 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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: "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: "delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - 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[]"}, - }, - }, - 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"}, - }, - { - 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"}, - }, - } + s.Funcs = funcsHstore return s } diff --git a/internal/engine/postgresql/contrib/intagg.go b/internal/engine/postgresql/contrib/intagg.go index 7e3591ac5c..a1c1b83c33 100644 --- a/internal/engine/postgresql/contrib/intagg.go +++ b/internal/engine/postgresql/contrib/intagg.go @@ -3,31 +3,33 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Intagg() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "int_array_aggregate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, +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[]"}, + }, + { + Name: "int_array_enum", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, }, - ReturnType: &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 index 9fb23b0d28..24005a8bc1 100644 --- a/internal/engine/postgresql/contrib/intarray.go +++ b/internal/engine/postgresql/contrib/intarray.go @@ -3,331 +3,333 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Intarray() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "_int_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, +var funcsIntarray = []*catalog.Function{ + { + Name: "_int_contained", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "_int_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "_int_contains", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "_int_different", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "_int_different", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "_int_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &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[]"}, + }, }, - { - Name: "_int_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "_int_overlap", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "_int_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "_int_same", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "_int_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &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[]"}, + }, }, - { - Name: "_intbig_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "intbig_gkey"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "_intbig_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, + }, }, - { - Name: "_intbig_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "intbig_gkey"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, + ReturnType: &ast.TypeName{Name: "intbig_gkey"}, + }, + { + Name: "_intbig_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "intbig_gkey"}, + }, }, - { - Name: "boolop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "cstring"}, + }, + { + Name: "boolop", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "query_int"}, + }, }, - { - Name: "bqarr_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "query_int"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bqarr_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, + }, }, - { - Name: "bqarr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, + ReturnType: &ast.TypeName{Name: "query_int"}, + }, + { + Name: "bqarr_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "query_int"}, + }, }, - { - Name: "icount", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, + ReturnType: &ast.TypeName{Name: "cstring"}, + }, + { + Name: "icount", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "idx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "idx", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "intarray_del_elem", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "intarray_push_array", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "intarray_push_elem", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, + }, }, - { - Name: "intset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "intset", + Args: []*catalog.Argument{ + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "intset_subtract", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "intset_union_elem", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, + }, }, - { - Name: "querytree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "querytree", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "query_int"}, + }, }, - { - Name: "rboolop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "rboolop", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "query_int"}, + }, + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "sort", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "sort", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "sort", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "sort", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "sort_asc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "sort_asc", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, }, - { - Name: "sort_desc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "sort_desc", + Args: []*catalog.Argument{ + { + Type: &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[]"}, + ReturnType: &ast.TypeName{Name: "integer[]"}, + }, + { + Name: "subarray", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer[]"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, + }, }, - { - Name: "subarray", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &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"}, + }, }, - { - Name: "uniq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &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 index ab49dc3a3e..98220a434a 100644 --- a/internal/engine/postgresql/contrib/isn.go +++ b/internal/engine/postgresql/contrib/isn.go @@ -3,2802 +3,2804 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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: "ismn"}, - }, - }, - 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: "upc"}, - }, - }, - 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: "ismn13"}, - }, - }, - 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: "issn"}, - }, - }, - 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: "btisbn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "ismn"}, - }, - }, - 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: "ismn13"}, - }, - }, - 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: "btismncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "issn13"}, - }, - }, - 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: "ean13"}, - }, - }, - 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: "ismn13"}, - }, - }, - 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: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ean13_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - 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: "isbn13"}, - }, - }, - 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: "isbn"}, - }, - }, - 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: "issn"}, - }, - }, - 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: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "isn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - 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_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: "upc"}, - }, - }, - 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: "isbn13"}, - }, - }, - 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: "issn13"}, - }, - }, - 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: "ismn"}, - }, - }, - 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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - 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: "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: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "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: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "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: "issn"}, - }, - { - 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: "isneq", - 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: "isbn"}, - }, - { - 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: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - 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: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "ismn"}, - }, - { - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "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: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "issn13"}, - }, - { - 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: "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: "issn"}, - }, - }, - 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: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - 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: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - 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: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "upc"}, - }, - }, - 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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - 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: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "upc"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "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: "ean13"}, - }, - { - 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: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - 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: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - 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: "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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - 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: "ismn"}, - }, - }, - 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: "issn13"}, - }, - }, - 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: "isbn13"}, - }, - { - 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: "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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "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: "issn13"}, - }, - }, - 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: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - 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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - 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: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - 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: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - 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: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "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: "upc"}, - }, - { - 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: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - 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: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - 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: "isbn"}, - }, - { - 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: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - 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: "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: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - 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: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn13"}, - }, - { - 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: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn"}, - }, - { - 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: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn13"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "upc"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn13"}, - }, - { - 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"}, - }, - } + s.Funcs = funcsIsn return s } diff --git a/internal/engine/postgresql/contrib/lo.go b/internal/engine/postgresql/contrib/lo.go index 465190c480..1e6869c1d6 100644 --- a/internal/engine/postgresql/contrib/lo.go +++ b/internal/engine/postgresql/contrib/lo.go @@ -3,27 +3,29 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Lo() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "lo_manage", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "lo_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lo"}, - }, +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"}, }, - } + 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 index aabc28ae61..d149aee058 100644 --- a/internal/engine/postgresql/contrib/ltree.go +++ b/internal/engine/postgresql/contrib/ltree.go @@ -3,721 +3,750 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "index", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - 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[]"}, - }, - }, - 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: "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: "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_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: "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"}, - }, - } + s.Funcs = funcsLtree return s } diff --git a/internal/engine/postgresql/contrib/pageinspect.go b/internal/engine/postgresql/contrib/pageinspect.go index 61e838e715..5a733eec2e 100644 --- a/internal/engine/postgresql/contrib/pageinspect.go +++ b/internal/engine/postgresql/contrib/pageinspect.go @@ -3,140 +3,398 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - Name: "brin_page_type", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - 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: "integer"}, - }, - }, - 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: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "hash_page_type", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "page_checksum", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - 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[]"}, - }, - { - 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[]"}, - }, - } + s.Funcs = funcsPageinspect return s } diff --git a/internal/engine/postgresql/contrib/pg_buffercache.go b/internal/engine/postgresql/contrib/pg_buffercache.go index 047afbeea7..8f10545121 100644 --- a/internal/engine/postgresql/contrib/pg_buffercache.go +++ b/internal/engine/postgresql/contrib/pg_buffercache.go @@ -3,18 +3,20 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - Name: "pg_buffercache_pages", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - } + s.Funcs = funcsPgBuffercache return s } diff --git a/internal/engine/postgresql/contrib/pg_freespacemap.go b/internal/engine/postgresql/contrib/pg_freespacemap.go index de72dc8a82..02aed8630e 100644 --- a/internal/engine/postgresql/contrib/pg_freespacemap.go +++ b/internal/engine/postgresql/contrib/pg_freespacemap.go @@ -3,25 +3,37 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func PgFreespacemap() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "pg_freespace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, +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"}, }, - } + 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 index a8ccec3a3f..4fbd8910aa 100644 --- a/internal/engine/postgresql/contrib/pg_prewarm.go +++ b/internal/engine/postgresql/contrib/pg_prewarm.go @@ -3,52 +3,54 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func PgPrewarm() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, - }, +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"}, }, - } + 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 index ad9e56b3cd..a0c5fc73d7 100644 --- a/internal/engine/postgresql/contrib/pg_stat_statements.go +++ b/internal/engine/postgresql/contrib/pg_stat_statements.go @@ -3,34 +3,51 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func PgStatStatements() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - 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"}, - }, +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"}, }, - } + 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 index f450cae43f..92639009eb 100644 --- a/internal/engine/postgresql/contrib/pg_trgm.go +++ b/internal/engine/postgresql/contrib/pg_trgm.go @@ -3,210 +3,212 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*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"}, - }, - } + s.Funcs = funcsPgTrgm return s } diff --git a/internal/engine/postgresql/contrib/pg_visibility.go b/internal/engine/postgresql/contrib/pg_visibility.go index 7a4b0ea179..f546ad0f12 100644 --- a/internal/engine/postgresql/contrib/pg_visibility.go +++ b/internal/engine/postgresql/contrib/pg_visibility.go @@ -3,22 +3,95 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func PgVisibility() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "pg_truncate_visibility_map", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, +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: "void"}, }, - } + 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 index 5a2468c4e6..ef1fc073bc 100644 --- a/internal/engine/postgresql/contrib/pgcrypto.go +++ b/internal/engine/postgresql/contrib/pgcrypto.go @@ -3,474 +3,480 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - 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: "armor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - 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_random_uuid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - 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: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - 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: "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"}, - }, - { - 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"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - 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_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_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", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - 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"}, - }, - }, - 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"}, - }, - { - 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"}, - }, - }, - 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"}, - }, - { - 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_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_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - } + s.Funcs = funcsPgcrypto return s } diff --git a/internal/engine/postgresql/contrib/pgrowlocks.go b/internal/engine/postgresql/contrib/pgrowlocks.go new file mode 100644 index 0000000000..1bd8af0163 --- /dev/null +++ b/internal/engine/postgresql/contrib/pgrowlocks.go @@ -0,0 +1,27 @@ +// 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 index 2c128f9c38..4ac5b18345 100644 --- a/internal/engine/postgresql/contrib/pgstattuple.go +++ b/internal/engine/postgresql/contrib/pgstattuple.go @@ -3,33 +3,105 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - Name: "pg_relpages", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_relpages", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - } + s.Funcs = funcsPgstattuple return s } diff --git a/internal/engine/postgresql/contrib/postgres_fdw.go b/internal/engine/postgresql/contrib/postgres_fdw.go index 02e11a2976..cf8d9746ff 100644 --- a/internal/engine/postgresql/contrib/postgres_fdw.go +++ b/internal/engine/postgresql/contrib/postgres_fdw.go @@ -3,30 +3,51 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func PostgresFdw() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "postgres_fdw_handler", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "fdw_handler"}, +var funcsPostgresFdw = []*catalog.Function{ + { + Name: "postgres_fdw_disconnect", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "postgres_fdw_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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"}, }, - } + 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 index 87359afad7..20de65a1ef 100644 --- a/internal/engine/postgresql/contrib/seg.go +++ b/internal/engine/postgresql/contrib/seg.go @@ -3,259 +3,261 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Seg() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "seg_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, +var funcsSeg = []*catalog.Function{ + { + Name: "seg_center", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, + ReturnType: &ast.TypeName{Name: "real"}, + }, + { + Name: "seg_cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "seg_contained", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_contains", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_different", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_different", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "seg"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, + }, }, - { - Name: "seg_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "seg"}, + ReturnType: &ast.TypeName{Name: "seg"}, + }, + { + Name: "seg_inter", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &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"}, + ReturnType: &ast.TypeName{Name: "seg"}, + }, + { + Name: "seg_le", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_left", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_lower", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "real"}, + }, + { + Name: "seg_lt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_over_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "cstring"}, + }, + { + Name: "seg_over_left", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_over_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_over_right", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_overlap", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_right", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_same", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "seg_size", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "seg"}, + }, }, - { - Name: "seg_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &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"}, + }, }, - { - Name: "seg_upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, + 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 index e7c23e0199..b7327d0a3f 100644 --- a/internal/engine/postgresql/contrib/sslinfo.go +++ b/internal/engine/postgresql/contrib/sslinfo.go @@ -3,66 +3,73 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Sslinfo() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, - }, +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_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_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"}, }, - } + 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 index 1c8af295dd..611a36ed19 100644 --- a/internal/engine/postgresql/contrib/tablefunc.go +++ b/internal/engine/postgresql/contrib/tablefunc.go @@ -3,184 +3,186 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Tablefunc() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, +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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, + ReturnType: &ast.TypeName{Name: "record"}, + }, + { + Name: "crosstab", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, + ReturnType: &ast.TypeName{Name: "record"}, + }, + { + Name: "crosstab", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, + }, }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, + ReturnType: &ast.TypeName{Name: "record"}, + }, + { + Name: "crosstab", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "crosstab2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_2"}, + ReturnType: &ast.TypeName{Name: "record"}, + }, + { + Name: "crosstab2", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "crosstab3", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_3"}, + ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_2"}, + }, + { + Name: "crosstab3", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "crosstab4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_4"}, + ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_3"}, + }, + { + Name: "crosstab4", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - 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"}, + 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 index 7aa16ac581..6a227216aa 100644 --- a/internal/engine/postgresql/contrib/tcn.go +++ b/internal/engine/postgresql/contrib/tcn.go @@ -3,18 +3,20 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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 = []*catalog.Function{ - { - Name: "triggered_change_notification", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - } + s.Funcs = funcsTcn return s } diff --git a/internal/engine/postgresql/contrib/unaccent.go b/internal/engine/postgresql/contrib/unaccent.go index edb4457183..07e2e1ae9a 100644 --- a/internal/engine/postgresql/contrib/unaccent.go +++ b/internal/engine/postgresql/contrib/unaccent.go @@ -3,34 +3,36 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Unaccent() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "unaccent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regdictionary"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, +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"}, + }, + { + Name: "unaccent", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &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 index c5355eed29..1703e323a2 100644 --- a/internal/engine/postgresql/contrib/uuid_ossp.go +++ b/internal/engine/postgresql/contrib/uuid_ossp.go @@ -3,81 +3,83 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func UuidOssp() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*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"}, - }, +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"}, }, - 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"}, - }, + { + 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"}, + 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 index 9de8ba30d8..6fac3f04b9 100644 --- a/internal/engine/postgresql/contrib/xml2.go +++ b/internal/engine/postgresql/contrib/xml2.go @@ -3,187 +3,189 @@ package contrib import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func Xml2() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "xml_encode_special_chars", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, +var funcsXml2 = []*catalog.Function{ + { + Name: "xml_encode_special_chars", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "xml_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "xml_valid", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "xpath_bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "xpath_bool", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &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"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "xpath_list", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "xpath_list", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &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"}, + }, }, - { - 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"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "xpath_nodeset", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &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"}, + 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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - Name: "xpath_number", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "xpath_number", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "xpath_string", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &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"}, + }, }, - { - 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"}, + 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"}, + }, }, - { - 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"}, + ReturnType: &ast.TypeName{Name: "record"}, + }, + { + Name: "xslt_process", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, + }, }, - { - Name: "xslt_process", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &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 3f83d66706..321294c59e 100644 --- a/internal/engine/postgresql/convert.go +++ b/internal/engine/postgresql/convert.go @@ -1,14 +1,71 @@ -// +build !windows - package postgresql import ( - nodes "github.com/lfittl/pg_query_go/nodes" + "fmt" + + pg "github.com/pganalyze/pg_query_go/v6" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) -func convertList(l nodes.List) *ast.List { +func convertFuncParamMode(m pg.FunctionParameterMode) (ast.FuncParamMode, error) { + switch m { + case pg.FunctionParameterMode_FUNC_PARAM_IN: + return ast.FuncParamIn, nil + case pg.FunctionParameterMode_FUNC_PARAM_OUT: + return ast.FuncParamOut, nil + case pg.FunctionParameterMode_FUNC_PARAM_INOUT: + return ast.FuncParamInOut, nil + case pg.FunctionParameterMode_FUNC_PARAM_VARIADIC: + return ast.FuncParamVariadic, nil + case pg.FunctionParameterMode_FUNC_PARAM_TABLE: + return ast.FuncParamTable, nil + case pg.FunctionParameterMode_FUNC_PARAM_DEFAULT: + return ast.FuncParamDefault, nil + default: + return -1, fmt.Errorf("parse func param: invalid mode %v", m) + } +} + +func convertSubLinkType(t pg.SubLinkType) (ast.SubLinkType, error) { + switch t { + case pg.SubLinkType_EXISTS_SUBLINK: + return ast.EXISTS_SUBLINK, nil + case pg.SubLinkType_ALL_SUBLINK: + return ast.ALL_SUBLINK, nil + case pg.SubLinkType_ANY_SUBLINK: + return ast.ANY_SUBLINK, nil + case pg.SubLinkType_ROWCOMPARE_SUBLINK: + return ast.ROWCOMPARE_SUBLINK, nil + case pg.SubLinkType_EXPR_SUBLINK: + return ast.EXPR_SUBLINK, nil + case pg.SubLinkType_MULTIEXPR_SUBLINK: + return ast.MULTIEXPR_SUBLINK, nil + case pg.SubLinkType_ARRAY_SUBLINK: + return ast.ARRAY_SUBLINK, nil + case pg.SubLinkType_CTE_SUBLINK: + return ast.CTE_SUBLINK, nil + default: + return 0, fmt.Errorf("parse sublink type: unknown type %s", t) + } +} + +func convertSetOperation(t pg.SetOperation) (ast.SetOperation, error) { + switch t { + case pg.SetOperation_SETOP_NONE: + return ast.None, nil + case pg.SetOperation_SETOP_UNION: + return ast.Union, nil + case pg.SetOperation_SETOP_INTERSECT: + return ast.Intersect, nil + case pg.SetOperation_SETOP_EXCEPT: + return ast.Except, nil + default: + return 0, fmt.Errorf("parse set operation: unknown type %s", t) + } +} + +func convertList(l *pg.List) *ast.List { out := &ast.List{} for _, item := range l.Items { out.Items = append(out.Items, convertNode(item)) @@ -16,56 +73,69 @@ func convertList(l nodes.List) *ast.List { return out } -func convertValuesList(l [][]nodes.Node) *ast.List { +func convertSlice(nodes []*pg.Node) *ast.List { out := &ast.List{} - for _, outer := range l { - o := &ast.List{} - for _, inner := range outer { - o.Items = append(o.Items, convertNode(inner)) - } - out.Items = append(out.Items, o) + for _, n := range nodes { + out.Items = append(out.Items, convertNode(n)) } return out } -func convert(node nodes.Node) (ast.Node, error) { +func convert(node *pg.Node) (ast.Node, error) { return convertNode(node), nil } -func convertA_ArrayExpr(n *nodes.A_ArrayExpr) *ast.A_ArrayExpr { +func convertA_ArrayExpr(n *pg.A_ArrayExpr) *ast.A_ArrayExpr { if n == nil { return nil } return &ast.A_ArrayExpr{ - Elements: convertList(n.Elements), - Location: n.Location, + Elements: convertSlice(n.Elements), + Location: int(n.Location), } } -func convertA_Const(n *nodes.A_Const) *ast.A_Const { +func convertA_Const(n *pg.A_Const) *ast.A_Const { if n == nil { return nil } + var val ast.Node + if n.Isnull { + val = &ast.Null{} + } else { + switch v := n.Val.(type) { + case *pg.A_Const_Boolval: + val = convertBoolean(v.Boolval) + case *pg.A_Const_Bsval: + val = convertBitString(v.Bsval) + case *pg.A_Const_Fval: + val = convertFloat(v.Fval) + case *pg.A_Const_Ival: + val = convertInteger(v.Ival) + case *pg.A_Const_Sval: + val = convertString(v.Sval) + } + } return &ast.A_Const{ - Val: convertNode(n.Val), - Location: n.Location, + Val: val, + Location: int(n.Location), } } -func convertA_Expr(n *nodes.A_Expr) *ast.A_Expr { +func convertA_Expr(n *pg.A_Expr) *ast.A_Expr { if n == nil { return nil } return &ast.A_Expr{ Kind: ast.A_Expr_Kind(n.Kind), - Name: convertList(n.Name), + Name: convertSlice(n.Name), Lexpr: convertNode(n.Lexpr), Rexpr: convertNode(n.Rexpr), - Location: n.Location, + Location: int(n.Location), } } -func convertA_Indices(n *nodes.A_Indices) *ast.A_Indices { +func convertA_Indices(n *pg.A_Indices) *ast.A_Indices { if n == nil { return nil } @@ -76,34 +146,34 @@ func convertA_Indices(n *nodes.A_Indices) *ast.A_Indices { } } -func convertA_Indirection(n *nodes.A_Indirection) *ast.A_Indirection { +func convertA_Indirection(n *pg.A_Indirection) *ast.A_Indirection { if n == nil { return nil } return &ast.A_Indirection{ Arg: convertNode(n.Arg), - Indirection: convertList(n.Indirection), + Indirection: convertSlice(n.Indirection), } } -func convertA_Star(n *nodes.A_Star) *ast.A_Star { +func convertA_Star(n *pg.A_Star) *ast.A_Star { if n == nil { return nil } return &ast.A_Star{} } -func convertAccessPriv(n *nodes.AccessPriv) *ast.AccessPriv { +func convertAccessPriv(n *pg.AccessPriv) *ast.AccessPriv { if n == nil { return nil } return &ast.AccessPriv{ - PrivName: n.PrivName, - Cols: convertList(n.Cols), + PrivName: makeString(n.PrivName), + Cols: convertSlice(n.Cols), } } -func convertAggref(n *nodes.Aggref) *ast.Aggref { +func convertAggref(n *pg.Aggref) *ast.Aggref { if n == nil { return nil } @@ -113,165 +183,164 @@ func convertAggref(n *nodes.Aggref) *ast.Aggref { Aggtype: ast.Oid(n.Aggtype), Aggcollid: ast.Oid(n.Aggcollid), Inputcollid: ast.Oid(n.Inputcollid), - Aggtranstype: ast.Oid(n.Aggtranstype), - Aggargtypes: convertList(n.Aggargtypes), - Aggdirectargs: convertList(n.Aggdirectargs), - Args: convertList(n.Args), - Aggorder: convertList(n.Aggorder), - Aggdistinct: convertList(n.Aggdistinct), + Aggargtypes: convertSlice(n.Aggargtypes), + Aggdirectargs: convertSlice(n.Aggdirectargs), + Args: convertSlice(n.Args), + Aggorder: convertSlice(n.Aggorder), + Aggdistinct: convertSlice(n.Aggdistinct), Aggfilter: convertNode(n.Aggfilter), Aggstar: n.Aggstar, Aggvariadic: n.Aggvariadic, - Aggkind: n.Aggkind, + Aggkind: makeByte(n.Aggkind), Agglevelsup: ast.Index(n.Agglevelsup), Aggsplit: ast.AggSplit(n.Aggsplit), - Location: n.Location, + Location: int(n.Location), } } -func convertAlias(n *nodes.Alias) *ast.Alias { +func convertAlias(n *pg.Alias) *ast.Alias { if n == nil { return nil } return &ast.Alias{ - Aliasname: n.Aliasname, - Colnames: convertList(n.Colnames), + Aliasname: makeString(n.Aliasname), + Colnames: convertSlice(n.Colnames), } } -func convertAlterCollationStmt(n *nodes.AlterCollationStmt) *ast.AlterCollationStmt { +func convertAlterCollationStmt(n *pg.AlterCollationStmt) *ast.AlterCollationStmt { if n == nil { return nil } return &ast.AlterCollationStmt{ - Collname: convertList(n.Collname), + Collname: convertSlice(n.Collname), } } -func convertAlterDatabaseSetStmt(n *nodes.AlterDatabaseSetStmt) *ast.AlterDatabaseSetStmt { +func convertAlterDatabaseSetStmt(n *pg.AlterDatabaseSetStmt) *ast.AlterDatabaseSetStmt { if n == nil { return nil } return &ast.AlterDatabaseSetStmt{ - Dbname: n.Dbname, + Dbname: makeString(n.Dbname), Setstmt: convertVariableSetStmt(n.Setstmt), } } -func convertAlterDatabaseStmt(n *nodes.AlterDatabaseStmt) *ast.AlterDatabaseStmt { +func convertAlterDatabaseStmt(n *pg.AlterDatabaseStmt) *ast.AlterDatabaseStmt { if n == nil { return nil } return &ast.AlterDatabaseStmt{ - Dbname: n.Dbname, - Options: convertList(n.Options), + Dbname: makeString(n.Dbname), + Options: convertSlice(n.Options), } } -func convertAlterDefaultPrivilegesStmt(n *nodes.AlterDefaultPrivilegesStmt) *ast.AlterDefaultPrivilegesStmt { +func convertAlterDefaultPrivilegesStmt(n *pg.AlterDefaultPrivilegesStmt) *ast.AlterDefaultPrivilegesStmt { if n == nil { return nil } return &ast.AlterDefaultPrivilegesStmt{ - Options: convertList(n.Options), + Options: convertSlice(n.Options), Action: convertGrantStmt(n.Action), } } -func convertAlterDomainStmt(n *nodes.AlterDomainStmt) *ast.AlterDomainStmt { +func convertAlterDomainStmt(n *pg.AlterDomainStmt) *ast.AlterDomainStmt { if n == nil { return nil } return &ast.AlterDomainStmt{ - Subtype: n.Subtype, - TypeName: convertList(n.TypeName), - Name: n.Name, + Subtype: makeByte(n.Subtype), + TypeName: convertSlice(n.TypeName), + Name: makeString(n.Name), Def: convertNode(n.Def), Behavior: ast.DropBehavior(n.Behavior), MissingOk: n.MissingOk, } } -func convertAlterEnumStmt(n *nodes.AlterEnumStmt) *ast.AlterEnumStmt { +func convertAlterEnumStmt(n *pg.AlterEnumStmt) *ast.AlterEnumStmt { if n == nil { return nil } return &ast.AlterEnumStmt{ - TypeName: convertList(n.TypeName), - OldVal: n.OldVal, - NewVal: n.NewVal, - NewValNeighbor: n.NewValNeighbor, + TypeName: convertSlice(n.TypeName), + OldVal: makeString(n.OldVal), + NewVal: makeString(n.NewVal), + NewValNeighbor: makeString(n.NewValNeighbor), NewValIsAfter: n.NewValIsAfter, SkipIfNewValExists: n.SkipIfNewValExists, } } -func convertAlterEventTrigStmt(n *nodes.AlterEventTrigStmt) *ast.AlterEventTrigStmt { +func convertAlterEventTrigStmt(n *pg.AlterEventTrigStmt) *ast.AlterEventTrigStmt { if n == nil { return nil } return &ast.AlterEventTrigStmt{ - Trigname: n.Trigname, - Tgenabled: n.Tgenabled, + Trigname: makeString(n.Trigname), + Tgenabled: makeByte(n.Tgenabled), } } -func convertAlterExtensionContentsStmt(n *nodes.AlterExtensionContentsStmt) *ast.AlterExtensionContentsStmt { +func convertAlterExtensionContentsStmt(n *pg.AlterExtensionContentsStmt) *ast.AlterExtensionContentsStmt { if n == nil { return nil } return &ast.AlterExtensionContentsStmt{ - Extname: n.Extname, - Action: n.Action, + Extname: makeString(n.Extname), + Action: int(n.Action), Objtype: ast.ObjectType(n.Objtype), Object: convertNode(n.Object), } } -func convertAlterExtensionStmt(n *nodes.AlterExtensionStmt) *ast.AlterExtensionStmt { +func convertAlterExtensionStmt(n *pg.AlterExtensionStmt) *ast.AlterExtensionStmt { if n == nil { return nil } return &ast.AlterExtensionStmt{ - Extname: n.Extname, - Options: convertList(n.Options), + Extname: makeString(n.Extname), + Options: convertSlice(n.Options), } } -func convertAlterFdwStmt(n *nodes.AlterFdwStmt) *ast.AlterFdwStmt { +func convertAlterFdwStmt(n *pg.AlterFdwStmt) *ast.AlterFdwStmt { if n == nil { return nil } return &ast.AlterFdwStmt{ - Fdwname: n.Fdwname, - FuncOptions: convertList(n.FuncOptions), - Options: convertList(n.Options), + Fdwname: makeString(n.Fdwname), + FuncOptions: convertSlice(n.FuncOptions), + Options: convertSlice(n.Options), } } -func convertAlterForeignServerStmt(n *nodes.AlterForeignServerStmt) *ast.AlterForeignServerStmt { +func convertAlterForeignServerStmt(n *pg.AlterForeignServerStmt) *ast.AlterForeignServerStmt { if n == nil { return nil } return &ast.AlterForeignServerStmt{ - Servername: n.Servername, - Version: n.Version, - Options: convertList(n.Options), + Servername: makeString(n.Servername), + Version: makeString(n.Version), + Options: convertSlice(n.Options), HasVersion: n.HasVersion, } } -func convertAlterFunctionStmt(n *nodes.AlterFunctionStmt) *ast.AlterFunctionStmt { +func convertAlterFunctionStmt(n *pg.AlterFunctionStmt) *ast.AlterFunctionStmt { if n == nil { return nil } return &ast.AlterFunctionStmt{ Func: convertObjectWithArgs(n.Func), - Actions: convertList(n.Actions), + Actions: convertSlice(n.Actions), } } -func convertAlterObjectDependsStmt(n *nodes.AlterObjectDependsStmt) *ast.AlterObjectDependsStmt { +func convertAlterObjectDependsStmt(n *pg.AlterObjectDependsStmt) *ast.AlterObjectDependsStmt { if n == nil { return nil } @@ -279,11 +348,11 @@ func convertAlterObjectDependsStmt(n *nodes.AlterObjectDependsStmt) *ast.AlterOb ObjectType: ast.ObjectType(n.ObjectType), Relation: convertRangeVar(n.Relation), Object: convertNode(n.Object), - Extname: convertNode(n.Extname), + Extname: convertString(n.Extname), } } -func convertAlterObjectSchemaStmt(n *nodes.AlterObjectSchemaStmt) *ast.AlterObjectSchemaStmt { +func convertAlterObjectSchemaStmt(n *pg.AlterObjectSchemaStmt) *ast.AlterObjectSchemaStmt { if n == nil { return nil } @@ -291,34 +360,34 @@ func convertAlterObjectSchemaStmt(n *nodes.AlterObjectSchemaStmt) *ast.AlterObje ObjectType: ast.ObjectType(n.ObjectType), Relation: convertRangeVar(n.Relation), Object: convertNode(n.Object), - Newschema: n.Newschema, + Newschema: makeString(n.Newschema), MissingOk: n.MissingOk, } } -func convertAlterOpFamilyStmt(n *nodes.AlterOpFamilyStmt) *ast.AlterOpFamilyStmt { +func convertAlterOpFamilyStmt(n *pg.AlterOpFamilyStmt) *ast.AlterOpFamilyStmt { if n == nil { return nil } return &ast.AlterOpFamilyStmt{ - Opfamilyname: convertList(n.Opfamilyname), - Amname: n.Amname, + Opfamilyname: convertSlice(n.Opfamilyname), + Amname: makeString(n.Amname), IsDrop: n.IsDrop, - Items: convertList(n.Items), + Items: convertSlice(n.Items), } } -func convertAlterOperatorStmt(n *nodes.AlterOperatorStmt) *ast.AlterOperatorStmt { +func convertAlterOperatorStmt(n *pg.AlterOperatorStmt) *ast.AlterOperatorStmt { if n == nil { return nil } return &ast.AlterOperatorStmt{ Opername: convertObjectWithArgs(n.Opername), - Options: convertList(n.Options), + Options: convertSlice(n.Options), } } -func convertAlterOwnerStmt(n *nodes.AlterOwnerStmt) *ast.AlterOwnerStmt { +func convertAlterOwnerStmt(n *pg.AlterOwnerStmt) *ast.AlterOwnerStmt { if n == nil { return nil } @@ -330,80 +399,80 @@ func convertAlterOwnerStmt(n *nodes.AlterOwnerStmt) *ast.AlterOwnerStmt { } } -func convertAlterPolicyStmt(n *nodes.AlterPolicyStmt) *ast.AlterPolicyStmt { +func convertAlterPolicyStmt(n *pg.AlterPolicyStmt) *ast.AlterPolicyStmt { if n == nil { return nil } return &ast.AlterPolicyStmt{ - PolicyName: n.PolicyName, + PolicyName: makeString(n.PolicyName), Table: convertRangeVar(n.Table), - Roles: convertList(n.Roles), + Roles: convertSlice(n.Roles), Qual: convertNode(n.Qual), WithCheck: convertNode(n.WithCheck), } } -func convertAlterPublicationStmt(n *nodes.AlterPublicationStmt) *ast.AlterPublicationStmt { +func convertAlterPublicationStmt(n *pg.AlterPublicationStmt) *ast.AlterPublicationStmt { if n == nil { return nil } return &ast.AlterPublicationStmt{ - Pubname: n.Pubname, - Options: convertList(n.Options), - Tables: convertList(n.Tables), + Pubname: makeString(n.Pubname), + Options: convertSlice(n.Options), + Tables: convertSlice(n.Pubobjects), ForAllTables: n.ForAllTables, - TableAction: ast.DefElemAction(n.TableAction), + TableAction: ast.DefElemAction(n.Action), } } -func convertAlterRoleSetStmt(n *nodes.AlterRoleSetStmt) *ast.AlterRoleSetStmt { +func convertAlterRoleSetStmt(n *pg.AlterRoleSetStmt) *ast.AlterRoleSetStmt { if n == nil { return nil } return &ast.AlterRoleSetStmt{ Role: convertRoleSpec(n.Role), - Database: n.Database, + Database: makeString(n.Database), Setstmt: convertVariableSetStmt(n.Setstmt), } } -func convertAlterRoleStmt(n *nodes.AlterRoleStmt) *ast.AlterRoleStmt { +func convertAlterRoleStmt(n *pg.AlterRoleStmt) *ast.AlterRoleStmt { if n == nil { return nil } return &ast.AlterRoleStmt{ Role: convertRoleSpec(n.Role), - Options: convertList(n.Options), - Action: n.Action, + Options: convertSlice(n.Options), + Action: int(n.Action), } } -func convertAlterSeqStmt(n *nodes.AlterSeqStmt) *ast.AlterSeqStmt { +func convertAlterSeqStmt(n *pg.AlterSeqStmt) *ast.AlterSeqStmt { if n == nil { return nil } return &ast.AlterSeqStmt{ Sequence: convertRangeVar(n.Sequence), - Options: convertList(n.Options), + Options: convertSlice(n.Options), ForIdentity: n.ForIdentity, MissingOk: n.MissingOk, } } -func convertAlterSubscriptionStmt(n *nodes.AlterSubscriptionStmt) *ast.AlterSubscriptionStmt { +func convertAlterSubscriptionStmt(n *pg.AlterSubscriptionStmt) *ast.AlterSubscriptionStmt { if n == nil { return nil } return &ast.AlterSubscriptionStmt{ Kind: ast.AlterSubscriptionType(n.Kind), - Subname: n.Subname, - Conninfo: n.Conninfo, - Publication: convertList(n.Publication), - Options: convertList(n.Options), + Subname: makeString(n.Subname), + Conninfo: makeString(n.Conninfo), + Publication: convertSlice(n.Publication), + Options: convertSlice(n.Options), } } -func convertAlterSystemStmt(n *nodes.AlterSystemStmt) *ast.AlterSystemStmt { +func convertAlterSystemStmt(n *pg.AlterSystemStmt) *ast.AlterSystemStmt { if n == nil { return nil } @@ -412,32 +481,32 @@ func convertAlterSystemStmt(n *nodes.AlterSystemStmt) *ast.AlterSystemStmt { } } -func convertAlterTSConfigurationStmt(n *nodes.AlterTSConfigurationStmt) *ast.AlterTSConfigurationStmt { +func convertAlterTSConfigurationStmt(n *pg.AlterTSConfigurationStmt) *ast.AlterTSConfigurationStmt { if n == nil { return nil } return &ast.AlterTSConfigurationStmt{ Kind: ast.AlterTSConfigType(n.Kind), - Cfgname: convertList(n.Cfgname), - Tokentype: convertList(n.Tokentype), - Dicts: convertList(n.Dicts), + Cfgname: convertSlice(n.Cfgname), + Tokentype: convertSlice(n.Tokentype), + Dicts: convertSlice(n.Dicts), Override: n.Override, Replace: n.Replace, MissingOk: n.MissingOk, } } -func convertAlterTSDictionaryStmt(n *nodes.AlterTSDictionaryStmt) *ast.AlterTSDictionaryStmt { +func convertAlterTSDictionaryStmt(n *pg.AlterTSDictionaryStmt) *ast.AlterTSDictionaryStmt { if n == nil { return nil } return &ast.AlterTSDictionaryStmt{ - Dictname: convertList(n.Dictname), - Options: convertList(n.Options), + Dictname: convertSlice(n.Dictname), + Options: convertSlice(n.Options), } } -func convertAlterTableCmd(n *nodes.AlterTableCmd) *ast.AlterTableCmd { +func convertAlterTableCmd(n *pg.AlterTableCmd) *ast.AlterTableCmd { if n == nil { return nil } @@ -445,7 +514,7 @@ func convertAlterTableCmd(n *nodes.AlterTableCmd) *ast.AlterTableCmd { columnDef := def.(*ast.ColumnDef) return &ast.AlterTableCmd{ Subtype: ast.AlterTableType(n.Subtype), - Name: n.Name, + Name: makeString(n.Name), Newowner: convertRoleSpec(n.Newowner), Def: columnDef, Behavior: ast.DropBehavior(n.Behavior), @@ -453,81 +522,79 @@ func convertAlterTableCmd(n *nodes.AlterTableCmd) *ast.AlterTableCmd { } } -func convertAlterTableMoveAllStmt(n *nodes.AlterTableMoveAllStmt) *ast.AlterTableMoveAllStmt { +func convertAlterTableMoveAllStmt(n *pg.AlterTableMoveAllStmt) *ast.AlterTableMoveAllStmt { if n == nil { return nil } return &ast.AlterTableMoveAllStmt{ - OrigTablespacename: n.OrigTablespacename, + OrigTablespacename: makeString(n.OrigTablespacename), Objtype: ast.ObjectType(n.Objtype), - Roles: convertList(n.Roles), - NewTablespacename: n.NewTablespacename, + Roles: convertSlice(n.Roles), + NewTablespacename: makeString(n.NewTablespacename), Nowait: n.Nowait, } } -func convertAlterTableSpaceOptionsStmt(n *nodes.AlterTableSpaceOptionsStmt) *ast.AlterTableSpaceOptionsStmt { +func convertAlterTableSpaceOptionsStmt(n *pg.AlterTableSpaceOptionsStmt) *ast.AlterTableSpaceOptionsStmt { if n == nil { return nil } return &ast.AlterTableSpaceOptionsStmt{ - Tablespacename: n.Tablespacename, - Options: convertList(n.Options), + Tablespacename: makeString(n.Tablespacename), + Options: convertSlice(n.Options), IsReset: n.IsReset, } } -func convertAlterTableStmt(n *nodes.AlterTableStmt) *ast.AlterTableStmt { +func convertAlterTableStmt(n *pg.AlterTableStmt) *ast.AlterTableStmt { if n == nil { return nil } return &ast.AlterTableStmt{ Relation: convertRangeVar(n.Relation), - Cmds: convertList(n.Cmds), - Relkind: ast.ObjectType(n.Relkind), + Cmds: convertSlice(n.Cmds), + Relkind: ast.ObjectType(n.Objtype), MissingOk: n.MissingOk, } } -func convertAlterUserMappingStmt(n *nodes.AlterUserMappingStmt) *ast.AlterUserMappingStmt { +func convertAlterUserMappingStmt(n *pg.AlterUserMappingStmt) *ast.AlterUserMappingStmt { if n == nil { return nil } return &ast.AlterUserMappingStmt{ User: convertRoleSpec(n.User), - Servername: n.Servername, - Options: convertList(n.Options), + Servername: makeString(n.Servername), + Options: convertSlice(n.Options), } } -func convertAlternativeSubPlan(n *nodes.AlternativeSubPlan) *ast.AlternativeSubPlan { +func convertAlternativeSubPlan(n *pg.AlternativeSubPlan) *ast.AlternativeSubPlan { if n == nil { return nil } return &ast.AlternativeSubPlan{ Xpr: convertNode(n.Xpr), - Subplans: convertList(n.Subplans), + Subplans: convertSlice(n.Subplans), } } -func convertArrayCoerceExpr(n *nodes.ArrayCoerceExpr) *ast.ArrayCoerceExpr { +func convertArrayCoerceExpr(n *pg.ArrayCoerceExpr) *ast.ArrayCoerceExpr { if n == nil { return nil } return &ast.ArrayCoerceExpr{ Xpr: convertNode(n.Xpr), Arg: convertNode(n.Arg), - Elemfuncid: ast.Oid(n.Elemfuncid), Resulttype: ast.Oid(n.Resulttype), Resulttypmod: n.Resulttypmod, Resultcollid: ast.Oid(n.Resultcollid), - IsExplicit: n.IsExplicit, Coerceformat: ast.CoercionForm(n.Coerceformat), - Location: n.Location, + Location: int(n.Location), } } -func convertArrayExpr(n *nodes.ArrayExpr) *ast.ArrayExpr { +func convertArrayExpr(n *pg.ArrayExpr) *ast.ArrayExpr { if n == nil { return nil } @@ -536,73 +603,82 @@ func convertArrayExpr(n *nodes.ArrayExpr) *ast.ArrayExpr { ArrayTypeid: ast.Oid(n.ArrayTypeid), ArrayCollid: ast.Oid(n.ArrayCollid), ElementTypeid: ast.Oid(n.ElementTypeid), - Elements: convertList(n.Elements), + Elements: convertSlice(n.Elements), Multidims: n.Multidims, - Location: n.Location, + Location: int(n.Location), } } -func convertArrayRef(n *nodes.ArrayRef) *ast.ArrayRef { +func convertBitString(n *pg.BitString) *ast.BitString { if n == nil { return nil } - return &ast.ArrayRef{ - Xpr: convertNode(n.Xpr), - Refarraytype: ast.Oid(n.Refarraytype), - Refelemtype: ast.Oid(n.Refelemtype), - Reftypmod: n.Reftypmod, - Refcollid: ast.Oid(n.Refcollid), - Refupperindexpr: convertList(n.Refupperindexpr), - Reflowerindexpr: convertList(n.Reflowerindexpr), - Refexpr: convertNode(n.Refexpr), - Refassgnexpr: convertNode(n.Refassgnexpr), + return &ast.BitString{ + Str: n.Bsval, } } -func convertBitString(n *nodes.BitString) *ast.BitString { +func convertBoolExpr(n *pg.BoolExpr) *ast.BoolExpr { if n == nil { return nil } - return &ast.BitString{ - Str: n.Str, + return &ast.BoolExpr{ + Xpr: convertNode(n.Xpr), + Boolop: ast.BoolExprType(n.Boolop), + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertBlockIdData(n *nodes.BlockIdData) *ast.BlockIdData { +func convertBoolean(n *pg.Boolean) *ast.Boolean { if n == nil { return nil } - return &ast.BlockIdData{ - BiHi: n.BiHi, - BiLo: n.BiLo, + return &ast.Boolean{ + Boolval: n.Boolval, } } -func convertBoolExpr(n *nodes.BoolExpr) *ast.BoolExpr { +func convertBooleanTest(n *pg.BooleanTest) *ast.BooleanTest { if n == nil { return nil } - return &ast.BoolExpr{ - Xpr: convertNode(n.Xpr), - Boolop: ast.BoolExprType(n.Boolop), - Args: convertList(n.Args), - Location: n.Location, + return &ast.BooleanTest{ + Xpr: convertNode(n.Xpr), + Arg: convertNode(n.Arg), + Booltesttype: ast.BoolTestType(n.Booltesttype), + Location: int(n.Location), } } -func convertBooleanTest(n *nodes.BooleanTest) *ast.BooleanTest { +func convertCallStmt(n *pg.CallStmt) *ast.CallStmt { if n == nil { return nil } - return &ast.BooleanTest{ - Xpr: convertNode(n.Xpr), - Arg: convertNode(n.Arg), - Booltesttype: ast.BoolTestType(n.Booltesttype), - Location: n.Location, + rel, err := parseRelationFromNodes(n.Funccall.Funcname) + if err != nil { + // TODO: How should we handle errors? + panic(err) + } + + return &ast.CallStmt{ + FuncCall: &ast.FuncCall{ + Func: rel.FuncName(), + Funcname: convertSlice(n.Funccall.Funcname), + Args: convertSlice(n.Funccall.Args), + AggOrder: convertSlice(n.Funccall.AggOrder), + AggFilter: convertNode(n.Funccall.AggFilter), + AggWithinGroup: n.Funccall.AggWithinGroup, + AggStar: n.Funccall.AggStar, + AggDistinct: n.Funccall.AggDistinct, + FuncVariadic: n.Funccall.FuncVariadic, + Over: convertWindowDef(n.Funccall.Over), + Location: int(n.Funccall.Location), + }, } } -func convertCaseExpr(n *nodes.CaseExpr) *ast.CaseExpr { +func convertCaseExpr(n *pg.CaseExpr) *ast.CaseExpr { if n == nil { return nil } @@ -611,13 +687,13 @@ func convertCaseExpr(n *nodes.CaseExpr) *ast.CaseExpr { Casetype: ast.Oid(n.Casetype), Casecollid: ast.Oid(n.Casecollid), Arg: convertNode(n.Arg), - Args: convertList(n.Args), + Args: convertSlice(n.Args), Defresult: convertNode(n.Defresult), - Location: n.Location, + Location: int(n.Location), } } -func convertCaseTestExpr(n *nodes.CaseTestExpr) *ast.CaseTestExpr { +func convertCaseTestExpr(n *pg.CaseTestExpr) *ast.CaseTestExpr { if n == nil { return nil } @@ -629,7 +705,7 @@ func convertCaseTestExpr(n *nodes.CaseTestExpr) *ast.CaseTestExpr { } } -func convertCaseWhen(n *nodes.CaseWhen) *ast.CaseWhen { +func convertCaseWhen(n *pg.CaseWhen) *ast.CaseWhen { if n == nil { return nil } @@ -637,38 +713,37 @@ func convertCaseWhen(n *nodes.CaseWhen) *ast.CaseWhen { Xpr: convertNode(n.Xpr), Expr: convertNode(n.Expr), Result: convertNode(n.Result), - Location: n.Location, + Location: int(n.Location), } } -func convertCheckPointStmt(n *nodes.CheckPointStmt) *ast.CheckPointStmt { +func convertCheckPointStmt(n *pg.CheckPointStmt) *ast.CheckPointStmt { if n == nil { return nil } return &ast.CheckPointStmt{} } -func convertClosePortalStmt(n *nodes.ClosePortalStmt) *ast.ClosePortalStmt { +func convertClosePortalStmt(n *pg.ClosePortalStmt) *ast.ClosePortalStmt { if n == nil { return nil } return &ast.ClosePortalStmt{ - Portalname: n.Portalname, + Portalname: makeString(n.Portalname), } } -func convertClusterStmt(n *nodes.ClusterStmt) *ast.ClusterStmt { +func convertClusterStmt(n *pg.ClusterStmt) *ast.ClusterStmt { if n == nil { return nil } return &ast.ClusterStmt{ Relation: convertRangeVar(n.Relation), - Indexname: n.Indexname, - Verbose: n.Verbose, + Indexname: makeString(n.Indexname), } } -func convertCoalesceExpr(n *nodes.CoalesceExpr) *ast.CoalesceExpr { +func convertCoalesceExpr(n *pg.CoalesceExpr) *ast.CoalesceExpr { if n == nil { return nil } @@ -676,12 +751,12 @@ func convertCoalesceExpr(n *nodes.CoalesceExpr) *ast.CoalesceExpr { Xpr: convertNode(n.Xpr), Coalescetype: ast.Oid(n.Coalescetype), Coalescecollid: ast.Oid(n.Coalescecollid), - Args: convertList(n.Args), - Location: n.Location, + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertCoerceToDomain(n *nodes.CoerceToDomain) *ast.CoerceToDomain { +func convertCoerceToDomain(n *pg.CoerceToDomain) *ast.CoerceToDomain { if n == nil { return nil } @@ -692,11 +767,11 @@ func convertCoerceToDomain(n *nodes.CoerceToDomain) *ast.CoerceToDomain { Resulttypmod: n.Resulttypmod, Resultcollid: ast.Oid(n.Resultcollid), Coercionformat: ast.CoercionForm(n.Coercionformat), - Location: n.Location, + Location: int(n.Location), } } -func convertCoerceToDomainValue(n *nodes.CoerceToDomainValue) *ast.CoerceToDomainValue { +func convertCoerceToDomainValue(n *pg.CoerceToDomainValue) *ast.CoerceToDomainValue { if n == nil { return nil } @@ -705,11 +780,11 @@ func convertCoerceToDomainValue(n *nodes.CoerceToDomainValue) *ast.CoerceToDomai TypeId: ast.Oid(n.TypeId), TypeMod: n.TypeMod, Collation: ast.Oid(n.Collation), - Location: n.Location, + Location: int(n.Location), } } -func convertCoerceViaIO(n *nodes.CoerceViaIO) *ast.CoerceViaIO { +func convertCoerceViaIO(n *pg.CoerceViaIO) *ast.CoerceViaIO { if n == nil { return nil } @@ -719,22 +794,22 @@ func convertCoerceViaIO(n *nodes.CoerceViaIO) *ast.CoerceViaIO { Resulttype: ast.Oid(n.Resulttype), Resultcollid: ast.Oid(n.Resultcollid), Coerceformat: ast.CoercionForm(n.Coerceformat), - Location: n.Location, + Location: int(n.Location), } } -func convertCollateClause(n *nodes.CollateClause) *ast.CollateClause { +func convertCollateClause(n *pg.CollateClause) *ast.CollateClause { if n == nil { return nil } return &ast.CollateClause{ Arg: convertNode(n.Arg), - Collname: convertList(n.Collname), - Location: n.Location, + Collname: convertSlice(n.Collname), + Location: int(n.Location), } } -func convertCollateExpr(n *nodes.CollateExpr) *ast.CollateExpr { +func convertCollateExpr(n *pg.CollateExpr) *ast.CollateExpr { if n == nil { return nil } @@ -742,152 +817,127 @@ func convertCollateExpr(n *nodes.CollateExpr) *ast.CollateExpr { Xpr: convertNode(n.Xpr), Arg: convertNode(n.Arg), CollOid: ast.Oid(n.CollOid), - Location: n.Location, + Location: int(n.Location), } } -func convertColumnDef(n *nodes.ColumnDef) *ast.ColumnDef { +func convertColumnDef(n *pg.ColumnDef) *ast.ColumnDef { if n == nil { return nil } - colname := "" - if n.Colname != nil { - colname = *n.Colname - } return &ast.ColumnDef{ - Colname: colname, + Colname: n.Colname, TypeName: convertTypeName(n.TypeName), - Inhcount: n.Inhcount, + Inhcount: int(n.Inhcount), IsLocal: n.IsLocal, IsNotNull: n.IsNotNull, IsFromType: n.IsFromType, - IsFromParent: n.IsFromParent, - Storage: n.Storage, + Storage: makeByte(n.Storage), RawDefault: convertNode(n.RawDefault), CookedDefault: convertNode(n.CookedDefault), - Identity: n.Identity, + Identity: makeByte(n.Identity), CollClause: convertCollateClause(n.CollClause), CollOid: ast.Oid(n.CollOid), - Constraints: convertList(n.Constraints), - Fdwoptions: convertList(n.Fdwoptions), - Location: n.Location, + Constraints: convertSlice(n.Constraints), + Fdwoptions: convertSlice(n.Fdwoptions), + Location: int(n.Location), } } -func convertColumnRef(n *nodes.ColumnRef) *ast.ColumnRef { +func convertColumnRef(n *pg.ColumnRef) *ast.ColumnRef { if n == nil { return nil } return &ast.ColumnRef{ - Fields: convertList(n.Fields), - Location: n.Location, + Fields: convertSlice(n.Fields), + Location: int(n.Location), } } -func convertCommentStmt(n *nodes.CommentStmt) *ast.CommentStmt { +func convertCommentStmt(n *pg.CommentStmt) *ast.CommentStmt { if n == nil { return nil } return &ast.CommentStmt{ Objtype: ast.ObjectType(n.Objtype), Object: convertNode(n.Object), - Comment: n.Comment, + Comment: makeString(n.Comment), } } -func convertCommonTableExpr(n *nodes.CommonTableExpr) *ast.CommonTableExpr { +func convertCommonTableExpr(n *pg.CommonTableExpr) *ast.CommonTableExpr { if n == nil { return nil } return &ast.CommonTableExpr{ - Ctename: n.Ctename, - Aliascolnames: convertList(n.Aliascolnames), + Ctename: makeString(n.Ctename), + Aliascolnames: convertSlice(n.Aliascolnames), Ctequery: convertNode(n.Ctequery), - Location: n.Location, + Location: int(n.Location), Cterecursive: n.Cterecursive, - Cterefcount: n.Cterefcount, - Ctecolnames: convertList(n.Ctecolnames), - Ctecoltypes: convertList(n.Ctecoltypes), - Ctecoltypmods: convertList(n.Ctecoltypmods), - Ctecolcollations: convertList(n.Ctecolcollations), + Cterefcount: int(n.Cterefcount), + Ctecolnames: convertSlice(n.Ctecolnames), + Ctecoltypes: convertSlice(n.Ctecoltypes), + Ctecoltypmods: convertSlice(n.Ctecoltypmods), + Ctecolcollations: convertSlice(n.Ctecolcollations), } } -func convertCompositeTypeStmt(n *nodes.CompositeTypeStmt) *ast.CompositeTypeStmt { +func convertCompositeTypeStmt(n *pg.CompositeTypeStmt) *ast.CompositeTypeStmt { if n == nil { return nil } - tn, err := parseTypeName(n.Typevar) - if err != nil { - panic(err) - } + rel := parseRelationFromRangeVar(n.Typevar) return &ast.CompositeTypeStmt{ - TypeName: tn, + TypeName: rel.TypeName(), } } -func convertConst(n *nodes.Const) *ast.Const { - if n == nil { - return nil - } - return &ast.Const{ - Xpr: convertNode(n.Xpr), - Consttype: ast.Oid(n.Consttype), - Consttypmod: n.Consttypmod, - Constcollid: ast.Oid(n.Constcollid), - Constlen: n.Constlen, - Constvalue: ast.Datum(n.Constvalue), - Constisnull: n.Constisnull, - Constbyval: n.Constbyval, - Location: n.Location, - } -} - -func convertConstraint(n *nodes.Constraint) *ast.Constraint { +func convertConstraint(n *pg.Constraint) *ast.Constraint { if n == nil { return nil } return &ast.Constraint{ Contype: ast.ConstrType(n.Contype), - Conname: n.Conname, + Conname: makeString(n.Conname), Deferrable: n.Deferrable, Initdeferred: n.Initdeferred, - Location: n.Location, + Location: int(n.Location), IsNoInherit: n.IsNoInherit, RawExpr: convertNode(n.RawExpr), - CookedExpr: n.CookedExpr, - GeneratedWhen: n.GeneratedWhen, - Keys: convertList(n.Keys), - Exclusions: convertList(n.Exclusions), - Options: convertList(n.Options), - Indexname: n.Indexname, - Indexspace: n.Indexspace, - AccessMethod: n.AccessMethod, + CookedExpr: makeString(n.CookedExpr), + GeneratedWhen: makeByte(n.GeneratedWhen), + Keys: convertSlice(n.Keys), + Exclusions: convertSlice(n.Exclusions), + Options: convertSlice(n.Options), + Indexname: makeString(n.Indexname), + Indexspace: makeString(n.Indexspace), + AccessMethod: makeString(n.AccessMethod), WhereClause: convertNode(n.WhereClause), Pktable: convertRangeVar(n.Pktable), - FkAttrs: convertList(n.FkAttrs), - PkAttrs: convertList(n.PkAttrs), - FkMatchtype: n.FkMatchtype, - FkUpdAction: n.FkUpdAction, - FkDelAction: n.FkDelAction, - OldConpfeqop: convertList(n.OldConpfeqop), + FkAttrs: convertSlice(n.FkAttrs), + PkAttrs: convertSlice(n.PkAttrs), + FkMatchtype: makeByte(n.FkMatchtype), + FkUpdAction: makeByte(n.FkUpdAction), + FkDelAction: makeByte(n.FkDelAction), + OldConpfeqop: convertSlice(n.OldConpfeqop), OldPktableOid: ast.Oid(n.OldPktableOid), SkipValidation: n.SkipValidation, InitiallyValid: n.InitiallyValid, } } -func convertConstraintsSetStmt(n *nodes.ConstraintsSetStmt) *ast.ConstraintsSetStmt { +func convertConstraintsSetStmt(n *pg.ConstraintsSetStmt) *ast.ConstraintsSetStmt { if n == nil { return nil } return &ast.ConstraintsSetStmt{ - Constraints: convertList(n.Constraints), + Constraints: convertSlice(n.Constraints), Deferred: n.Deferred, } } -func convertConvertRowtypeExpr(n *nodes.ConvertRowtypeExpr) *ast.ConvertRowtypeExpr { +func convertConvertRowtypeExpr(n *pg.ConvertRowtypeExpr) *ast.ConvertRowtypeExpr { if n == nil { return nil } @@ -896,37 +946,37 @@ func convertConvertRowtypeExpr(n *nodes.ConvertRowtypeExpr) *ast.ConvertRowtypeE Arg: convertNode(n.Arg), Resulttype: ast.Oid(n.Resulttype), Convertformat: ast.CoercionForm(n.Convertformat), - Location: n.Location, + Location: int(n.Location), } } -func convertCopyStmt(n *nodes.CopyStmt) *ast.CopyStmt { +func convertCopyStmt(n *pg.CopyStmt) *ast.CopyStmt { if n == nil { return nil } return &ast.CopyStmt{ Relation: convertRangeVar(n.Relation), Query: convertNode(n.Query), - Attlist: convertList(n.Attlist), + Attlist: convertSlice(n.Attlist), IsFrom: n.IsFrom, IsProgram: n.IsProgram, - Filename: n.Filename, - Options: convertList(n.Options), + Filename: makeString(n.Filename), + Options: convertSlice(n.Options), } } -func convertCreateAmStmt(n *nodes.CreateAmStmt) *ast.CreateAmStmt { +func convertCreateAmStmt(n *pg.CreateAmStmt) *ast.CreateAmStmt { if n == nil { return nil } return &ast.CreateAmStmt{ - Amname: n.Amname, - HandlerName: convertList(n.HandlerName), - Amtype: n.Amtype, + Amname: makeString(n.Amname), + HandlerName: convertSlice(n.HandlerName), + Amtype: makeByte(n.Amtype), } } -func convertCreateCastStmt(n *nodes.CreateCastStmt) *ast.CreateCastStmt { +func convertCreateCastStmt(n *pg.CreateCastStmt) *ast.CreateCastStmt { if n == nil { return nil } @@ -939,446 +989,447 @@ func convertCreateCastStmt(n *nodes.CreateCastStmt) *ast.CreateCastStmt { } } -func convertCreateConversionStmt(n *nodes.CreateConversionStmt) *ast.CreateConversionStmt { +func convertCreateConversionStmt(n *pg.CreateConversionStmt) *ast.CreateConversionStmt { if n == nil { return nil } return &ast.CreateConversionStmt{ - ConversionName: convertList(n.ConversionName), - ForEncodingName: n.ForEncodingName, - ToEncodingName: n.ToEncodingName, - FuncName: convertList(n.FuncName), + ConversionName: convertSlice(n.ConversionName), + ForEncodingName: makeString(n.ForEncodingName), + ToEncodingName: makeString(n.ToEncodingName), + FuncName: convertSlice(n.FuncName), Def: n.Def, } } -func convertCreateDomainStmt(n *nodes.CreateDomainStmt) *ast.CreateDomainStmt { +func convertCreateDomainStmt(n *pg.CreateDomainStmt) *ast.CreateDomainStmt { if n == nil { return nil } return &ast.CreateDomainStmt{ - Domainname: convertList(n.Domainname), + Domainname: convertSlice(n.Domainname), TypeName: convertTypeName(n.TypeName), CollClause: convertCollateClause(n.CollClause), - Constraints: convertList(n.Constraints), + Constraints: convertSlice(n.Constraints), } } -func convertCreateEnumStmt(n *nodes.CreateEnumStmt) *ast.CreateEnumStmt { +func convertCreateEnumStmt(n *pg.CreateEnumStmt) *ast.CreateEnumStmt { if n == nil { return nil } - tn, err := parseTypeName(n.TypeName) + rel, err := parseRelationFromNodes(n.TypeName) if err != nil { panic(err) } return &ast.CreateEnumStmt{ - TypeName: tn, - Vals: convertList(n.Vals), + TypeName: rel.TypeName(), + Vals: convertSlice(n.Vals), } } -func convertCreateEventTrigStmt(n *nodes.CreateEventTrigStmt) *ast.CreateEventTrigStmt { +func convertCreateEventTrigStmt(n *pg.CreateEventTrigStmt) *ast.CreateEventTrigStmt { if n == nil { return nil } return &ast.CreateEventTrigStmt{ - Trigname: n.Trigname, - Eventname: n.Eventname, - Whenclause: convertList(n.Whenclause), - Funcname: convertList(n.Funcname), + Trigname: makeString(n.Trigname), + Eventname: makeString(n.Eventname), + Whenclause: convertSlice(n.Whenclause), + Funcname: convertSlice(n.Funcname), } } -func convertCreateExtensionStmt(n *nodes.CreateExtensionStmt) *ast.CreateExtensionStmt { +func convertCreateExtensionStmt(n *pg.CreateExtensionStmt) *ast.CreateExtensionStmt { if n == nil { return nil } return &ast.CreateExtensionStmt{ - Extname: n.Extname, + Extname: makeString(n.Extname), IfNotExists: n.IfNotExists, - Options: convertList(n.Options), + Options: convertSlice(n.Options), } } -func convertCreateFdwStmt(n *nodes.CreateFdwStmt) *ast.CreateFdwStmt { +func convertCreateFdwStmt(n *pg.CreateFdwStmt) *ast.CreateFdwStmt { if n == nil { return nil } return &ast.CreateFdwStmt{ - Fdwname: n.Fdwname, - FuncOptions: convertList(n.FuncOptions), - Options: convertList(n.Options), + Fdwname: makeString(n.Fdwname), + FuncOptions: convertSlice(n.FuncOptions), + Options: convertSlice(n.Options), } } -func convertCreateForeignServerStmt(n *nodes.CreateForeignServerStmt) *ast.CreateForeignServerStmt { +func convertCreateForeignServerStmt(n *pg.CreateForeignServerStmt) *ast.CreateForeignServerStmt { if n == nil { return nil } return &ast.CreateForeignServerStmt{ - Servername: n.Servername, - Servertype: n.Servertype, - Version: n.Version, - Fdwname: n.Fdwname, + Servername: makeString(n.Servername), + Servertype: makeString(n.Servertype), + Version: makeString(n.Version), + Fdwname: makeString(n.Fdwname), IfNotExists: n.IfNotExists, - Options: convertList(n.Options), + Options: convertSlice(n.Options), } } -func convertCreateForeignTableStmt(n *nodes.CreateForeignTableStmt) *ast.CreateForeignTableStmt { +func convertCreateForeignTableStmt(n *pg.CreateForeignTableStmt) *ast.CreateForeignTableStmt { if n == nil { return nil } return &ast.CreateForeignTableStmt{ - Base: convertCreateStmt(&n.Base), - Servername: n.Servername, - Options: convertList(n.Options), + Servername: makeString(n.Servername), + Options: convertSlice(n.Options), } } -func convertCreateFunctionStmt(n *nodes.CreateFunctionStmt) *ast.CreateFunctionStmt { +func convertCreateFunctionStmt(n *pg.CreateFunctionStmt) *ast.CreateFunctionStmt { if n == nil { return nil } - fn, err := parseFuncName(n.Funcname) + rel, err := parseRelationFromNodes(n.Funcname) if err != nil { panic(err) } return &ast.CreateFunctionStmt{ Replace: n.Replace, - Func: fn, - Params: convertList(n.Parameters), + Func: rel.FuncName(), + Params: convertSlice(n.Parameters), ReturnType: convertTypeName(n.ReturnType), - Options: convertList(n.Options), - WithClause: convertList(n.WithClause), + Options: convertSlice(n.Options), } } -func convertCreateOpClassItem(n *nodes.CreateOpClassItem) *ast.CreateOpClassItem { +func convertCreateOpClassItem(n *pg.CreateOpClassItem) *ast.CreateOpClassItem { if n == nil { return nil } return &ast.CreateOpClassItem{ - Itemtype: n.Itemtype, + Itemtype: int(n.Itemtype), Name: convertObjectWithArgs(n.Name), - Number: n.Number, - OrderFamily: convertList(n.OrderFamily), - ClassArgs: convertList(n.ClassArgs), + Number: int(n.Number), + OrderFamily: convertSlice(n.OrderFamily), + ClassArgs: convertSlice(n.ClassArgs), Storedtype: convertTypeName(n.Storedtype), } } -func convertCreateOpClassStmt(n *nodes.CreateOpClassStmt) *ast.CreateOpClassStmt { +func convertCreateOpClassStmt(n *pg.CreateOpClassStmt) *ast.CreateOpClassStmt { if n == nil { return nil } return &ast.CreateOpClassStmt{ - Opclassname: convertList(n.Opclassname), - Opfamilyname: convertList(n.Opfamilyname), - Amname: n.Amname, + Opclassname: convertSlice(n.Opclassname), + Opfamilyname: convertSlice(n.Opfamilyname), + Amname: makeString(n.Amname), Datatype: convertTypeName(n.Datatype), - Items: convertList(n.Items), + Items: convertSlice(n.Items), IsDefault: n.IsDefault, } } -func convertCreateOpFamilyStmt(n *nodes.CreateOpFamilyStmt) *ast.CreateOpFamilyStmt { +func convertCreateOpFamilyStmt(n *pg.CreateOpFamilyStmt) *ast.CreateOpFamilyStmt { if n == nil { return nil } return &ast.CreateOpFamilyStmt{ - Opfamilyname: convertList(n.Opfamilyname), - Amname: n.Amname, + Opfamilyname: convertSlice(n.Opfamilyname), + Amname: makeString(n.Amname), } } -func convertCreatePLangStmt(n *nodes.CreatePLangStmt) *ast.CreatePLangStmt { +func convertCreatePLangStmt(n *pg.CreatePLangStmt) *ast.CreatePLangStmt { if n == nil { return nil } return &ast.CreatePLangStmt{ Replace: n.Replace, - Plname: n.Plname, - Plhandler: convertList(n.Plhandler), - Plinline: convertList(n.Plinline), - Plvalidator: convertList(n.Plvalidator), + Plname: makeString(n.Plname), + Plhandler: convertSlice(n.Plhandler), + Plinline: convertSlice(n.Plinline), + Plvalidator: convertSlice(n.Plvalidator), Pltrusted: n.Pltrusted, } } -func convertCreatePolicyStmt(n *nodes.CreatePolicyStmt) *ast.CreatePolicyStmt { +func convertCreatePolicyStmt(n *pg.CreatePolicyStmt) *ast.CreatePolicyStmt { if n == nil { return nil } return &ast.CreatePolicyStmt{ - PolicyName: n.PolicyName, + PolicyName: makeString(n.PolicyName), Table: convertRangeVar(n.Table), - CmdName: n.CmdName, + CmdName: makeString(n.CmdName), Permissive: n.Permissive, - Roles: convertList(n.Roles), + Roles: convertSlice(n.Roles), Qual: convertNode(n.Qual), WithCheck: convertNode(n.WithCheck), } } -func convertCreatePublicationStmt(n *nodes.CreatePublicationStmt) *ast.CreatePublicationStmt { +func convertCreatePublicationStmt(n *pg.CreatePublicationStmt) *ast.CreatePublicationStmt { if n == nil { return nil } return &ast.CreatePublicationStmt{ - Pubname: n.Pubname, - Options: convertList(n.Options), - Tables: convertList(n.Tables), + Pubname: makeString(n.Pubname), + Options: convertSlice(n.Options), + Tables: convertSlice(n.Pubobjects), ForAllTables: n.ForAllTables, } } -func convertCreateRangeStmt(n *nodes.CreateRangeStmt) *ast.CreateRangeStmt { +func convertCreateRangeStmt(n *pg.CreateRangeStmt) *ast.CreateRangeStmt { if n == nil { return nil } return &ast.CreateRangeStmt{ - TypeName: convertList(n.TypeName), - Params: convertList(n.Params), + TypeName: convertSlice(n.TypeName), + Params: convertSlice(n.Params), } } -func convertCreateRoleStmt(n *nodes.CreateRoleStmt) *ast.CreateRoleStmt { +func convertCreateRoleStmt(n *pg.CreateRoleStmt) *ast.CreateRoleStmt { if n == nil { return nil } return &ast.CreateRoleStmt{ StmtType: ast.RoleStmtType(n.StmtType), - Role: n.Role, - Options: convertList(n.Options), + Role: makeString(n.Role), + Options: convertSlice(n.Options), } } -func convertCreateSchemaStmt(n *nodes.CreateSchemaStmt) *ast.CreateSchemaStmt { +func convertCreateSchemaStmt(n *pg.CreateSchemaStmt) *ast.CreateSchemaStmt { if n == nil { return nil } return &ast.CreateSchemaStmt{ - Name: n.Schemaname, + Name: makeString(n.Schemaname), Authrole: convertRoleSpec(n.Authrole), - SchemaElts: convertList(n.SchemaElts), + SchemaElts: convertSlice(n.SchemaElts), IfNotExists: n.IfNotExists, } } -func convertCreateSeqStmt(n *nodes.CreateSeqStmt) *ast.CreateSeqStmt { +func convertCreateSeqStmt(n *pg.CreateSeqStmt) *ast.CreateSeqStmt { if n == nil { return nil } return &ast.CreateSeqStmt{ Sequence: convertRangeVar(n.Sequence), - Options: convertList(n.Options), + Options: convertSlice(n.Options), OwnerId: ast.Oid(n.OwnerId), ForIdentity: n.ForIdentity, IfNotExists: n.IfNotExists, } } -func convertCreateStatsStmt(n *nodes.CreateStatsStmt) *ast.CreateStatsStmt { +func convertCreateStatsStmt(n *pg.CreateStatsStmt) *ast.CreateStatsStmt { if n == nil { return nil } return &ast.CreateStatsStmt{ - Defnames: convertList(n.Defnames), - StatTypes: convertList(n.StatTypes), - Exprs: convertList(n.Exprs), - Relations: convertList(n.Relations), + Defnames: convertSlice(n.Defnames), + StatTypes: convertSlice(n.StatTypes), + Exprs: convertSlice(n.Exprs), + Relations: convertSlice(n.Relations), IfNotExists: n.IfNotExists, } } -func convertCreateStmt(n *nodes.CreateStmt) *ast.CreateStmt { +func convertCreateStmt(n *pg.CreateStmt) *ast.CreateStmt { if n == nil { return nil } return &ast.CreateStmt{ Relation: convertRangeVar(n.Relation), - TableElts: convertList(n.TableElts), - InhRelations: convertList(n.InhRelations), + TableElts: convertSlice(n.TableElts), + InhRelations: convertSlice(n.InhRelations), Partbound: convertPartitionBoundSpec(n.Partbound), Partspec: convertPartitionSpec(n.Partspec), OfTypename: convertTypeName(n.OfTypename), - Constraints: convertList(n.Constraints), - Options: convertList(n.Options), + Constraints: convertSlice(n.Constraints), + Options: convertSlice(n.Options), Oncommit: ast.OnCommitAction(n.Oncommit), - Tablespacename: n.Tablespacename, + Tablespacename: makeString(n.Tablespacename), IfNotExists: n.IfNotExists, } } -func convertCreateSubscriptionStmt(n *nodes.CreateSubscriptionStmt) *ast.CreateSubscriptionStmt { +func convertCreateSubscriptionStmt(n *pg.CreateSubscriptionStmt) *ast.CreateSubscriptionStmt { if n == nil { return nil } return &ast.CreateSubscriptionStmt{ - Subname: n.Subname, - Conninfo: n.Conninfo, - Publication: convertList(n.Publication), - Options: convertList(n.Options), + Subname: makeString(n.Subname), + Conninfo: makeString(n.Conninfo), + Publication: convertSlice(n.Publication), + Options: convertSlice(n.Options), } } -func convertCreateTableAsStmt(n *nodes.CreateTableAsStmt) *ast.CreateTableAsStmt { +func convertCreateTableAsStmt(n *pg.CreateTableAsStmt) *ast.CreateTableAsStmt { if n == nil { return nil } - return &ast.CreateTableAsStmt{ + res := &ast.CreateTableAsStmt{ Query: convertNode(n.Query), Into: convertIntoClause(n.Into), - Relkind: ast.ObjectType(n.Relkind), + Relkind: ast.ObjectType(n.Objtype), IsSelectInto: n.IsSelectInto, IfNotExists: n.IfNotExists, } + return res } -func convertCreateTableSpaceStmt(n *nodes.CreateTableSpaceStmt) *ast.CreateTableSpaceStmt { +func convertCreateTableSpaceStmt(n *pg.CreateTableSpaceStmt) *ast.CreateTableSpaceStmt { if n == nil { return nil } return &ast.CreateTableSpaceStmt{ - Tablespacename: n.Tablespacename, + Tablespacename: makeString(n.Tablespacename), Owner: convertRoleSpec(n.Owner), - Location: n.Location, - Options: convertList(n.Options), + Location: makeString(n.Location), + Options: convertSlice(n.Options), } } -func convertCreateTransformStmt(n *nodes.CreateTransformStmt) *ast.CreateTransformStmt { +func convertCreateTransformStmt(n *pg.CreateTransformStmt) *ast.CreateTransformStmt { if n == nil { return nil } return &ast.CreateTransformStmt{ Replace: n.Replace, TypeName: convertTypeName(n.TypeName), - Lang: n.Lang, + Lang: makeString(n.Lang), Fromsql: convertObjectWithArgs(n.Fromsql), Tosql: convertObjectWithArgs(n.Tosql), } } -func convertCreateTrigStmt(n *nodes.CreateTrigStmt) *ast.CreateTrigStmt { +func convertCreateTrigStmt(n *pg.CreateTrigStmt) *ast.CreateTrigStmt { if n == nil { return nil } return &ast.CreateTrigStmt{ - Trigname: n.Trigname, + Trigname: makeString(n.Trigname), Relation: convertRangeVar(n.Relation), - Funcname: convertList(n.Funcname), - Args: convertList(n.Args), + Funcname: convertSlice(n.Funcname), + Args: convertSlice(n.Args), Row: n.Row, - Timing: n.Timing, - Events: n.Events, - Columns: convertList(n.Columns), + Timing: int16(n.Timing), + Events: int16(n.Events), + Columns: convertSlice(n.Columns), WhenClause: convertNode(n.WhenClause), Isconstraint: n.Isconstraint, - TransitionRels: convertList(n.TransitionRels), + TransitionRels: convertSlice(n.TransitionRels), Deferrable: n.Deferrable, Initdeferred: n.Initdeferred, Constrrel: convertRangeVar(n.Constrrel), } } -func convertCreateUserMappingStmt(n *nodes.CreateUserMappingStmt) *ast.CreateUserMappingStmt { +func convertCreateUserMappingStmt(n *pg.CreateUserMappingStmt) *ast.CreateUserMappingStmt { if n == nil { return nil } return &ast.CreateUserMappingStmt{ User: convertRoleSpec(n.User), - Servername: n.Servername, + Servername: makeString(n.Servername), IfNotExists: n.IfNotExists, - Options: convertList(n.Options), + Options: convertSlice(n.Options), } } -func convertCreatedbStmt(n *nodes.CreatedbStmt) *ast.CreatedbStmt { +func convertCreatedbStmt(n *pg.CreatedbStmt) *ast.CreatedbStmt { if n == nil { return nil } return &ast.CreatedbStmt{ - Dbname: n.Dbname, - Options: convertList(n.Options), + Dbname: makeString(n.Dbname), + Options: convertSlice(n.Options), } } -func convertCurrentOfExpr(n *nodes.CurrentOfExpr) *ast.CurrentOfExpr { +func convertCurrentOfExpr(n *pg.CurrentOfExpr) *ast.CurrentOfExpr { if n == nil { return nil } return &ast.CurrentOfExpr{ Xpr: convertNode(n.Xpr), Cvarno: ast.Index(n.Cvarno), - CursorName: n.CursorName, - CursorParam: n.CursorParam, + CursorName: makeString(n.CursorName), + CursorParam: int(n.CursorParam), } } -func convertDeallocateStmt(n *nodes.DeallocateStmt) *ast.DeallocateStmt { +func convertDeallocateStmt(n *pg.DeallocateStmt) *ast.DeallocateStmt { if n == nil { return nil } return &ast.DeallocateStmt{ - Name: n.Name, + Name: makeString(n.Name), } } -func convertDeclareCursorStmt(n *nodes.DeclareCursorStmt) *ast.DeclareCursorStmt { +func convertDeclareCursorStmt(n *pg.DeclareCursorStmt) *ast.DeclareCursorStmt { if n == nil { return nil } return &ast.DeclareCursorStmt{ - Portalname: n.Portalname, - Options: n.Options, + Portalname: makeString(n.Portalname), + Options: int(n.Options), Query: convertNode(n.Query), } } -func convertDefElem(n *nodes.DefElem) *ast.DefElem { +func convertDefElem(n *pg.DefElem) *ast.DefElem { if n == nil { return nil } return &ast.DefElem{ - Defnamespace: n.Defnamespace, - Defname: n.Defname, + Defnamespace: makeString(n.Defnamespace), + Defname: makeString(n.Defname), Arg: convertNode(n.Arg), Defaction: ast.DefElemAction(n.Defaction), - Location: n.Location, + Location: int(n.Location), } } -func convertDefineStmt(n *nodes.DefineStmt) *ast.DefineStmt { +func convertDefineStmt(n *pg.DefineStmt) *ast.DefineStmt { if n == nil { return nil } return &ast.DefineStmt{ Kind: ast.ObjectType(n.Kind), Oldstyle: n.Oldstyle, - Defnames: convertList(n.Defnames), - Args: convertList(n.Args), - Definition: convertList(n.Definition), + Defnames: convertSlice(n.Defnames), + Args: convertSlice(n.Args), + Definition: convertSlice(n.Definition), IfNotExists: n.IfNotExists, } } -func convertDeleteStmt(n *nodes.DeleteStmt) *ast.DeleteStmt { +func convertDeleteStmt(n *pg.DeleteStmt) *ast.DeleteStmt { if n == nil { return nil } return &ast.DeleteStmt{ - Relation: convertRangeVar(n.Relation), - UsingClause: convertList(n.UsingClause), + Relations: &ast.List{ + Items: []ast.Node{convertRangeVar(n.Relation)}, + }, + UsingClause: convertSlice(n.UsingClause), WhereClause: convertNode(n.WhereClause), - ReturningList: convertList(n.ReturningList), + ReturningList: convertSlice(n.ReturningList), WithClause: convertWithClause(n.WithClause), } } -func convertDiscardStmt(n *nodes.DiscardStmt) *ast.DiscardStmt { +func convertDiscardStmt(n *pg.DiscardStmt) *ast.DiscardStmt { if n == nil { return nil } @@ -1387,41 +1438,41 @@ func convertDiscardStmt(n *nodes.DiscardStmt) *ast.DiscardStmt { } } -func convertDoStmt(n *nodes.DoStmt) *ast.DoStmt { +func convertDoStmt(n *pg.DoStmt) *ast.DoStmt { if n == nil { return nil } return &ast.DoStmt{ - Args: convertList(n.Args), + Args: convertSlice(n.Args), } } -func convertDropOwnedStmt(n *nodes.DropOwnedStmt) *ast.DropOwnedStmt { +func convertDropOwnedStmt(n *pg.DropOwnedStmt) *ast.DropOwnedStmt { if n == nil { return nil } return &ast.DropOwnedStmt{ - Roles: convertList(n.Roles), + Roles: convertSlice(n.Roles), Behavior: ast.DropBehavior(n.Behavior), } } -func convertDropRoleStmt(n *nodes.DropRoleStmt) *ast.DropRoleStmt { +func convertDropRoleStmt(n *pg.DropRoleStmt) *ast.DropRoleStmt { if n == nil { return nil } return &ast.DropRoleStmt{ - Roles: convertList(n.Roles), + Roles: convertSlice(n.Roles), MissingOk: n.MissingOk, } } -func convertDropStmt(n *nodes.DropStmt) *ast.DropStmt { +func convertDropStmt(n *pg.DropStmt) *ast.DropStmt { if n == nil { return nil } return &ast.DropStmt{ - Objects: convertList(n.Objects), + Objects: convertSlice(n.Objects), RemoveType: ast.ObjectType(n.RemoveType), Behavior: ast.DropBehavior(n.Behavior), MissingOk: n.MissingOk, @@ -1429,88 +1480,81 @@ func convertDropStmt(n *nodes.DropStmt) *ast.DropStmt { } } -func convertDropSubscriptionStmt(n *nodes.DropSubscriptionStmt) *ast.DropSubscriptionStmt { +func convertDropSubscriptionStmt(n *pg.DropSubscriptionStmt) *ast.DropSubscriptionStmt { if n == nil { return nil } return &ast.DropSubscriptionStmt{ - Subname: n.Subname, + Subname: makeString(n.Subname), MissingOk: n.MissingOk, Behavior: ast.DropBehavior(n.Behavior), } } -func convertDropTableSpaceStmt(n *nodes.DropTableSpaceStmt) *ast.DropTableSpaceStmt { +func convertDropTableSpaceStmt(n *pg.DropTableSpaceStmt) *ast.DropTableSpaceStmt { if n == nil { return nil } return &ast.DropTableSpaceStmt{ - Tablespacename: n.Tablespacename, + Tablespacename: makeString(n.Tablespacename), MissingOk: n.MissingOk, } } -func convertDropUserMappingStmt(n *nodes.DropUserMappingStmt) *ast.DropUserMappingStmt { +func convertDropUserMappingStmt(n *pg.DropUserMappingStmt) *ast.DropUserMappingStmt { if n == nil { return nil } return &ast.DropUserMappingStmt{ User: convertRoleSpec(n.User), - Servername: n.Servername, + Servername: makeString(n.Servername), MissingOk: n.MissingOk, } } -func convertDropdbStmt(n *nodes.DropdbStmt) *ast.DropdbStmt { +func convertDropdbStmt(n *pg.DropdbStmt) *ast.DropdbStmt { if n == nil { return nil } return &ast.DropdbStmt{ - Dbname: n.Dbname, + Dbname: makeString(n.Dbname), MissingOk: n.MissingOk, } } -func convertExecuteStmt(n *nodes.ExecuteStmt) *ast.ExecuteStmt { +func convertExecuteStmt(n *pg.ExecuteStmt) *ast.ExecuteStmt { if n == nil { return nil } return &ast.ExecuteStmt{ - Name: n.Name, - Params: convertList(n.Params), + Name: makeString(n.Name), + Params: convertSlice(n.Params), } } -func convertExplainStmt(n *nodes.ExplainStmt) *ast.ExplainStmt { +func convertExplainStmt(n *pg.ExplainStmt) *ast.ExplainStmt { if n == nil { return nil } return &ast.ExplainStmt{ Query: convertNode(n.Query), - Options: convertList(n.Options), + Options: convertSlice(n.Options), } } -func convertExpr(n *nodes.Expr) *ast.Expr { - if n == nil { - return nil - } - return &ast.Expr{} -} - -func convertFetchStmt(n *nodes.FetchStmt) *ast.FetchStmt { +func convertFetchStmt(n *pg.FetchStmt) *ast.FetchStmt { if n == nil { return nil } return &ast.FetchStmt{ Direction: ast.FetchDirection(n.Direction), HowMany: n.HowMany, - Portalname: n.Portalname, + Portalname: makeString(n.Portalname), Ismove: n.Ismove, } } -func convertFieldSelect(n *nodes.FieldSelect) *ast.FieldSelect { +func convertFieldSelect(n *pg.FieldSelect) *ast.FieldSelect { if n == nil { return nil } @@ -1524,63 +1568,63 @@ func convertFieldSelect(n *nodes.FieldSelect) *ast.FieldSelect { } } -func convertFieldStore(n *nodes.FieldStore) *ast.FieldStore { +func convertFieldStore(n *pg.FieldStore) *ast.FieldStore { if n == nil { return nil } return &ast.FieldStore{ Xpr: convertNode(n.Xpr), Arg: convertNode(n.Arg), - Newvals: convertList(n.Newvals), - Fieldnums: convertList(n.Fieldnums), + Newvals: convertSlice(n.Newvals), + Fieldnums: convertSlice(n.Fieldnums), Resulttype: ast.Oid(n.Resulttype), } } -func convertFloat(n *nodes.Float) *ast.Float { +func convertFloat(n *pg.Float) *ast.Float { if n == nil { return nil } return &ast.Float{ - Str: n.Str, + Str: n.Fval, } } -func convertFromExpr(n *nodes.FromExpr) *ast.FromExpr { +func convertFromExpr(n *pg.FromExpr) *ast.FromExpr { if n == nil { return nil } return &ast.FromExpr{ - Fromlist: convertList(n.Fromlist), + Fromlist: convertSlice(n.Fromlist), Quals: convertNode(n.Quals), } } -func convertFuncCall(n *nodes.FuncCall) *ast.FuncCall { +func convertFuncCall(n *pg.FuncCall) *ast.FuncCall { if n == nil { return nil } - fn, err := parseFuncName(n.Funcname) + rel, err := parseRelationFromNodes(n.Funcname) if err != nil { // TODO: How should we handle errors? panic(err) } return &ast.FuncCall{ - Func: fn, - Funcname: convertList(n.Funcname), - Args: convertList(n.Args), - AggOrder: convertList(n.AggOrder), + Func: rel.FuncName(), + Funcname: convertSlice(n.Funcname), + Args: convertSlice(n.Args), + AggOrder: convertSlice(n.AggOrder), AggFilter: convertNode(n.AggFilter), AggWithinGroup: n.AggWithinGroup, AggStar: n.AggStar, AggDistinct: n.AggDistinct, FuncVariadic: n.FuncVariadic, Over: convertWindowDef(n.Over), - Location: n.Location, + Location: int(n.Location), } } -func convertFuncExpr(n *nodes.FuncExpr) *ast.FuncExpr { +func convertFuncExpr(n *pg.FuncExpr) *ast.FuncExpr { if n == nil { return nil } @@ -1593,38 +1637,37 @@ func convertFuncExpr(n *nodes.FuncExpr) *ast.FuncExpr { Funcformat: ast.CoercionForm(n.Funcformat), Funccollid: ast.Oid(n.Funccollid), Inputcollid: ast.Oid(n.Inputcollid), - Args: convertList(n.Args), - Location: n.Location, + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertFunctionParameter(n *nodes.FunctionParameter) *ast.FunctionParameter { +func convertFunctionParameter(n *pg.FunctionParameter) *ast.FunctionParameter { if n == nil { return nil } return &ast.FunctionParameter{ - Name: n.Name, + Name: makeString(n.Name), ArgType: convertTypeName(n.ArgType), Mode: ast.FunctionParameterMode(n.Mode), Defexpr: convertNode(n.Defexpr), } } -func convertGrantRoleStmt(n *nodes.GrantRoleStmt) *ast.GrantRoleStmt { +func convertGrantRoleStmt(n *pg.GrantRoleStmt) *ast.GrantRoleStmt { if n == nil { return nil } return &ast.GrantRoleStmt{ - GrantedRoles: convertList(n.GrantedRoles), - GranteeRoles: convertList(n.GranteeRoles), + GrantedRoles: convertSlice(n.GrantedRoles), + GranteeRoles: convertSlice(n.GranteeRoles), IsGrant: n.IsGrant, - AdminOpt: n.AdminOpt, Grantor: convertRoleSpec(n.Grantor), Behavior: ast.DropBehavior(n.Behavior), } } -func convertGrantStmt(n *nodes.GrantStmt) *ast.GrantStmt { +func convertGrantStmt(n *pg.GrantStmt) *ast.GrantStmt { if n == nil { return nil } @@ -1632,84 +1675,82 @@ func convertGrantStmt(n *nodes.GrantStmt) *ast.GrantStmt { IsGrant: n.IsGrant, Targtype: ast.GrantTargetType(n.Targtype), Objtype: ast.GrantObjectType(n.Objtype), - Objects: convertList(n.Objects), - Privileges: convertList(n.Privileges), - Grantees: convertList(n.Grantees), + Objects: convertSlice(n.Objects), + Privileges: convertSlice(n.Privileges), + Grantees: convertSlice(n.Grantees), GrantOption: n.GrantOption, Behavior: ast.DropBehavior(n.Behavior), } } -func convertGroupingFunc(n *nodes.GroupingFunc) *ast.GroupingFunc { +func convertGroupingFunc(n *pg.GroupingFunc) *ast.GroupingFunc { if n == nil { return nil } return &ast.GroupingFunc{ Xpr: convertNode(n.Xpr), - Args: convertList(n.Args), - Refs: convertList(n.Refs), - Cols: convertList(n.Cols), + Args: convertSlice(n.Args), + Refs: convertSlice(n.Refs), Agglevelsup: ast.Index(n.Agglevelsup), - Location: n.Location, + Location: int(n.Location), } } -func convertGroupingSet(n *nodes.GroupingSet) *ast.GroupingSet { +func convertGroupingSet(n *pg.GroupingSet) *ast.GroupingSet { if n == nil { return nil } return &ast.GroupingSet{ Kind: ast.GroupingSetKind(n.Kind), - Content: convertList(n.Content), - Location: n.Location, + Content: convertSlice(n.Content), + Location: int(n.Location), } } -func convertImportForeignSchemaStmt(n *nodes.ImportForeignSchemaStmt) *ast.ImportForeignSchemaStmt { +func convertImportForeignSchemaStmt(n *pg.ImportForeignSchemaStmt) *ast.ImportForeignSchemaStmt { if n == nil { return nil } return &ast.ImportForeignSchemaStmt{ - ServerName: n.ServerName, - RemoteSchema: n.RemoteSchema, - LocalSchema: n.LocalSchema, + ServerName: makeString(n.ServerName), + RemoteSchema: makeString(n.RemoteSchema), + LocalSchema: makeString(n.LocalSchema), ListType: ast.ImportForeignSchemaType(n.ListType), - TableList: convertList(n.TableList), - Options: convertList(n.Options), + TableList: convertSlice(n.TableList), + Options: convertSlice(n.Options), } } -func convertIndexElem(n *nodes.IndexElem) *ast.IndexElem { +func convertIndexElem(n *pg.IndexElem) *ast.IndexElem { if n == nil { return nil } return &ast.IndexElem{ - Name: n.Name, + Name: makeString(n.Name), Expr: convertNode(n.Expr), - Indexcolname: n.Indexcolname, - Collation: convertList(n.Collation), - Opclass: convertList(n.Opclass), + Indexcolname: makeString(n.Indexcolname), + Collation: convertSlice(n.Collation), + Opclass: convertSlice(n.Opclass), Ordering: ast.SortByDir(n.Ordering), NullsOrdering: ast.SortByNulls(n.NullsOrdering), } } -func convertIndexStmt(n *nodes.IndexStmt) *ast.IndexStmt { +func convertIndexStmt(n *pg.IndexStmt) *ast.IndexStmt { if n == nil { return nil } return &ast.IndexStmt{ - Idxname: n.Idxname, + Idxname: makeString(n.Idxname), Relation: convertRangeVar(n.Relation), - AccessMethod: n.AccessMethod, - TableSpace: n.TableSpace, - IndexParams: convertList(n.IndexParams), - Options: convertList(n.Options), + AccessMethod: makeString(n.AccessMethod), + TableSpace: makeString(n.TableSpace), + IndexParams: convertSlice(n.IndexParams), + Options: convertSlice(n.Options), WhereClause: convertNode(n.WhereClause), - ExcludeOpNames: convertList(n.ExcludeOpNames), - Idxcomment: n.Idxcomment, + 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, @@ -1721,19 +1762,19 @@ func convertIndexStmt(n *nodes.IndexStmt) *ast.IndexStmt { } } -func convertInferClause(n *nodes.InferClause) *ast.InferClause { +func convertInferClause(n *pg.InferClause) *ast.InferClause { if n == nil { return nil } return &ast.InferClause{ - IndexElems: convertList(n.IndexElems), + IndexElems: convertSlice(n.IndexElems), WhereClause: convertNode(n.WhereClause), - Conname: n.Conname, - Location: n.Location, + Conname: makeString(n.Conname), + Location: int(n.Location), } } -func convertInferenceElem(n *nodes.InferenceElem) *ast.InferenceElem { +func convertInferenceElem(n *pg.InferenceElem) *ast.InferenceElem { if n == nil { return nil } @@ -1745,57 +1786,57 @@ func convertInferenceElem(n *nodes.InferenceElem) *ast.InferenceElem { } } -func convertInlineCodeBlock(n *nodes.InlineCodeBlock) *ast.InlineCodeBlock { +func convertInlineCodeBlock(n *pg.InlineCodeBlock) *ast.InlineCodeBlock { if n == nil { return nil } return &ast.InlineCodeBlock{ - SourceText: n.SourceText, + SourceText: makeString(n.SourceText), LangOid: ast.Oid(n.LangOid), LangIsTrusted: n.LangIsTrusted, } } -func convertInsertStmt(n *nodes.InsertStmt) *ast.InsertStmt { +func convertInsertStmt(n *pg.InsertStmt) *ast.InsertStmt { if n == nil { return nil } return &ast.InsertStmt{ Relation: convertRangeVar(n.Relation), - Cols: convertList(n.Cols), + Cols: convertSlice(n.Cols), SelectStmt: convertNode(n.SelectStmt), OnConflictClause: convertOnConflictClause(n.OnConflictClause), - ReturningList: convertList(n.ReturningList), + ReturningList: convertSlice(n.ReturningList), WithClause: convertWithClause(n.WithClause), Override: ast.OverridingKind(n.Override), } } -func convertInteger(n *nodes.Integer) *ast.Integer { +func convertInteger(n *pg.Integer) *ast.Integer { if n == nil { return nil } return &ast.Integer{ - Ival: n.Ival, + Ival: int64(n.Ival), } } -func convertIntoClause(n *nodes.IntoClause) *ast.IntoClause { +func convertIntoClause(n *pg.IntoClause) *ast.IntoClause { if n == nil { return nil } return &ast.IntoClause{ Rel: convertRangeVar(n.Rel), - ColNames: convertList(n.ColNames), - Options: convertList(n.Options), + ColNames: convertSlice(n.ColNames), + Options: convertSlice(n.Options), OnCommit: ast.OnCommitAction(n.OnCommit), - TableSpaceName: n.TableSpaceName, + TableSpaceName: makeString(n.TableSpaceName), ViewQuery: convertNode(n.ViewQuery), SkipData: n.SkipData, } } -func convertJoinExpr(n *nodes.JoinExpr) *ast.JoinExpr { +func convertJoinExpr(n *pg.JoinExpr) *ast.JoinExpr { if n == nil { return nil } @@ -1804,54 +1845,54 @@ func convertJoinExpr(n *nodes.JoinExpr) *ast.JoinExpr { IsNatural: n.IsNatural, Larg: convertNode(n.Larg), Rarg: convertNode(n.Rarg), - UsingClause: convertList(n.UsingClause), + UsingClause: convertSlice(n.UsingClause), Quals: convertNode(n.Quals), Alias: convertAlias(n.Alias), - Rtindex: n.Rtindex, + Rtindex: int(n.Rtindex), } } -func convertListenStmt(n *nodes.ListenStmt) *ast.ListenStmt { +func convertListenStmt(n *pg.ListenStmt) *ast.ListenStmt { if n == nil { return nil } return &ast.ListenStmt{ - Conditionname: n.Conditionname, + Conditionname: makeString(n.Conditionname), } } -func convertLoadStmt(n *nodes.LoadStmt) *ast.LoadStmt { +func convertLoadStmt(n *pg.LoadStmt) *ast.LoadStmt { if n == nil { return nil } return &ast.LoadStmt{ - Filename: n.Filename, + Filename: makeString(n.Filename), } } -func convertLockStmt(n *nodes.LockStmt) *ast.LockStmt { +func convertLockStmt(n *pg.LockStmt) *ast.LockStmt { if n == nil { return nil } return &ast.LockStmt{ - Relations: convertList(n.Relations), - Mode: n.Mode, + Relations: convertSlice(n.Relations), + Mode: int(n.Mode), Nowait: n.Nowait, } } -func convertLockingClause(n *nodes.LockingClause) *ast.LockingClause { +func convertLockingClause(n *pg.LockingClause) *ast.LockingClause { if n == nil { return nil } return &ast.LockingClause{ - LockedRels: convertList(n.LockedRels), + LockedRels: convertSlice(n.LockedRels), Strength: ast.LockClauseStrength(n.Strength), WaitPolicy: ast.LockWaitPolicy(n.WaitPolicy), } } -func convertMinMaxExpr(n *nodes.MinMaxExpr) *ast.MinMaxExpr { +func convertMinMaxExpr(n *pg.MinMaxExpr) *ast.MinMaxExpr { if n == nil { return nil } @@ -1861,36 +1902,36 @@ func convertMinMaxExpr(n *nodes.MinMaxExpr) *ast.MinMaxExpr { Minmaxcollid: ast.Oid(n.Minmaxcollid), Inputcollid: ast.Oid(n.Inputcollid), Op: ast.MinMaxOp(n.Op), - Args: convertList(n.Args), - Location: n.Location, + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertMultiAssignRef(n *nodes.MultiAssignRef) *ast.MultiAssignRef { +func convertMultiAssignRef(n *pg.MultiAssignRef) *ast.MultiAssignRef { if n == nil { return nil } return &ast.MultiAssignRef{ Source: convertNode(n.Source), - Colno: n.Colno, - Ncolumns: n.Ncolumns, + Colno: int(n.Colno), + Ncolumns: int(n.Ncolumns), } } -func convertNamedArgExpr(n *nodes.NamedArgExpr) *ast.NamedArgExpr { +func convertNamedArgExpr(n *pg.NamedArgExpr) *ast.NamedArgExpr { if n == nil { return nil } return &ast.NamedArgExpr{ Xpr: convertNode(n.Xpr), Arg: convertNode(n.Arg), - Name: n.Name, - Argnumber: n.Argnumber, - Location: n.Location, + Name: makeString(n.Name), + Argnumber: int(n.Argnumber), + Location: int(n.Location), } } -func convertNextValueExpr(n *nodes.NextValueExpr) *ast.NextValueExpr { +func convertNextValueExpr(n *pg.NextValueExpr) *ast.NextValueExpr { if n == nil { return nil } @@ -1901,167 +1942,145 @@ func convertNextValueExpr(n *nodes.NextValueExpr) *ast.NextValueExpr { } } -func convertNotifyStmt(n *nodes.NotifyStmt) *ast.NotifyStmt { +func convertNotifyStmt(n *pg.NotifyStmt) *ast.NotifyStmt { if n == nil { return nil } return &ast.NotifyStmt{ - Conditionname: n.Conditionname, - Payload: n.Payload, + Conditionname: makeString(n.Conditionname), + Payload: makeString(n.Payload), } } -func convertNull(n *nodes.Null) *ast.Null { +func convertNullTest(n *pg.NullTest) *ast.NullTest { if n == nil { return nil } - return &ast.Null{} + return &ast.NullTest{ + Xpr: convertNode(n.Xpr), + Arg: convertNode(n.Arg), + Nulltesttype: ast.NullTestType(n.Nulltesttype), + Argisrow: n.Argisrow, + Location: int(n.Location), + } } -func convertNullTest(n *nodes.NullTest) *ast.NullTest { +func convertNullIfExpr(n *pg.NullIfExpr) *ast.NullIfExpr { if n == nil { return nil } - return &ast.NullTest{ + return &ast.NullIfExpr{ Xpr: convertNode(n.Xpr), - Arg: convertNode(n.Arg), - Nulltesttype: ast.NullTestType(n.Nulltesttype), - Argisrow: n.Argisrow, - Location: n.Location, + 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 *nodes.ObjectWithArgs) *ast.ObjectWithArgs { +func convertObjectWithArgs(n *pg.ObjectWithArgs) *ast.ObjectWithArgs { if n == nil { return nil } return &ast.ObjectWithArgs{ - Objname: convertList(n.Objname), - Objargs: convertList(n.Objargs), + Objname: convertSlice(n.Objname), + Objargs: convertSlice(n.Objargs), ArgsUnspecified: n.ArgsUnspecified, } } -func convertOnConflictClause(n *nodes.OnConflictClause) *ast.OnConflictClause { +func convertOnConflictClause(n *pg.OnConflictClause) *ast.OnConflictClause { if n == nil { return nil } return &ast.OnConflictClause{ Action: ast.OnConflictAction(n.Action), Infer: convertInferClause(n.Infer), - TargetList: convertList(n.TargetList), + TargetList: convertSlice(n.TargetList), WhereClause: convertNode(n.WhereClause), - Location: n.Location, + Location: int(n.Location), } } -func convertOnConflictExpr(n *nodes.OnConflictExpr) *ast.OnConflictExpr { +func convertOnConflictExpr(n *pg.OnConflictExpr) *ast.OnConflictExpr { if n == nil { return nil } return &ast.OnConflictExpr{ Action: ast.OnConflictAction(n.Action), - ArbiterElems: convertList(n.ArbiterElems), + ArbiterElems: convertSlice(n.ArbiterElems), ArbiterWhere: convertNode(n.ArbiterWhere), Constraint: ast.Oid(n.Constraint), - OnConflictSet: convertList(n.OnConflictSet), + OnConflictSet: convertSlice(n.OnConflictSet), OnConflictWhere: convertNode(n.OnConflictWhere), - ExclRelIndex: n.ExclRelIndex, - ExclRelTlist: convertList(n.ExclRelTlist), + ExclRelIndex: int(n.ExclRelIndex), + ExclRelTlist: convertSlice(n.ExclRelTlist), } } -func convertOpExpr(n *nodes.OpExpr) *ast.OpExpr { +func convertOpExpr(n *pg.OpExpr) *ast.OpExpr { if n == nil { return nil } 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), Inputcollid: ast.Oid(n.Inputcollid), - Args: convertList(n.Args), - Location: n.Location, + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertParam(n *nodes.Param) *ast.Param { +func convertParam(n *pg.Param) *ast.Param { if n == nil { return nil } return &ast.Param{ Xpr: convertNode(n.Xpr), Paramkind: ast.ParamKind(n.Paramkind), - Paramid: n.Paramid, + Paramid: int(n.Paramid), Paramtype: ast.Oid(n.Paramtype), Paramtypmod: n.Paramtypmod, Paramcollid: ast.Oid(n.Paramcollid), - Location: n.Location, + Location: int(n.Location), } } -func convertParamExecData(n *nodes.ParamExecData) *ast.ParamExecData { +func convertParamRef(n *pg.ParamRef) *ast.ParamRef { if n == nil { return nil } - return &ast.ParamExecData{ - ExecPlan: &ast.TODO{}, - Value: ast.Datum(n.Value), - Isnull: n.Isnull, - } -} - -func convertParamExternData(n *nodes.ParamExternData) *ast.ParamExternData { - if n == nil { - return nil - } - return &ast.ParamExternData{ - Value: ast.Datum(n.Value), - Isnull: n.Isnull, - Pflags: n.Pflags, - Ptype: ast.Oid(n.Ptype), - } -} - -func convertParamListInfoData(n *nodes.ParamListInfoData) *ast.ParamListInfoData { - if n == nil { - return nil - } - return &ast.ParamListInfoData{ - ParamFetchArg: &ast.TODO{}, - ParserSetupArg: &ast.TODO{}, - NumParams: n.NumParams, - ParamMask: n.ParamMask, - } -} - -func convertParamRef(n *nodes.ParamRef) *ast.ParamRef { - if n == nil { - return nil + var dollar bool + if n.Number != 0 { + dollar = true } return &ast.ParamRef{ - Number: n.Number, - Location: n.Location, + Dollar: dollar, + Number: int(n.Number), + Location: int(n.Location), } } -func convertPartitionBoundSpec(n *nodes.PartitionBoundSpec) *ast.PartitionBoundSpec { +func convertPartitionBoundSpec(n *pg.PartitionBoundSpec) *ast.PartitionBoundSpec { if n == nil { return nil } return &ast.PartitionBoundSpec{ - Strategy: n.Strategy, - Listdatums: convertList(n.Listdatums), - Lowerdatums: convertList(n.Lowerdatums), - Upperdatums: convertList(n.Upperdatums), - Location: n.Location, + Strategy: makeByte(n.Strategy), + Listdatums: convertSlice(n.Listdatums), + Lowerdatums: convertSlice(n.Lowerdatums), + Upperdatums: convertSlice(n.Upperdatums), + Location: int(n.Location), } } -func convertPartitionCmd(n *nodes.PartitionCmd) *ast.PartitionCmd { +func convertPartitionCmd(n *pg.PartitionCmd) *ast.PartitionCmd { if n == nil { return nil } @@ -2071,63 +2090,62 @@ func convertPartitionCmd(n *nodes.PartitionCmd) *ast.PartitionCmd { } } -func convertPartitionElem(n *nodes.PartitionElem) *ast.PartitionElem { +func convertPartitionElem(n *pg.PartitionElem) *ast.PartitionElem { if n == nil { return nil } return &ast.PartitionElem{ - Name: n.Name, + Name: makeString(n.Name), Expr: convertNode(n.Expr), - Collation: convertList(n.Collation), - Opclass: convertList(n.Opclass), - Location: n.Location, + Collation: convertSlice(n.Collation), + Opclass: convertSlice(n.Opclass), + Location: int(n.Location), } } -func convertPartitionRangeDatum(n *nodes.PartitionRangeDatum) *ast.PartitionRangeDatum { +func convertPartitionRangeDatum(n *pg.PartitionRangeDatum) *ast.PartitionRangeDatum { if n == nil { return nil } return &ast.PartitionRangeDatum{ Kind: ast.PartitionRangeDatumKind(n.Kind), Value: convertNode(n.Value), - Location: n.Location, + Location: int(n.Location), } } -func convertPartitionSpec(n *nodes.PartitionSpec) *ast.PartitionSpec { +func convertPartitionSpec(n *pg.PartitionSpec) *ast.PartitionSpec { if n == nil { return nil } return &ast.PartitionSpec{ - Strategy: n.Strategy, - PartParams: convertList(n.PartParams), - Location: n.Location, + Strategy: makeString(n.Strategy.String()), + PartParams: convertSlice(n.PartParams), + Location: int(n.Location), } } -func convertPrepareStmt(n *nodes.PrepareStmt) *ast.PrepareStmt { +func convertPrepareStmt(n *pg.PrepareStmt) *ast.PrepareStmt { if n == nil { return nil } return &ast.PrepareStmt{ - Name: n.Name, - Argtypes: convertList(n.Argtypes), + Name: makeString(n.Name), + Argtypes: convertSlice(n.Argtypes), Query: convertNode(n.Query), } } -func convertQuery(n *nodes.Query) *ast.Query { +func convertQuery(n *pg.Query) *ast.Query { if n == nil { return nil } return &ast.Query{ CommandType: ast.CmdType(n.CommandType), QuerySource: ast.QuerySource(n.QuerySource), - QueryId: n.QueryId, CanSetTag: n.CanSetTag, UtilityStmt: convertNode(n.UtilityStmt), - ResultRelation: n.ResultRelation, + ResultRelation: int(n.ResultRelation), HasAggs: n.HasAggs, HasWindowFuncs: n.HasWindowFuncs, HasTargetSrfs: n.HasTargetSrfs, @@ -2137,31 +2155,31 @@ func convertQuery(n *nodes.Query) *ast.Query { HasModifyingCte: n.HasModifyingCte, HasForUpdate: n.HasForUpdate, HasRowSecurity: n.HasRowSecurity, - CteList: convertList(n.CteList), - Rtable: convertList(n.Rtable), + CteList: convertSlice(n.CteList), + Rtable: convertSlice(n.Rtable), Jointree: convertFromExpr(n.Jointree), - TargetList: convertList(n.TargetList), + TargetList: convertSlice(n.TargetList), Override: ast.OverridingKind(n.Override), OnConflict: convertOnConflictExpr(n.OnConflict), - ReturningList: convertList(n.ReturningList), - GroupClause: convertList(n.GroupClause), - GroupingSets: convertList(n.GroupingSets), + ReturningList: convertSlice(n.ReturningList), + GroupClause: convertSlice(n.GroupClause), + GroupingSets: convertSlice(n.GroupingSets), HavingQual: convertNode(n.HavingQual), - WindowClause: convertList(n.WindowClause), - DistinctClause: convertList(n.DistinctClause), - SortClause: convertList(n.SortClause), + WindowClause: convertSlice(n.WindowClause), + DistinctClause: convertSlice(n.DistinctClause), + SortClause: convertSlice(n.SortClause), LimitOffset: convertNode(n.LimitOffset), LimitCount: convertNode(n.LimitCount), - RowMarks: convertList(n.RowMarks), + RowMarks: convertSlice(n.RowMarks), SetOperations: convertNode(n.SetOperations), - ConstraintDeps: convertList(n.ConstraintDeps), - WithCheckOptions: convertList(n.WithCheckOptions), - StmtLocation: n.StmtLocation, - StmtLen: n.StmtLen, + ConstraintDeps: convertSlice(n.ConstraintDeps), + WithCheckOptions: convertSlice(n.WithCheckOptions), + StmtLocation: int(n.StmtLocation), + StmtLen: int(n.StmtLen), } } -func convertRangeFunction(n *nodes.RangeFunction) *ast.RangeFunction { +func convertRangeFunction(n *pg.RangeFunction) *ast.RangeFunction { if n == nil { return nil } @@ -2169,13 +2187,13 @@ func convertRangeFunction(n *nodes.RangeFunction) *ast.RangeFunction { Lateral: n.Lateral, Ordinality: n.Ordinality, IsRowsfrom: n.IsRowsfrom, - Functions: convertList(n.Functions), + Functions: convertSlice(n.Functions), Alias: convertAlias(n.Alias), - Coldeflist: convertList(n.Coldeflist), + Coldeflist: convertSlice(n.Coldeflist), } } -func convertRangeSubselect(n *nodes.RangeSubselect) *ast.RangeSubselect { +func convertRangeSubselect(n *pg.RangeSubselect) *ast.RangeSubselect { if n == nil { return nil } @@ -2186,7 +2204,7 @@ func convertRangeSubselect(n *nodes.RangeSubselect) *ast.RangeSubselect { } } -func convertRangeTableFunc(n *nodes.RangeTableFunc) *ast.RangeTableFunc { +func convertRangeTableFunc(n *pg.RangeTableFunc) *ast.RangeTableFunc { if n == nil { return nil } @@ -2194,141 +2212,136 @@ func convertRangeTableFunc(n *nodes.RangeTableFunc) *ast.RangeTableFunc { Lateral: n.Lateral, Docexpr: convertNode(n.Docexpr), Rowexpr: convertNode(n.Rowexpr), - Namespaces: convertList(n.Namespaces), - Columns: convertList(n.Columns), + Namespaces: convertSlice(n.Namespaces), + Columns: convertSlice(n.Columns), Alias: convertAlias(n.Alias), - Location: n.Location, + Location: int(n.Location), } } -func convertRangeTableFuncCol(n *nodes.RangeTableFuncCol) *ast.RangeTableFuncCol { +func convertRangeTableFuncCol(n *pg.RangeTableFuncCol) *ast.RangeTableFuncCol { if n == nil { return nil } return &ast.RangeTableFuncCol{ - Colname: n.Colname, + Colname: makeString(n.Colname), TypeName: convertTypeName(n.TypeName), ForOrdinality: n.ForOrdinality, IsNotNull: n.IsNotNull, Colexpr: convertNode(n.Colexpr), Coldefexpr: convertNode(n.Coldefexpr), - Location: n.Location, + Location: int(n.Location), } } -func convertRangeTableSample(n *nodes.RangeTableSample) *ast.RangeTableSample { +func convertRangeTableSample(n *pg.RangeTableSample) *ast.RangeTableSample { if n == nil { return nil } return &ast.RangeTableSample{ Relation: convertNode(n.Relation), - Method: convertList(n.Method), - Args: convertList(n.Args), + Method: convertSlice(n.Method), + Args: convertSlice(n.Args), Repeatable: convertNode(n.Repeatable), - Location: n.Location, + Location: int(n.Location), } } -func convertRangeTblEntry(n *nodes.RangeTblEntry) *ast.RangeTblEntry { +func convertRangeTblEntry(n *pg.RangeTblEntry) *ast.RangeTblEntry { if n == nil { return nil } return &ast.RangeTblEntry{ Rtekind: ast.RTEKind(n.Rtekind), Relid: ast.Oid(n.Relid), - Relkind: n.Relkind, + Relkind: makeByte(n.Relkind), Tablesample: convertTableSampleClause(n.Tablesample), Subquery: convertQuery(n.Subquery), SecurityBarrier: n.SecurityBarrier, Jointype: ast.JoinType(n.Jointype), - Joinaliasvars: convertList(n.Joinaliasvars), - Functions: convertList(n.Functions), + Joinaliasvars: convertSlice(n.Joinaliasvars), + Functions: convertSlice(n.Functions), Funcordinality: n.Funcordinality, Tablefunc: convertTableFunc(n.Tablefunc), - ValuesLists: convertList(n.ValuesLists), - Ctename: n.Ctename, + ValuesLists: convertSlice(n.ValuesLists), + Ctename: makeString(n.Ctename), Ctelevelsup: ast.Index(n.Ctelevelsup), SelfReference: n.SelfReference, - Coltypes: convertList(n.Coltypes), - Coltypmods: convertList(n.Coltypmods), - Colcollations: convertList(n.Colcollations), - Enrname: n.Enrname, + Coltypes: convertSlice(n.Coltypes), + Coltypmods: convertSlice(n.Coltypmods), + Colcollations: convertSlice(n.Colcollations), + Enrname: makeString(n.Enrname), Enrtuples: n.Enrtuples, Alias: convertAlias(n.Alias), Eref: convertAlias(n.Eref), Lateral: n.Lateral, Inh: n.Inh, InFromCl: n.InFromCl, - RequiredPerms: ast.AclMode(n.RequiredPerms), - CheckAsUser: ast.Oid(n.CheckAsUser), - SelectedCols: n.SelectedCols, - InsertedCols: n.InsertedCols, - UpdatedCols: n.UpdatedCols, - SecurityQuals: convertList(n.SecurityQuals), + SecurityQuals: convertSlice(n.SecurityQuals), } } -func convertRangeTblFunction(n *nodes.RangeTblFunction) *ast.RangeTblFunction { +func convertRangeTblFunction(n *pg.RangeTblFunction) *ast.RangeTblFunction { if n == nil { return nil } return &ast.RangeTblFunction{ Funcexpr: convertNode(n.Funcexpr), - Funccolcount: n.Funccolcount, - Funccolnames: convertList(n.Funccolnames), - Funccoltypes: convertList(n.Funccoltypes), - Funccoltypmods: convertList(n.Funccoltypmods), - Funccolcollations: convertList(n.Funccolcollations), - Funcparams: n.Funcparams, + Funccolcount: int(n.Funccolcount), + Funccolnames: convertSlice(n.Funccolnames), + Funccoltypes: convertSlice(n.Funccoltypes), + Funccoltypmods: convertSlice(n.Funccoltypmods), + Funccolcollations: convertSlice(n.Funccolcollations), + Funcparams: makeUint32Slice(n.Funcparams), } } -func convertRangeTblRef(n *nodes.RangeTblRef) *ast.RangeTblRef { +func convertRangeTblRef(n *pg.RangeTblRef) *ast.RangeTblRef { if n == nil { return nil } return &ast.RangeTblRef{ - Rtindex: n.Rtindex, + Rtindex: int(n.Rtindex), } } -func convertRangeVar(n *nodes.RangeVar) *ast.RangeVar { +func convertRangeVar(n *pg.RangeVar) *ast.RangeVar { if n == nil { return nil } return &ast.RangeVar{ - Catalogname: n.Catalogname, - Schemaname: n.Schemaname, - Relname: n.Relname, + Catalogname: makeString(n.Catalogname), + Schemaname: makeString(n.Schemaname), + Relname: makeString(n.Relname), Inh: n.Inh, - Relpersistence: n.Relpersistence, + Relpersistence: makeByte(n.Relpersistence), Alias: convertAlias(n.Alias), - Location: n.Location, + Location: int(n.Location), } } -func convertRawStmt(n *nodes.RawStmt) *ast.RawStmt { +func convertRawStmt(n *pg.RawStmt) *ast.RawStmt { if n == nil { return nil } return &ast.RawStmt{ Stmt: convertNode(n.Stmt), - StmtLocation: n.StmtLocation, - StmtLen: n.StmtLen, + StmtLocation: int(n.StmtLocation), + StmtLen: int(n.StmtLen), } } -func convertReassignOwnedStmt(n *nodes.ReassignOwnedStmt) *ast.ReassignOwnedStmt { +func convertReassignOwnedStmt(n *pg.ReassignOwnedStmt) *ast.ReassignOwnedStmt { if n == nil { return nil } return &ast.ReassignOwnedStmt{ - Roles: convertList(n.Roles), + Roles: convertSlice(n.Roles), Newrole: convertRoleSpec(n.Newrole), } } -func convertRefreshMatViewStmt(n *nodes.RefreshMatViewStmt) *ast.RefreshMatViewStmt { +func convertRefreshMatViewStmt(n *pg.RefreshMatViewStmt) *ast.RefreshMatViewStmt { if n == nil { return nil } @@ -2339,19 +2352,19 @@ func convertRefreshMatViewStmt(n *nodes.RefreshMatViewStmt) *ast.RefreshMatViewS } } -func convertReindexStmt(n *nodes.ReindexStmt) *ast.ReindexStmt { +func convertReindexStmt(n *pg.ReindexStmt) *ast.ReindexStmt { if n == nil { return nil } return &ast.ReindexStmt{ Kind: ast.ReindexObjectType(n.Kind), Relation: convertRangeVar(n.Relation), - Name: n.Name, - Options: n.Options, + Name: makeString(n.Name), + // Options: int(n.Options), TODO: Support params } } -func convertRelabelType(n *nodes.RelabelType) *ast.RelabelType { +func convertRelabelType(n *pg.RelabelType) *ast.RelabelType { if n == nil { return nil } @@ -2362,11 +2375,11 @@ func convertRelabelType(n *nodes.RelabelType) *ast.RelabelType { Resulttypmod: n.Resulttypmod, Resultcollid: ast.Oid(n.Resultcollid), Relabelformat: ast.CoercionForm(n.Relabelformat), - Location: n.Location, + Location: int(n.Location), } } -func convertRenameStmt(n *nodes.RenameStmt) *ast.RenameStmt { +func convertRenameStmt(n *pg.RenameStmt) *ast.RenameStmt { if n == nil { return nil } @@ -2375,76 +2388,76 @@ func convertRenameStmt(n *nodes.RenameStmt) *ast.RenameStmt { RelationType: ast.ObjectType(n.RelationType), Relation: convertRangeVar(n.Relation), Object: convertNode(n.Object), - Subname: n.Subname, - Newname: n.Newname, + Subname: makeString(n.Subname), + Newname: makeString(n.Newname), Behavior: ast.DropBehavior(n.Behavior), MissingOk: n.MissingOk, } } -func convertReplicaIdentityStmt(n *nodes.ReplicaIdentityStmt) *ast.ReplicaIdentityStmt { +func convertReplicaIdentityStmt(n *pg.ReplicaIdentityStmt) *ast.ReplicaIdentityStmt { if n == nil { return nil } return &ast.ReplicaIdentityStmt{ - IdentityType: n.IdentityType, - Name: n.Name, + IdentityType: makeByte(n.IdentityType), + Name: makeString(n.Name), } } -func convertResTarget(n *nodes.ResTarget) *ast.ResTarget { +func convertResTarget(n *pg.ResTarget) *ast.ResTarget { if n == nil { return nil } return &ast.ResTarget{ - Name: n.Name, - Indirection: convertList(n.Indirection), + Name: makeString(n.Name), + Indirection: convertSlice(n.Indirection), Val: convertNode(n.Val), - Location: n.Location, + Location: int(n.Location), } } -func convertRoleSpec(n *nodes.RoleSpec) *ast.RoleSpec { +func convertRoleSpec(n *pg.RoleSpec) *ast.RoleSpec { if n == nil { return nil } return &ast.RoleSpec{ Roletype: ast.RoleSpecType(n.Roletype), - Rolename: n.Rolename, - Location: n.Location, + Rolename: makeString(n.Rolename), + Location: int(n.Location), } } -func convertRowCompareExpr(n *nodes.RowCompareExpr) *ast.RowCompareExpr { +func convertRowCompareExpr(n *pg.RowCompareExpr) *ast.RowCompareExpr { if n == nil { return nil } return &ast.RowCompareExpr{ Xpr: convertNode(n.Xpr), Rctype: ast.RowCompareType(n.Rctype), - Opnos: convertList(n.Opnos), - Opfamilies: convertList(n.Opfamilies), - Inputcollids: convertList(n.Inputcollids), - Largs: convertList(n.Largs), - Rargs: convertList(n.Rargs), + Opnos: convertSlice(n.Opnos), + Opfamilies: convertSlice(n.Opfamilies), + Inputcollids: convertSlice(n.Inputcollids), + Largs: convertSlice(n.Largs), + Rargs: convertSlice(n.Rargs), } } -func convertRowExpr(n *nodes.RowExpr) *ast.RowExpr { +func convertRowExpr(n *pg.RowExpr) *ast.RowExpr { if n == nil { return nil } return &ast.RowExpr{ Xpr: convertNode(n.Xpr), - Args: convertList(n.Args), + Args: convertSlice(n.Args), RowTypeid: ast.Oid(n.RowTypeid), RowFormat: ast.CoercionForm(n.RowFormat), - Colnames: convertList(n.Colnames), - Location: n.Location, + Colnames: convertSlice(n.Colnames), + Location: int(n.Location), } } -func convertRowMarkClause(n *nodes.RowMarkClause) *ast.RowMarkClause { +func convertRowMarkClause(n *pg.RowMarkClause) *ast.RowMarkClause { if n == nil { return nil } @@ -2456,22 +2469,22 @@ func convertRowMarkClause(n *nodes.RowMarkClause) *ast.RowMarkClause { } } -func convertRuleStmt(n *nodes.RuleStmt) *ast.RuleStmt { +func convertRuleStmt(n *pg.RuleStmt) *ast.RuleStmt { if n == nil { return nil } return &ast.RuleStmt{ Relation: convertRangeVar(n.Relation), - Rulename: n.Rulename, + Rulename: makeString(n.Rulename), WhereClause: convertNode(n.WhereClause), Event: ast.CmdType(n.Event), Instead: n.Instead, - Actions: convertList(n.Actions), + Actions: convertSlice(n.Actions), Replace: n.Replace, } } -func convertSQLValueFunction(n *nodes.SQLValueFunction) *ast.SQLValueFunction { +func convertSQLValueFunction(n *pg.SQLValueFunction) *ast.SQLValueFunction { if n == nil { return nil } @@ -2480,80 +2493,87 @@ func convertSQLValueFunction(n *nodes.SQLValueFunction) *ast.SQLValueFunction { Op: ast.SQLValueFunctionOp(n.Op), Type: ast.Oid(n.Type), Typmod: n.Typmod, - Location: n.Location, + Location: int(n.Location), } } -func convertScalarArrayOpExpr(n *nodes.ScalarArrayOpExpr) *ast.ScalarArrayOpExpr { +func convertScalarArrayOpExpr(n *pg.ScalarArrayOpExpr) *ast.ScalarArrayOpExpr { if n == nil { return nil } 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: convertList(n.Args), - Location: n.Location, + Args: convertSlice(n.Args), + Location: int(n.Location), } } -func convertSecLabelStmt(n *nodes.SecLabelStmt) *ast.SecLabelStmt { +func convertSecLabelStmt(n *pg.SecLabelStmt) *ast.SecLabelStmt { if n == nil { return nil } return &ast.SecLabelStmt{ Objtype: ast.ObjectType(n.Objtype), Object: convertNode(n.Object), - Provider: n.Provider, - Label: n.Label, + Provider: makeString(n.Provider), + Label: makeString(n.Label), } } -func convertSelectStmt(n *nodes.SelectStmt) *ast.SelectStmt { +func convertSelectStmt(n *pg.SelectStmt) *ast.SelectStmt { if n == nil { return nil } + op, err := convertSetOperation(n.Op) + if err != nil { + panic(err) + } return &ast.SelectStmt{ - DistinctClause: convertList(n.DistinctClause), + DistinctClause: convertSlice(n.DistinctClause), IntoClause: convertIntoClause(n.IntoClause), - TargetList: convertList(n.TargetList), - FromClause: convertList(n.FromClause), + TargetList: convertSlice(n.TargetList), + FromClause: convertSlice(n.FromClause), WhereClause: convertNode(n.WhereClause), - GroupClause: convertList(n.GroupClause), + GroupClause: convertSlice(n.GroupClause), HavingClause: convertNode(n.HavingClause), - WindowClause: convertList(n.WindowClause), - ValuesLists: convertValuesList(n.ValuesLists), - SortClause: convertList(n.SortClause), + WindowClause: convertSlice(n.WindowClause), + ValuesLists: convertSlice(n.ValuesLists), + SortClause: convertSlice(n.SortClause), LimitOffset: convertNode(n.LimitOffset), LimitCount: convertNode(n.LimitCount), - LockingClause: convertList(n.LockingClause), + LockingClause: convertSlice(n.LockingClause), WithClause: convertWithClause(n.WithClause), - Op: ast.SetOperation(n.Op), + Op: op, All: n.All, Larg: convertSelectStmt(n.Larg), Rarg: convertSelectStmt(n.Rarg), } } -func convertSetOperationStmt(n *nodes.SetOperationStmt) *ast.SetOperationStmt { +func convertSetOperationStmt(n *pg.SetOperationStmt) *ast.SetOperationStmt { if n == nil { return nil } + op, err := convertSetOperation(n.Op) + if err != nil { + panic(err) + } return &ast.SetOperationStmt{ - Op: ast.SetOperation(n.Op), + Op: op, All: n.All, Larg: convertNode(n.Larg), Rarg: convertNode(n.Rarg), - ColTypes: convertList(n.ColTypes), - ColTypmods: convertList(n.ColTypmods), - ColCollations: convertList(n.ColCollations), - GroupClauses: convertList(n.GroupClauses), + ColTypes: convertSlice(n.ColTypes), + ColTypmods: convertSlice(n.ColTypmods), + ColCollations: convertSlice(n.ColCollations), + GroupClauses: convertSlice(n.GroupClauses), } } -func convertSetToDefault(n *nodes.SetToDefault) *ast.SetToDefault { +func convertSetToDefault(n *pg.SetToDefault) *ast.SetToDefault { if n == nil { return nil } @@ -2562,11 +2582,11 @@ func convertSetToDefault(n *nodes.SetToDefault) *ast.SetToDefault { TypeId: ast.Oid(n.TypeId), TypeMod: n.TypeMod, Collation: ast.Oid(n.Collation), - Location: n.Location, + Location: int(n.Location), } } -func convertSortBy(n *nodes.SortBy) *ast.SortBy { +func convertSortBy(n *pg.SortBy) *ast.SortBy { if n == nil { return nil } @@ -2574,12 +2594,12 @@ func convertSortBy(n *nodes.SortBy) *ast.SortBy { Node: convertNode(n.Node), SortbyDir: ast.SortByDir(n.SortbyDir), SortbyNulls: ast.SortByNulls(n.SortbyNulls), - UseOp: convertList(n.UseOp), - Location: n.Location, + UseOp: convertSlice(n.UseOp), + Location: int(n.Location), } } -func convertSortGroupClause(n *nodes.SortGroupClause) *ast.SortGroupClause { +func convertSortGroupClause(n *pg.SortGroupClause) *ast.SortGroupClause { if n == nil { return nil } @@ -2592,77 +2612,85 @@ func convertSortGroupClause(n *nodes.SortGroupClause) *ast.SortGroupClause { } } -func convertString(n *nodes.String) *ast.String { +func convertString(n *pg.String) *ast.String { if n == nil { return nil } return &ast.String{ - Str: n.Str, + Str: n.Sval, } } -func convertSubLink(n *nodes.SubLink) *ast.SubLink { +func convertSubLink(n *pg.SubLink) *ast.SubLink { if n == nil { return nil } + slt, err := convertSubLinkType(n.SubLinkType) + if err != nil { + panic(err) + } return &ast.SubLink{ Xpr: convertNode(n.Xpr), - SubLinkType: ast.SubLinkType(n.SubLinkType), - SubLinkId: n.SubLinkId, + SubLinkType: slt, + SubLinkId: int(n.SubLinkId), Testexpr: convertNode(n.Testexpr), - OperName: convertList(n.OperName), + OperName: convertSlice(n.OperName), Subselect: convertNode(n.Subselect), - Location: n.Location, + Location: int(n.Location), } } -func convertSubPlan(n *nodes.SubPlan) *ast.SubPlan { +func convertSubPlan(n *pg.SubPlan) *ast.SubPlan { if n == nil { return nil } + slt, err := convertSubLinkType(n.SubLinkType) + if err != nil { + panic(err) + } return &ast.SubPlan{ Xpr: convertNode(n.Xpr), - SubLinkType: ast.SubLinkType(n.SubLinkType), + SubLinkType: slt, Testexpr: convertNode(n.Testexpr), - ParamIds: convertList(n.ParamIds), - PlanId: n.PlanId, - PlanName: n.PlanName, + ParamIds: convertSlice(n.ParamIds), + PlanId: int(n.PlanId), + PlanName: makeString(n.PlanName), FirstColType: ast.Oid(n.FirstColType), FirstColTypmod: n.FirstColTypmod, FirstColCollation: ast.Oid(n.FirstColCollation), UseHashTable: n.UseHashTable, UnknownEqFalse: n.UnknownEqFalse, ParallelSafe: n.ParallelSafe, - SetParam: convertList(n.SetParam), - ParParam: convertList(n.ParParam), - Args: convertList(n.Args), + SetParam: convertSlice(n.SetParam), + ParParam: convertSlice(n.ParParam), + Args: convertSlice(n.Args), StartupCost: ast.Cost(n.StartupCost), PerCallCost: ast.Cost(n.PerCallCost), } } -func convertTableFunc(n *nodes.TableFunc) *ast.TableFunc { +func convertTableFunc(n *pg.TableFunc) *ast.TableFunc { if n == nil { return nil } return &ast.TableFunc{ - NsUris: convertList(n.NsUris), - NsNames: convertList(n.NsNames), + NsUris: convertSlice(n.NsUris), + NsNames: convertSlice(n.NsNames), Docexpr: convertNode(n.Docexpr), Rowexpr: convertNode(n.Rowexpr), - Colnames: convertList(n.Colnames), - Coltypes: convertList(n.Coltypes), - Coltypmods: convertList(n.Coltypmods), - Colcollations: convertList(n.Colcollations), - Colexprs: convertList(n.Colexprs), - Coldefexprs: convertList(n.Coldefexprs), - Notnulls: n.Notnulls, - Ordinalitycol: n.Ordinalitycol, - Location: n.Location, + Colnames: convertSlice(n.Colnames), + Coltypes: convertSlice(n.Coltypes), + Coltypmods: convertSlice(n.Coltypmods), + Colcollations: convertSlice(n.Colcollations), + Colexprs: convertSlice(n.Colexprs), + Coldefexprs: convertSlice(n.Coldefexprs), + Notnulls: makeUint32Slice(n.Notnulls), + Ordinalitycol: int(n.Ordinalitycol), + Location: int(n.Location), } } -func convertTableLikeClause(n *nodes.TableLikeClause) *ast.TableLikeClause { +func convertTableLikeClause(n *pg.TableLikeClause) *ast.TableLikeClause { if n == nil { return nil } @@ -2672,18 +2700,18 @@ func convertTableLikeClause(n *nodes.TableLikeClause) *ast.TableLikeClause { } } -func convertTableSampleClause(n *nodes.TableSampleClause) *ast.TableSampleClause { +func convertTableSampleClause(n *pg.TableSampleClause) *ast.TableSampleClause { if n == nil { return nil } return &ast.TableSampleClause{ Tsmhandler: ast.Oid(n.Tsmhandler), - Args: convertList(n.Args), + Args: convertSlice(n.Args), Repeatable: convertNode(n.Repeatable), } } -func convertTargetEntry(n *nodes.TargetEntry) *ast.TargetEntry { +func convertTargetEntry(n *pg.TargetEntry) *ast.TargetEntry { if n == nil { return nil } @@ -2691,7 +2719,7 @@ func convertTargetEntry(n *nodes.TargetEntry) *ast.TargetEntry { Xpr: convertNode(n.Xpr), Expr: convertNode(n.Expr), Resno: ast.AttrNumber(n.Resno), - Resname: n.Resname, + Resname: makeString(n.Resname), Ressortgroupref: ast.Index(n.Ressortgroupref), Resorigtbl: ast.Oid(n.Resorigtbl), Resorigcol: ast.AttrNumber(n.Resorigcol), @@ -2699,101 +2727,105 @@ func convertTargetEntry(n *nodes.TargetEntry) *ast.TargetEntry { } } -func convertTransactionStmt(n *nodes.TransactionStmt) *ast.TransactionStmt { +func convertTransactionStmt(n *pg.TransactionStmt) *ast.TransactionStmt { if n == nil { return nil } return &ast.TransactionStmt{ Kind: ast.TransactionStmtKind(n.Kind), - Options: convertList(n.Options), - Gid: n.Gid, + Options: convertSlice(n.Options), + Gid: makeString(n.Gid), } } -func convertTriggerTransition(n *nodes.TriggerTransition) *ast.TriggerTransition { +func convertTriggerTransition(n *pg.TriggerTransition) *ast.TriggerTransition { if n == nil { return nil } return &ast.TriggerTransition{ - Name: n.Name, + Name: makeString(n.Name), IsNew: n.IsNew, IsTable: n.IsTable, } } -func convertTruncateStmt(n *nodes.TruncateStmt) *ast.TruncateStmt { +func convertTruncateStmt(n *pg.TruncateStmt) *ast.TruncateStmt { if n == nil { return nil } return &ast.TruncateStmt{ - Relations: convertList(n.Relations), + Relations: convertSlice(n.Relations), RestartSeqs: n.RestartSeqs, Behavior: ast.DropBehavior(n.Behavior), } } -func convertTypeCast(n *nodes.TypeCast) *ast.TypeCast { +func convertTypeCast(n *pg.TypeCast) *ast.TypeCast { if n == nil { return nil } return &ast.TypeCast{ Arg: convertNode(n.Arg), TypeName: convertTypeName(n.TypeName), - Location: n.Location, + Location: int(n.Location), } } -func convertTypeName(n *nodes.TypeName) *ast.TypeName { +func convertTypeName(n *pg.TypeName) *ast.TypeName { if n == nil { return nil } return &ast.TypeName{ - Names: convertList(n.Names), + Names: convertSlice(n.Names), TypeOid: ast.Oid(n.TypeOid), Setof: n.Setof, PctType: n.PctType, - Typmods: convertList(n.Typmods), + Typmods: convertSlice(n.Typmods), Typemod: n.Typemod, - ArrayBounds: convertList(n.ArrayBounds), - Location: n.Location, + ArrayBounds: convertSlice(n.ArrayBounds), + Location: int(n.Location), } } -func convertUnlistenStmt(n *nodes.UnlistenStmt) *ast.UnlistenStmt { +func convertUnlistenStmt(n *pg.UnlistenStmt) *ast.UnlistenStmt { if n == nil { return nil } return &ast.UnlistenStmt{ - Conditionname: n.Conditionname, + Conditionname: makeString(n.Conditionname), } } -func convertUpdateStmt(n *nodes.UpdateStmt) *ast.UpdateStmt { +func convertUpdateStmt(n *pg.UpdateStmt) *ast.UpdateStmt { if n == nil { return nil } + return &ast.UpdateStmt{ - Relation: convertRangeVar(n.Relation), - TargetList: convertList(n.TargetList), + Relations: &ast.List{ + Items: []ast.Node{convertRangeVar(n.Relation)}, + }, + TargetList: convertSlice(n.TargetList), WhereClause: convertNode(n.WhereClause), - FromClause: convertList(n.FromClause), - ReturningList: convertList(n.ReturningList), + FromClause: convertSlice(n.FromClause), + ReturningList: convertSlice(n.ReturningList), WithClause: convertWithClause(n.WithClause), } } -func convertVacuumStmt(n *nodes.VacuumStmt) *ast.VacuumStmt { +func convertVacuumStmt(n *pg.VacuumStmt) *ast.VacuumStmt { if n == nil { return nil } return &ast.VacuumStmt{ - Options: n.Options, - Relation: convertRangeVar(n.Relation), - VaCols: convertList(n.VaCols), + // FIXME: The VacuumStmt node has changed quite a bit + // Options: n.Options + // Relation: convertRangeVar(n.Relation), + // VaCols: convertSlice(n.VaCols), } } -func convertVar(n *nodes.Var) *ast.Var { +func convertVar(n *pg.Var) *ast.Var { if n == nil { return nil } @@ -2805,57 +2837,55 @@ func convertVar(n *nodes.Var) *ast.Var { Vartypmod: n.Vartypmod, Varcollid: ast.Oid(n.Varcollid), Varlevelsup: ast.Index(n.Varlevelsup), - Varnoold: ast.Index(n.Varnoold), - Varoattno: ast.AttrNumber(n.Varoattno), - Location: n.Location, + Location: int(n.Location), } } -func convertVariableSetStmt(n *nodes.VariableSetStmt) *ast.VariableSetStmt { +func convertVariableSetStmt(n *pg.VariableSetStmt) *ast.VariableSetStmt { if n == nil { return nil } return &ast.VariableSetStmt{ Kind: ast.VariableSetKind(n.Kind), - Name: n.Name, - Args: convertList(n.Args), + Name: makeString(n.Name), + Args: convertSlice(n.Args), IsLocal: n.IsLocal, } } -func convertVariableShowStmt(n *nodes.VariableShowStmt) *ast.VariableShowStmt { +func convertVariableShowStmt(n *pg.VariableShowStmt) *ast.VariableShowStmt { if n == nil { return nil } return &ast.VariableShowStmt{ - Name: n.Name, + Name: makeString(n.Name), } } -func convertViewStmt(n *nodes.ViewStmt) *ast.ViewStmt { +func convertViewStmt(n *pg.ViewStmt) *ast.ViewStmt { if n == nil { return nil } return &ast.ViewStmt{ View: convertRangeVar(n.View), - Aliases: convertList(n.Aliases), + Aliases: convertSlice(n.Aliases), Query: convertNode(n.Query), Replace: n.Replace, - Options: convertList(n.Options), + Options: convertSlice(n.Options), WithCheckOption: ast.ViewCheckOption(n.WithCheckOption), } } -func convertWindowClause(n *nodes.WindowClause) *ast.WindowClause { +func convertWindowClause(n *pg.WindowClause) *ast.WindowClause { if n == nil { return nil } return &ast.WindowClause{ - Name: n.Name, - Refname: n.Refname, - PartitionClause: convertList(n.PartitionClause), - OrderClause: convertList(n.OrderClause), - FrameOptions: n.FrameOptions, + Name: makeString(n.Name), + Refname: makeString(n.Refname), + PartitionClause: convertSlice(n.PartitionClause), + OrderClause: convertSlice(n.OrderClause), + FrameOptions: int(n.FrameOptions), StartOffset: convertNode(n.StartOffset), EndOffset: convertNode(n.EndOffset), Winref: ast.Index(n.Winref), @@ -2863,23 +2893,23 @@ func convertWindowClause(n *nodes.WindowClause) *ast.WindowClause { } } -func convertWindowDef(n *nodes.WindowDef) *ast.WindowDef { +func convertWindowDef(n *pg.WindowDef) *ast.WindowDef { if n == nil { return nil } return &ast.WindowDef{ - Name: n.Name, - Refname: n.Refname, - PartitionClause: convertList(n.PartitionClause), - OrderClause: convertList(n.OrderClause), - FrameOptions: n.FrameOptions, + Name: makeString(n.Name), + Refname: makeString(n.Refname), + PartitionClause: convertSlice(n.PartitionClause), + OrderClause: convertSlice(n.OrderClause), + FrameOptions: int(n.FrameOptions), StartOffset: convertNode(n.StartOffset), EndOffset: convertNode(n.EndOffset), - Location: n.Location, + Location: int(n.Location), } } -func convertWindowFunc(n *nodes.WindowFunc) *ast.WindowFunc { +func convertWindowFunc(n *pg.WindowFunc) *ast.WindowFunc { if n == nil { return nil } @@ -2889,58 +2919,58 @@ func convertWindowFunc(n *nodes.WindowFunc) *ast.WindowFunc { Wintype: ast.Oid(n.Wintype), Wincollid: ast.Oid(n.Wincollid), Inputcollid: ast.Oid(n.Inputcollid), - Args: convertList(n.Args), + Args: convertSlice(n.Args), Aggfilter: convertNode(n.Aggfilter), Winref: ast.Index(n.Winref), Winstar: n.Winstar, Winagg: n.Winagg, - Location: n.Location, + Location: int(n.Location), } } -func convertWithCheckOption(n *nodes.WithCheckOption) *ast.WithCheckOption { +func convertWithCheckOption(n *pg.WithCheckOption) *ast.WithCheckOption { if n == nil { return nil } return &ast.WithCheckOption{ Kind: ast.WCOKind(n.Kind), - Relname: n.Relname, - Polname: n.Polname, + Relname: makeString(n.Relname), + Polname: makeString(n.Polname), Qual: convertNode(n.Qual), Cascaded: n.Cascaded, } } -func convertWithClause(n *nodes.WithClause) *ast.WithClause { +func convertWithClause(n *pg.WithClause) *ast.WithClause { if n == nil { return nil } return &ast.WithClause{ - Ctes: convertList(n.Ctes), + Ctes: convertSlice(n.Ctes), Recursive: n.Recursive, - Location: n.Location, + Location: int(n.Location), } } -func convertXmlExpr(n *nodes.XmlExpr) *ast.XmlExpr { +func convertXmlExpr(n *pg.XmlExpr) *ast.XmlExpr { if n == nil { return nil } return &ast.XmlExpr{ Xpr: convertNode(n.Xpr), Op: ast.XmlExprOp(n.Op), - Name: n.Name, - NamedArgs: convertList(n.NamedArgs), - ArgNames: convertList(n.ArgNames), - Args: convertList(n.Args), + Name: makeString(n.Name), + NamedArgs: convertSlice(n.NamedArgs), + ArgNames: convertSlice(n.ArgNames), + Args: convertSlice(n.Args), Xmloption: ast.XmlOptionType(n.Xmloption), Type: ast.Oid(n.Type), Typmod: n.Typmod, - Location: n.Location, + Location: int(n.Location), } } -func convertXmlSerialize(n *nodes.XmlSerialize) *ast.XmlSerialize { +func convertXmlSerialize(n *pg.XmlSerialize) *ast.XmlSerialize { if n == nil { return nil } @@ -2948,684 +2978,673 @@ func convertXmlSerialize(n *nodes.XmlSerialize) *ast.XmlSerialize { Xmloption: ast.XmlOptionType(n.Xmloption), Expr: convertNode(n.Expr), TypeName: convertTypeName(n.TypeName), - Location: n.Location, + Location: int(n.Location), } } -func convertNode(node nodes.Node) ast.Node { - switch n := node.(type) { - - case nodes.A_ArrayExpr: - return convertA_ArrayExpr(&n) - - case nodes.A_Const: - return convertA_Const(&n) - - case nodes.A_Expr: - return convertA_Expr(&n) - - case nodes.A_Indices: - return convertA_Indices(&n) +func convertNode(node *pg.Node) ast.Node { + if node == nil || node.Node == nil { + return &ast.TODO{} + } - case nodes.A_Indirection: - return convertA_Indirection(&n) + switch n := node.Node.(type) { - case nodes.A_Star: - return convertA_Star(&n) + case *pg.Node_AArrayExpr: + return convertA_ArrayExpr(n.AArrayExpr) - case nodes.AccessPriv: - return convertAccessPriv(&n) + case *pg.Node_AConst: + return convertA_Const(n.AConst) - case nodes.Aggref: - return convertAggref(&n) + case *pg.Node_AExpr: + return convertA_Expr(n.AExpr) - case nodes.Alias: - return convertAlias(&n) + case *pg.Node_AIndices: + return convertA_Indices(n.AIndices) - case nodes.AlterCollationStmt: - return convertAlterCollationStmt(&n) + case *pg.Node_AIndirection: + return convertA_Indirection(n.AIndirection) - case nodes.AlterDatabaseSetStmt: - return convertAlterDatabaseSetStmt(&n) + case *pg.Node_AStar: + return convertA_Star(n.AStar) - case nodes.AlterDatabaseStmt: - return convertAlterDatabaseStmt(&n) + case *pg.Node_AccessPriv: + return convertAccessPriv(n.AccessPriv) - case nodes.AlterDefaultPrivilegesStmt: - return convertAlterDefaultPrivilegesStmt(&n) + case *pg.Node_Aggref: + return convertAggref(n.Aggref) - case nodes.AlterDomainStmt: - return convertAlterDomainStmt(&n) + case *pg.Node_Alias: + return convertAlias(n.Alias) - case nodes.AlterEnumStmt: - return convertAlterEnumStmt(&n) + case *pg.Node_AlterCollationStmt: + return convertAlterCollationStmt(n.AlterCollationStmt) - case nodes.AlterEventTrigStmt: - return convertAlterEventTrigStmt(&n) + case *pg.Node_AlterDatabaseSetStmt: + return convertAlterDatabaseSetStmt(n.AlterDatabaseSetStmt) - case nodes.AlterExtensionContentsStmt: - return convertAlterExtensionContentsStmt(&n) + case *pg.Node_AlterDatabaseStmt: + return convertAlterDatabaseStmt(n.AlterDatabaseStmt) - case nodes.AlterExtensionStmt: - return convertAlterExtensionStmt(&n) + case *pg.Node_AlterDefaultPrivilegesStmt: + return convertAlterDefaultPrivilegesStmt(n.AlterDefaultPrivilegesStmt) - case nodes.AlterFdwStmt: - return convertAlterFdwStmt(&n) + case *pg.Node_AlterDomainStmt: + return convertAlterDomainStmt(n.AlterDomainStmt) - case nodes.AlterForeignServerStmt: - return convertAlterForeignServerStmt(&n) + case *pg.Node_AlterEnumStmt: + return convertAlterEnumStmt(n.AlterEnumStmt) - case nodes.AlterFunctionStmt: - return convertAlterFunctionStmt(&n) + case *pg.Node_AlterEventTrigStmt: + return convertAlterEventTrigStmt(n.AlterEventTrigStmt) - case nodes.AlterObjectDependsStmt: - return convertAlterObjectDependsStmt(&n) + case *pg.Node_AlterExtensionContentsStmt: + return convertAlterExtensionContentsStmt(n.AlterExtensionContentsStmt) - case nodes.AlterObjectSchemaStmt: - return convertAlterObjectSchemaStmt(&n) + case *pg.Node_AlterExtensionStmt: + return convertAlterExtensionStmt(n.AlterExtensionStmt) - case nodes.AlterOpFamilyStmt: - return convertAlterOpFamilyStmt(&n) + case *pg.Node_AlterFdwStmt: + return convertAlterFdwStmt(n.AlterFdwStmt) - case nodes.AlterOperatorStmt: - return convertAlterOperatorStmt(&n) + case *pg.Node_AlterForeignServerStmt: + return convertAlterForeignServerStmt(n.AlterForeignServerStmt) - case nodes.AlterOwnerStmt: - return convertAlterOwnerStmt(&n) + case *pg.Node_AlterFunctionStmt: + return convertAlterFunctionStmt(n.AlterFunctionStmt) - case nodes.AlterPolicyStmt: - return convertAlterPolicyStmt(&n) + case *pg.Node_AlterObjectDependsStmt: + return convertAlterObjectDependsStmt(n.AlterObjectDependsStmt) - case nodes.AlterPublicationStmt: - return convertAlterPublicationStmt(&n) + case *pg.Node_AlterObjectSchemaStmt: + return convertAlterObjectSchemaStmt(n.AlterObjectSchemaStmt) - case nodes.AlterRoleSetStmt: - return convertAlterRoleSetStmt(&n) + case *pg.Node_AlterOpFamilyStmt: + return convertAlterOpFamilyStmt(n.AlterOpFamilyStmt) - case nodes.AlterRoleStmt: - return convertAlterRoleStmt(&n) + case *pg.Node_AlterOperatorStmt: + return convertAlterOperatorStmt(n.AlterOperatorStmt) - case nodes.AlterSeqStmt: - return convertAlterSeqStmt(&n) + case *pg.Node_AlterOwnerStmt: + return convertAlterOwnerStmt(n.AlterOwnerStmt) - case nodes.AlterSubscriptionStmt: - return convertAlterSubscriptionStmt(&n) + case *pg.Node_AlterPolicyStmt: + return convertAlterPolicyStmt(n.AlterPolicyStmt) - case nodes.AlterSystemStmt: - return convertAlterSystemStmt(&n) + case *pg.Node_AlterPublicationStmt: + return convertAlterPublicationStmt(n.AlterPublicationStmt) - case nodes.AlterTSConfigurationStmt: - return convertAlterTSConfigurationStmt(&n) + case *pg.Node_AlterRoleSetStmt: + return convertAlterRoleSetStmt(n.AlterRoleSetStmt) - case nodes.AlterTSDictionaryStmt: - return convertAlterTSDictionaryStmt(&n) + case *pg.Node_AlterRoleStmt: + return convertAlterRoleStmt(n.AlterRoleStmt) - case nodes.AlterTableCmd: - return convertAlterTableCmd(&n) + case *pg.Node_AlterSeqStmt: + return convertAlterSeqStmt(n.AlterSeqStmt) - case nodes.AlterTableMoveAllStmt: - return convertAlterTableMoveAllStmt(&n) + case *pg.Node_AlterSubscriptionStmt: + return convertAlterSubscriptionStmt(n.AlterSubscriptionStmt) - case nodes.AlterTableSpaceOptionsStmt: - return convertAlterTableSpaceOptionsStmt(&n) + case *pg.Node_AlterSystemStmt: + return convertAlterSystemStmt(n.AlterSystemStmt) - case nodes.AlterTableStmt: - return convertAlterTableStmt(&n) + case *pg.Node_AlterTsconfigurationStmt: + return convertAlterTSConfigurationStmt(n.AlterTsconfigurationStmt) - case nodes.AlterUserMappingStmt: - return convertAlterUserMappingStmt(&n) + case *pg.Node_AlterTsdictionaryStmt: + return convertAlterTSDictionaryStmt(n.AlterTsdictionaryStmt) - case nodes.AlternativeSubPlan: - return convertAlternativeSubPlan(&n) + case *pg.Node_AlterTableCmd: + return convertAlterTableCmd(n.AlterTableCmd) - case nodes.ArrayCoerceExpr: - return convertArrayCoerceExpr(&n) + case *pg.Node_AlterTableMoveAllStmt: + return convertAlterTableMoveAllStmt(n.AlterTableMoveAllStmt) - case nodes.ArrayExpr: - return convertArrayExpr(&n) + case *pg.Node_AlterTableSpaceOptionsStmt: + return convertAlterTableSpaceOptionsStmt(n.AlterTableSpaceOptionsStmt) - case nodes.ArrayRef: - return convertArrayRef(&n) + case *pg.Node_AlterTableStmt: + return convertAlterTableStmt(n.AlterTableStmt) - case nodes.BitString: - return convertBitString(&n) + case *pg.Node_AlterUserMappingStmt: + return convertAlterUserMappingStmt(n.AlterUserMappingStmt) - case nodes.BlockIdData: - return convertBlockIdData(&n) + case *pg.Node_AlternativeSubPlan: + return convertAlternativeSubPlan(n.AlternativeSubPlan) - case nodes.BoolExpr: - return convertBoolExpr(&n) + case *pg.Node_ArrayCoerceExpr: + return convertArrayCoerceExpr(n.ArrayCoerceExpr) - case nodes.BooleanTest: - return convertBooleanTest(&n) + case *pg.Node_ArrayExpr: + return convertArrayExpr(n.ArrayExpr) - case nodes.CaseExpr: - return convertCaseExpr(&n) + case *pg.Node_BitString: + return convertBitString(n.BitString) - case nodes.CaseTestExpr: - return convertCaseTestExpr(&n) + case *pg.Node_BoolExpr: + return convertBoolExpr(n.BoolExpr) - case nodes.CaseWhen: - return convertCaseWhen(&n) + case *pg.Node_Boolean: + return convertBoolean(n.Boolean) - case nodes.CheckPointStmt: - return convertCheckPointStmt(&n) + case *pg.Node_BooleanTest: + return convertBooleanTest(n.BooleanTest) - case nodes.ClosePortalStmt: - return convertClosePortalStmt(&n) + case *pg.Node_CallStmt: + return convertCallStmt(n.CallStmt) - case nodes.ClusterStmt: - return convertClusterStmt(&n) + case *pg.Node_CaseExpr: + return convertCaseExpr(n.CaseExpr) - case nodes.CoalesceExpr: - return convertCoalesceExpr(&n) + case *pg.Node_CaseTestExpr: + return convertCaseTestExpr(n.CaseTestExpr) - case nodes.CoerceToDomain: - return convertCoerceToDomain(&n) + case *pg.Node_CaseWhen: + return convertCaseWhen(n.CaseWhen) - case nodes.CoerceToDomainValue: - return convertCoerceToDomainValue(&n) + case *pg.Node_CheckPointStmt: + return convertCheckPointStmt(n.CheckPointStmt) - case nodes.CoerceViaIO: - return convertCoerceViaIO(&n) + case *pg.Node_ClosePortalStmt: + return convertClosePortalStmt(n.ClosePortalStmt) - case nodes.CollateClause: - return convertCollateClause(&n) + case *pg.Node_ClusterStmt: + return convertClusterStmt(n.ClusterStmt) - case nodes.CollateExpr: - return convertCollateExpr(&n) + case *pg.Node_CoalesceExpr: + return convertCoalesceExpr(n.CoalesceExpr) - case nodes.ColumnDef: - return convertColumnDef(&n) + case *pg.Node_CoerceToDomain: + return convertCoerceToDomain(n.CoerceToDomain) - case nodes.ColumnRef: - return convertColumnRef(&n) + case *pg.Node_CoerceToDomainValue: + return convertCoerceToDomainValue(n.CoerceToDomainValue) - case nodes.CommentStmt: - return convertCommentStmt(&n) + case *pg.Node_CoerceViaIo: + return convertCoerceViaIO(n.CoerceViaIo) - case nodes.CommonTableExpr: - return convertCommonTableExpr(&n) + case *pg.Node_CollateClause: + return convertCollateClause(n.CollateClause) - case nodes.CompositeTypeStmt: - return convertCompositeTypeStmt(&n) + case *pg.Node_CollateExpr: + return convertCollateExpr(n.CollateExpr) - case nodes.Const: - return convertConst(&n) + case *pg.Node_ColumnDef: + return convertColumnDef(n.ColumnDef) - case nodes.Constraint: - return convertConstraint(&n) + case *pg.Node_ColumnRef: + return convertColumnRef(n.ColumnRef) - case nodes.ConstraintsSetStmt: - return convertConstraintsSetStmt(&n) + case *pg.Node_CommentStmt: + return convertCommentStmt(n.CommentStmt) - case nodes.ConvertRowtypeExpr: - return convertConvertRowtypeExpr(&n) + case *pg.Node_CommonTableExpr: + return convertCommonTableExpr(n.CommonTableExpr) - case nodes.CopyStmt: - return convertCopyStmt(&n) + case *pg.Node_CompositeTypeStmt: + return convertCompositeTypeStmt(n.CompositeTypeStmt) - case nodes.CreateAmStmt: - return convertCreateAmStmt(&n) + case *pg.Node_Constraint: + return convertConstraint(n.Constraint) - case nodes.CreateCastStmt: - return convertCreateCastStmt(&n) + case *pg.Node_ConstraintsSetStmt: + return convertConstraintsSetStmt(n.ConstraintsSetStmt) - case nodes.CreateConversionStmt: - return convertCreateConversionStmt(&n) + case *pg.Node_ConvertRowtypeExpr: + return convertConvertRowtypeExpr(n.ConvertRowtypeExpr) - case nodes.CreateDomainStmt: - return convertCreateDomainStmt(&n) + case *pg.Node_CopyStmt: + return convertCopyStmt(n.CopyStmt) - case nodes.CreateEnumStmt: - return convertCreateEnumStmt(&n) + case *pg.Node_CreateAmStmt: + return convertCreateAmStmt(n.CreateAmStmt) - case nodes.CreateEventTrigStmt: - return convertCreateEventTrigStmt(&n) + case *pg.Node_CreateCastStmt: + return convertCreateCastStmt(n.CreateCastStmt) - case nodes.CreateExtensionStmt: - return convertCreateExtensionStmt(&n) + case *pg.Node_CreateConversionStmt: + return convertCreateConversionStmt(n.CreateConversionStmt) - case nodes.CreateFdwStmt: - return convertCreateFdwStmt(&n) + case *pg.Node_CreateDomainStmt: + return convertCreateDomainStmt(n.CreateDomainStmt) - case nodes.CreateForeignServerStmt: - return convertCreateForeignServerStmt(&n) + case *pg.Node_CreateEnumStmt: + return convertCreateEnumStmt(n.CreateEnumStmt) - case nodes.CreateForeignTableStmt: - return convertCreateForeignTableStmt(&n) + case *pg.Node_CreateEventTrigStmt: + return convertCreateEventTrigStmt(n.CreateEventTrigStmt) - case nodes.CreateFunctionStmt: - return convertCreateFunctionStmt(&n) + case *pg.Node_CreateExtensionStmt: + return convertCreateExtensionStmt(n.CreateExtensionStmt) - case nodes.CreateOpClassItem: - return convertCreateOpClassItem(&n) + case *pg.Node_CreateFdwStmt: + return convertCreateFdwStmt(n.CreateFdwStmt) - case nodes.CreateOpClassStmt: - return convertCreateOpClassStmt(&n) + case *pg.Node_CreateForeignServerStmt: + return convertCreateForeignServerStmt(n.CreateForeignServerStmt) - case nodes.CreateOpFamilyStmt: - return convertCreateOpFamilyStmt(&n) + case *pg.Node_CreateForeignTableStmt: + return convertCreateForeignTableStmt(n.CreateForeignTableStmt) - case nodes.CreatePLangStmt: - return convertCreatePLangStmt(&n) + case *pg.Node_CreateFunctionStmt: + return convertCreateFunctionStmt(n.CreateFunctionStmt) - case nodes.CreatePolicyStmt: - return convertCreatePolicyStmt(&n) + case *pg.Node_CreateOpClassItem: + return convertCreateOpClassItem(n.CreateOpClassItem) - case nodes.CreatePublicationStmt: - return convertCreatePublicationStmt(&n) + case *pg.Node_CreateOpClassStmt: + return convertCreateOpClassStmt(n.CreateOpClassStmt) - case nodes.CreateRangeStmt: - return convertCreateRangeStmt(&n) + case *pg.Node_CreateOpFamilyStmt: + return convertCreateOpFamilyStmt(n.CreateOpFamilyStmt) - case nodes.CreateRoleStmt: - return convertCreateRoleStmt(&n) + case *pg.Node_CreatePlangStmt: + return convertCreatePLangStmt(n.CreatePlangStmt) - case nodes.CreateSchemaStmt: - return convertCreateSchemaStmt(&n) + case *pg.Node_CreatePolicyStmt: + return convertCreatePolicyStmt(n.CreatePolicyStmt) - case nodes.CreateSeqStmt: - return convertCreateSeqStmt(&n) + case *pg.Node_CreatePublicationStmt: + return convertCreatePublicationStmt(n.CreatePublicationStmt) - case nodes.CreateStatsStmt: - return convertCreateStatsStmt(&n) + case *pg.Node_CreateRangeStmt: + return convertCreateRangeStmt(n.CreateRangeStmt) - case nodes.CreateStmt: - return convertCreateStmt(&n) + case *pg.Node_CreateRoleStmt: + return convertCreateRoleStmt(n.CreateRoleStmt) - case nodes.CreateSubscriptionStmt: - return convertCreateSubscriptionStmt(&n) + case *pg.Node_CreateSchemaStmt: + return convertCreateSchemaStmt(n.CreateSchemaStmt) - case nodes.CreateTableAsStmt: - return convertCreateTableAsStmt(&n) + case *pg.Node_CreateSeqStmt: + return convertCreateSeqStmt(n.CreateSeqStmt) - case nodes.CreateTableSpaceStmt: - return convertCreateTableSpaceStmt(&n) + case *pg.Node_CreateStatsStmt: + return convertCreateStatsStmt(n.CreateStatsStmt) - case nodes.CreateTransformStmt: - return convertCreateTransformStmt(&n) + case *pg.Node_CreateStmt: + return convertCreateStmt(n.CreateStmt) - case nodes.CreateTrigStmt: - return convertCreateTrigStmt(&n) + case *pg.Node_CreateSubscriptionStmt: + return convertCreateSubscriptionStmt(n.CreateSubscriptionStmt) - case nodes.CreateUserMappingStmt: - return convertCreateUserMappingStmt(&n) + case *pg.Node_CreateTableAsStmt: + return convertCreateTableAsStmt(n.CreateTableAsStmt) - case nodes.CreatedbStmt: - return convertCreatedbStmt(&n) + case *pg.Node_CreateTableSpaceStmt: + return convertCreateTableSpaceStmt(n.CreateTableSpaceStmt) - case nodes.CurrentOfExpr: - return convertCurrentOfExpr(&n) + case *pg.Node_CreateTransformStmt: + return convertCreateTransformStmt(n.CreateTransformStmt) - case nodes.DeallocateStmt: - return convertDeallocateStmt(&n) + case *pg.Node_CreateTrigStmt: + return convertCreateTrigStmt(n.CreateTrigStmt) - case nodes.DeclareCursorStmt: - return convertDeclareCursorStmt(&n) + case *pg.Node_CreateUserMappingStmt: + return convertCreateUserMappingStmt(n.CreateUserMappingStmt) - case nodes.DefElem: - return convertDefElem(&n) + case *pg.Node_CreatedbStmt: + return convertCreatedbStmt(n.CreatedbStmt) - case nodes.DefineStmt: - return convertDefineStmt(&n) + case *pg.Node_CurrentOfExpr: + return convertCurrentOfExpr(n.CurrentOfExpr) - case nodes.DeleteStmt: - return convertDeleteStmt(&n) + case *pg.Node_DeallocateStmt: + return convertDeallocateStmt(n.DeallocateStmt) - case nodes.DiscardStmt: - return convertDiscardStmt(&n) + case *pg.Node_DeclareCursorStmt: + return convertDeclareCursorStmt(n.DeclareCursorStmt) - case nodes.DoStmt: - return convertDoStmt(&n) + case *pg.Node_DefElem: + return convertDefElem(n.DefElem) - case nodes.DropOwnedStmt: - return convertDropOwnedStmt(&n) + case *pg.Node_DefineStmt: + return convertDefineStmt(n.DefineStmt) - case nodes.DropRoleStmt: - return convertDropRoleStmt(&n) + case *pg.Node_DeleteStmt: + return convertDeleteStmt(n.DeleteStmt) - case nodes.DropStmt: - return convertDropStmt(&n) + case *pg.Node_DiscardStmt: + return convertDiscardStmt(n.DiscardStmt) - case nodes.DropSubscriptionStmt: - return convertDropSubscriptionStmt(&n) + case *pg.Node_DoStmt: + return convertDoStmt(n.DoStmt) - case nodes.DropTableSpaceStmt: - return convertDropTableSpaceStmt(&n) + case *pg.Node_DropOwnedStmt: + return convertDropOwnedStmt(n.DropOwnedStmt) - case nodes.DropUserMappingStmt: - return convertDropUserMappingStmt(&n) + case *pg.Node_DropRoleStmt: + return convertDropRoleStmt(n.DropRoleStmt) - case nodes.DropdbStmt: - return convertDropdbStmt(&n) + case *pg.Node_DropStmt: + return convertDropStmt(n.DropStmt) - case nodes.ExecuteStmt: - return convertExecuteStmt(&n) + case *pg.Node_DropSubscriptionStmt: + return convertDropSubscriptionStmt(n.DropSubscriptionStmt) - case nodes.ExplainStmt: - return convertExplainStmt(&n) + case *pg.Node_DropTableSpaceStmt: + return convertDropTableSpaceStmt(n.DropTableSpaceStmt) - case nodes.Expr: - return convertExpr(&n) + case *pg.Node_DropUserMappingStmt: + return convertDropUserMappingStmt(n.DropUserMappingStmt) - case nodes.FetchStmt: - return convertFetchStmt(&n) + case *pg.Node_DropdbStmt: + return convertDropdbStmt(n.DropdbStmt) - case nodes.FieldSelect: - return convertFieldSelect(&n) + case *pg.Node_ExecuteStmt: + return convertExecuteStmt(n.ExecuteStmt) - case nodes.FieldStore: - return convertFieldStore(&n) + case *pg.Node_ExplainStmt: + return convertExplainStmt(n.ExplainStmt) - case nodes.Float: - return convertFloat(&n) + case *pg.Node_FetchStmt: + return convertFetchStmt(n.FetchStmt) - case nodes.FromExpr: - return convertFromExpr(&n) + case *pg.Node_FieldSelect: + return convertFieldSelect(n.FieldSelect) - case nodes.FuncCall: - return convertFuncCall(&n) + case *pg.Node_FieldStore: + return convertFieldStore(n.FieldStore) - case nodes.FuncExpr: - return convertFuncExpr(&n) + case *pg.Node_Float: + return convertFloat(n.Float) - case nodes.FunctionParameter: - return convertFunctionParameter(&n) + case *pg.Node_FromExpr: + return convertFromExpr(n.FromExpr) - case nodes.GrantRoleStmt: - return convertGrantRoleStmt(&n) + case *pg.Node_FuncCall: + return convertFuncCall(n.FuncCall) - case nodes.GrantStmt: - return convertGrantStmt(&n) + case *pg.Node_FuncExpr: + return convertFuncExpr(n.FuncExpr) - case nodes.GroupingFunc: - return convertGroupingFunc(&n) + case *pg.Node_FunctionParameter: + return convertFunctionParameter(n.FunctionParameter) - case nodes.GroupingSet: - return convertGroupingSet(&n) + case *pg.Node_GrantRoleStmt: + return convertGrantRoleStmt(n.GrantRoleStmt) - case nodes.ImportForeignSchemaStmt: - return convertImportForeignSchemaStmt(&n) + case *pg.Node_GrantStmt: + return convertGrantStmt(n.GrantStmt) - case nodes.IndexElem: - return convertIndexElem(&n) + case *pg.Node_GroupingFunc: + return convertGroupingFunc(n.GroupingFunc) - case nodes.IndexStmt: - return convertIndexStmt(&n) + case *pg.Node_GroupingSet: + return convertGroupingSet(n.GroupingSet) - case nodes.InferClause: - return convertInferClause(&n) + case *pg.Node_ImportForeignSchemaStmt: + return convertImportForeignSchemaStmt(n.ImportForeignSchemaStmt) - case nodes.InferenceElem: - return convertInferenceElem(&n) + case *pg.Node_IndexElem: + return convertIndexElem(n.IndexElem) - case nodes.InlineCodeBlock: - return convertInlineCodeBlock(&n) + case *pg.Node_IndexStmt: + return convertIndexStmt(n.IndexStmt) - case nodes.InsertStmt: - return convertInsertStmt(&n) + case *pg.Node_InferClause: + return convertInferClause(n.InferClause) - case nodes.Integer: - return convertInteger(&n) + case *pg.Node_InferenceElem: + return convertInferenceElem(n.InferenceElem) - case nodes.IntoClause: - return convertIntoClause(&n) + case *pg.Node_InlineCodeBlock: + return convertInlineCodeBlock(n.InlineCodeBlock) - case nodes.JoinExpr: - return convertJoinExpr(&n) + case *pg.Node_InsertStmt: + return convertInsertStmt(n.InsertStmt) - case nodes.List: - return convertList(n) + case *pg.Node_Integer: + return convertInteger(n.Integer) - case nodes.ListenStmt: - return convertListenStmt(&n) + case *pg.Node_IntoClause: + return convertIntoClause(n.IntoClause) - case nodes.LoadStmt: - return convertLoadStmt(&n) + case *pg.Node_JoinExpr: + return convertJoinExpr(n.JoinExpr) - case nodes.LockStmt: - return convertLockStmt(&n) + case *pg.Node_List: + return convertList(n.List) - case nodes.LockingClause: - return convertLockingClause(&n) + case *pg.Node_ListenStmt: + return convertListenStmt(n.ListenStmt) - case nodes.MinMaxExpr: - return convertMinMaxExpr(&n) + case *pg.Node_LoadStmt: + return convertLoadStmt(n.LoadStmt) - case nodes.MultiAssignRef: - return convertMultiAssignRef(&n) + case *pg.Node_LockStmt: + return convertLockStmt(n.LockStmt) - case nodes.NamedArgExpr: - return convertNamedArgExpr(&n) + case *pg.Node_LockingClause: + return convertLockingClause(n.LockingClause) - case nodes.NextValueExpr: - return convertNextValueExpr(&n) + case *pg.Node_MinMaxExpr: + return convertMinMaxExpr(n.MinMaxExpr) - case nodes.NotifyStmt: - return convertNotifyStmt(&n) + case *pg.Node_MultiAssignRef: + return convertMultiAssignRef(n.MultiAssignRef) - case nodes.Null: - return convertNull(&n) + case *pg.Node_NamedArgExpr: + return convertNamedArgExpr(n.NamedArgExpr) - case nodes.NullTest: - return convertNullTest(&n) + case *pg.Node_NextValueExpr: + return convertNextValueExpr(n.NextValueExpr) - case nodes.ObjectWithArgs: - return convertObjectWithArgs(&n) + case *pg.Node_NotifyStmt: + return convertNotifyStmt(n.NotifyStmt) - case nodes.OnConflictClause: - return convertOnConflictClause(&n) + case *pg.Node_NullTest: + return convertNullTest(n.NullTest) - case nodes.OnConflictExpr: - return convertOnConflictExpr(&n) + case *pg.Node_NullIfExpr: + return convertNullIfExpr(n.NullIfExpr) - case nodes.OpExpr: - return convertOpExpr(&n) + case *pg.Node_ObjectWithArgs: + return convertObjectWithArgs(n.ObjectWithArgs) - case nodes.Param: - return convertParam(&n) + case *pg.Node_OnConflictClause: + return convertOnConflictClause(n.OnConflictClause) - case nodes.ParamExecData: - return convertParamExecData(&n) + case *pg.Node_OnConflictExpr: + return convertOnConflictExpr(n.OnConflictExpr) - case nodes.ParamExternData: - return convertParamExternData(&n) + case *pg.Node_OpExpr: + return convertOpExpr(n.OpExpr) - case nodes.ParamListInfoData: - return convertParamListInfoData(&n) + case *pg.Node_Param: + return convertParam(n.Param) - case nodes.ParamRef: - return convertParamRef(&n) + case *pg.Node_ParamRef: + return convertParamRef(n.ParamRef) - case nodes.PartitionBoundSpec: - return convertPartitionBoundSpec(&n) + case *pg.Node_PartitionBoundSpec: + return convertPartitionBoundSpec(n.PartitionBoundSpec) - case nodes.PartitionCmd: - return convertPartitionCmd(&n) + case *pg.Node_PartitionCmd: + return convertPartitionCmd(n.PartitionCmd) - case nodes.PartitionElem: - return convertPartitionElem(&n) + case *pg.Node_PartitionElem: + return convertPartitionElem(n.PartitionElem) - case nodes.PartitionRangeDatum: - return convertPartitionRangeDatum(&n) + case *pg.Node_PartitionRangeDatum: + return convertPartitionRangeDatum(n.PartitionRangeDatum) - case nodes.PartitionSpec: - return convertPartitionSpec(&n) + case *pg.Node_PartitionSpec: + return convertPartitionSpec(n.PartitionSpec) - case nodes.PrepareStmt: - return convertPrepareStmt(&n) + case *pg.Node_PrepareStmt: + return convertPrepareStmt(n.PrepareStmt) - case nodes.Query: - return convertQuery(&n) + case *pg.Node_Query: + return convertQuery(n.Query) - case nodes.RangeFunction: - return convertRangeFunction(&n) + case *pg.Node_RangeFunction: + return convertRangeFunction(n.RangeFunction) - case nodes.RangeSubselect: - return convertRangeSubselect(&n) + case *pg.Node_RangeSubselect: + return convertRangeSubselect(n.RangeSubselect) - case nodes.RangeTableFunc: - return convertRangeTableFunc(&n) + case *pg.Node_RangeTableFunc: + return convertRangeTableFunc(n.RangeTableFunc) - case nodes.RangeTableFuncCol: - return convertRangeTableFuncCol(&n) + case *pg.Node_RangeTableFuncCol: + return convertRangeTableFuncCol(n.RangeTableFuncCol) - case nodes.RangeTableSample: - return convertRangeTableSample(&n) + case *pg.Node_RangeTableSample: + return convertRangeTableSample(n.RangeTableSample) - case nodes.RangeTblEntry: - return convertRangeTblEntry(&n) + case *pg.Node_RangeTblEntry: + return convertRangeTblEntry(n.RangeTblEntry) - case nodes.RangeTblFunction: - return convertRangeTblFunction(&n) + case *pg.Node_RangeTblFunction: + return convertRangeTblFunction(n.RangeTblFunction) - case nodes.RangeTblRef: - return convertRangeTblRef(&n) + case *pg.Node_RangeTblRef: + return convertRangeTblRef(n.RangeTblRef) - case nodes.RangeVar: - return convertRangeVar(&n) + case *pg.Node_RangeVar: + return convertRangeVar(n.RangeVar) - case nodes.RawStmt: - return convertRawStmt(&n) + case *pg.Node_RawStmt: + return convertRawStmt(n.RawStmt) - case nodes.ReassignOwnedStmt: - return convertReassignOwnedStmt(&n) + case *pg.Node_ReassignOwnedStmt: + return convertReassignOwnedStmt(n.ReassignOwnedStmt) - case nodes.RefreshMatViewStmt: - return convertRefreshMatViewStmt(&n) + case *pg.Node_RefreshMatViewStmt: + return convertRefreshMatViewStmt(n.RefreshMatViewStmt) - case nodes.ReindexStmt: - return convertReindexStmt(&n) + case *pg.Node_ReindexStmt: + return convertReindexStmt(n.ReindexStmt) - case nodes.RelabelType: - return convertRelabelType(&n) + case *pg.Node_RelabelType: + return convertRelabelType(n.RelabelType) - case nodes.RenameStmt: - return convertRenameStmt(&n) + case *pg.Node_RenameStmt: + return convertRenameStmt(n.RenameStmt) - case nodes.ReplicaIdentityStmt: - return convertReplicaIdentityStmt(&n) + case *pg.Node_ReplicaIdentityStmt: + return convertReplicaIdentityStmt(n.ReplicaIdentityStmt) - case nodes.ResTarget: - return convertResTarget(&n) + case *pg.Node_ResTarget: + return convertResTarget(n.ResTarget) - case nodes.RoleSpec: - return convertRoleSpec(&n) + case *pg.Node_RoleSpec: + return convertRoleSpec(n.RoleSpec) - case nodes.RowCompareExpr: - return convertRowCompareExpr(&n) + case *pg.Node_RowCompareExpr: + return convertRowCompareExpr(n.RowCompareExpr) - case nodes.RowExpr: - return convertRowExpr(&n) + case *pg.Node_RowExpr: + return convertRowExpr(n.RowExpr) - case nodes.RowMarkClause: - return convertRowMarkClause(&n) + case *pg.Node_RowMarkClause: + return convertRowMarkClause(n.RowMarkClause) - case nodes.RuleStmt: - return convertRuleStmt(&n) + case *pg.Node_RuleStmt: + return convertRuleStmt(n.RuleStmt) - case nodes.SQLValueFunction: - return convertSQLValueFunction(&n) + case *pg.Node_SqlvalueFunction: + return convertSQLValueFunction(n.SqlvalueFunction) - case nodes.ScalarArrayOpExpr: - return convertScalarArrayOpExpr(&n) + case *pg.Node_ScalarArrayOpExpr: + return convertScalarArrayOpExpr(n.ScalarArrayOpExpr) - case nodes.SecLabelStmt: - return convertSecLabelStmt(&n) + case *pg.Node_SecLabelStmt: + return convertSecLabelStmt(n.SecLabelStmt) - case nodes.SelectStmt: - return convertSelectStmt(&n) + case *pg.Node_SelectStmt: + return convertSelectStmt(n.SelectStmt) - case nodes.SetOperationStmt: - return convertSetOperationStmt(&n) + case *pg.Node_SetOperationStmt: + return convertSetOperationStmt(n.SetOperationStmt) - case nodes.SetToDefault: - return convertSetToDefault(&n) + case *pg.Node_SetToDefault: + return convertSetToDefault(n.SetToDefault) - case nodes.SortBy: - return convertSortBy(&n) + case *pg.Node_SortBy: + return convertSortBy(n.SortBy) - case nodes.SortGroupClause: - return convertSortGroupClause(&n) + case *pg.Node_SortGroupClause: + return convertSortGroupClause(n.SortGroupClause) - case nodes.String: - return convertString(&n) + case *pg.Node_String_: + return convertString(n.String_) - case nodes.SubLink: - return convertSubLink(&n) + case *pg.Node_SubLink: + return convertSubLink(n.SubLink) - case nodes.SubPlan: - return convertSubPlan(&n) + case *pg.Node_SubPlan: + return convertSubPlan(n.SubPlan) - case nodes.TableFunc: - return convertTableFunc(&n) + case *pg.Node_TableFunc: + return convertTableFunc(n.TableFunc) - case nodes.TableLikeClause: - return convertTableLikeClause(&n) + case *pg.Node_TableLikeClause: + return convertTableLikeClause(n.TableLikeClause) - case nodes.TableSampleClause: - return convertTableSampleClause(&n) + case *pg.Node_TableSampleClause: + return convertTableSampleClause(n.TableSampleClause) - case nodes.TargetEntry: - return convertTargetEntry(&n) + case *pg.Node_TargetEntry: + return convertTargetEntry(n.TargetEntry) - case nodes.TransactionStmt: - return convertTransactionStmt(&n) + case *pg.Node_TransactionStmt: + return convertTransactionStmt(n.TransactionStmt) - case nodes.TriggerTransition: - return convertTriggerTransition(&n) + case *pg.Node_TriggerTransition: + return convertTriggerTransition(n.TriggerTransition) - case nodes.TruncateStmt: - return convertTruncateStmt(&n) + case *pg.Node_TruncateStmt: + return convertTruncateStmt(n.TruncateStmt) - case nodes.TypeCast: - return convertTypeCast(&n) + case *pg.Node_TypeCast: + return convertTypeCast(n.TypeCast) - case nodes.TypeName: - return convertTypeName(&n) + case *pg.Node_TypeName: + return convertTypeName(n.TypeName) - case nodes.UnlistenStmt: - return convertUnlistenStmt(&n) + case *pg.Node_UnlistenStmt: + return convertUnlistenStmt(n.UnlistenStmt) - case nodes.UpdateStmt: - return convertUpdateStmt(&n) + case *pg.Node_UpdateStmt: + return convertUpdateStmt(n.UpdateStmt) - case nodes.VacuumStmt: - return convertVacuumStmt(&n) + case *pg.Node_VacuumStmt: + return convertVacuumStmt(n.VacuumStmt) - case nodes.Var: - return convertVar(&n) + case *pg.Node_Var: + return convertVar(n.Var) - case nodes.VariableSetStmt: - return convertVariableSetStmt(&n) + case *pg.Node_VariableSetStmt: + return convertVariableSetStmt(n.VariableSetStmt) - case nodes.VariableShowStmt: - return convertVariableShowStmt(&n) + case *pg.Node_VariableShowStmt: + return convertVariableShowStmt(n.VariableShowStmt) - case nodes.ViewStmt: - return convertViewStmt(&n) + case *pg.Node_ViewStmt: + return convertViewStmt(n.ViewStmt) - case nodes.WindowClause: - return convertWindowClause(&n) + case *pg.Node_WindowClause: + return convertWindowClause(n.WindowClause) - case nodes.WindowDef: - return convertWindowDef(&n) + case *pg.Node_WindowDef: + return convertWindowDef(n.WindowDef) - case nodes.WindowFunc: - return convertWindowFunc(&n) + case *pg.Node_WindowFunc: + return convertWindowFunc(n.WindowFunc) - case nodes.WithCheckOption: - return convertWithCheckOption(&n) + case *pg.Node_WithCheckOption: + return convertWithCheckOption(n.WithCheckOption) - case nodes.WithClause: - return convertWithClause(&n) + case *pg.Node_WithClause: + return convertWithClause(n.WithClause) - case nodes.XmlExpr: - return convertXmlExpr(&n) + case *pg.Node_XmlExpr: + return convertXmlExpr(n.XmlExpr) - case nodes.XmlSerialize: - return convertXmlSerialize(&n) + case *pg.Node_XmlSerialize: + return convertXmlSerialize(n.XmlSerialize) default: return &ast.TODO{} diff --git a/internal/engine/postgresql/extension.go b/internal/engine/postgresql/extension.go index 4c5a213395..c2bfed5c5c 100644 --- a/internal/engine/postgresql/extension.go +++ b/internal/engine/postgresql/extension.go @@ -3,8 +3,8 @@ package postgresql import ( - "github.com/kyleconroy/sqlc/internal/engine/postgresql/contrib" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql/contrib" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) func loadExtension(name string) *catalog.Schema { @@ -45,20 +45,22 @@ func loadExtension(name string) *catalog.Schema { return contrib.Pageinspect() case "pg_buffercache": return contrib.PgBuffercache() - case "pgcrypto": - return contrib.Pgcrypto() case "pg_freespacemap": return contrib.PgFreespacemap() case "pg_prewarm": return contrib.PgPrewarm() case "pg_stat_statements": return contrib.PgStatStatements() - case "pgstattuple": - return contrib.Pgstattuple() 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": diff --git a/internal/engine/postgresql/information_schema.go b/internal/engine/postgresql/information_schema.go new file mode 100644 index 0000000000..ac76d47905 --- /dev/null +++ b/internal/engine/postgresql/information_schema.go @@ -0,0 +1,4111 @@ +// 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 2ac680afae..0c6b3a0fc2 100644 --- a/internal/engine/postgresql/parse.go +++ b/internal/engine/postgresql/parse.go @@ -1,26 +1,34 @@ -// +build !windows - package postgresql import ( "errors" "fmt" "io" - "io/ioutil" "strings" - pg "github.com/lfittl/pg_query_go" - nodes "github.com/lfittl/pg_query_go/nodes" + nodes "github.com/pganalyze/pg_query_go/v6" - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql/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 stringSlice(list nodes.List) []string { +func stringSlice(list *nodes.List) []string { items := []string{} for _, item := range list.Items { - if n, ok := item.(nodes.String); ok { - items = append(items, n.Str) + if n, ok := item.Node.(*nodes.Node_String_); ok { + items = append(items, n.String_.Sval) + } + } + return items +} + +func stringSliceFromNodes(s []*nodes.Node) []string { + var items []string + for _, item := range s { + if n, ok := item.Node.(*nodes.Node_String_); ok { + items = append(items, n.String_.Sval) } } return items @@ -32,125 +40,78 @@ type relation struct { Name string } -func parseFuncName(node nodes.Node) (*ast.FuncName, error) { - rel, err := parseRelation(node) - if err != nil { - return nil, fmt.Errorf("parse func name: %w", err) +func (r relation) TableName() *ast.TableName { + return &ast.TableName{ + Catalog: r.Catalog, + Schema: r.Schema, + Name: r.Name, } - return &ast.FuncName{ - Catalog: rel.Catalog, - Schema: rel.Schema, - Name: rel.Name, - }, nil } -func parseFuncParamMode(m nodes.FunctionParameterMode) (ast.FuncParamMode, error) { - switch m { - case 'i': - return ast.FuncParamIn, nil - case 'o': - return ast.FuncParamOut, nil - case 'b': - return ast.FuncParamInOut, nil - case 'v': - return ast.FuncParamVariadic, nil - case 't': - return ast.FuncParamTable, nil - default: - return -1, fmt.Errorf("parse func param: invalid mode %v", m) +func (r relation) TypeName() *ast.TypeName { + return &ast.TypeName{ + Catalog: r.Catalog, + Schema: r.Schema, + Name: r.Name, } } -func parseTypeName(node nodes.Node) (*ast.TypeName, error) { - rel, err := parseRelation(node) - if err != nil { - return nil, fmt.Errorf("parse type name: %w", err) +func (r relation) FuncName() *ast.FuncName { + return &ast.FuncName{ + Catalog: r.Catalog, + Schema: r.Schema, + Name: r.Name, } - return &ast.TypeName{ - Catalog: rel.Catalog, - Schema: rel.Schema, - Name: rel.Name, - }, nil } -func parseTableName(node nodes.Node) (*ast.TableName, error) { - rel, err := parseRelation(node) - if err != nil { - return nil, fmt.Errorf("parse table name: %w", err) +func parseRelationFromNodes(list []*nodes.Node) (*relation, error) { + parts := stringSliceFromNodes(list) + switch len(parts) { + case 1: + return &relation{ + Name: parts[0], + }, nil + case 2: + return &relation{ + Schema: parts[0], + Name: parts[1], + }, nil + case 3: + return &relation{ + Catalog: parts[0], + Schema: parts[1], + Name: parts[2], + }, nil + default: + return nil, fmt.Errorf("invalid name: %s", joinNodes(list, ".")) } - return &ast.TableName{ - Catalog: rel.Catalog, - Schema: rel.Schema, - Name: rel.Name, - }, nil } -func parseRelation(node nodes.Node) (*relation, error) { - switch n := node.(type) { - - case nodes.List: - parts := stringSlice(n) - switch len(parts) { - case 1: - return &relation{ - Name: parts[0], - }, nil - case 2: - return &relation{ - Schema: parts[0], - Name: parts[1], - }, nil - case 3: - return &relation{ - Catalog: parts[0], - Schema: parts[1], - Name: parts[2], - }, nil - default: - return nil, fmt.Errorf("invalid name: %s", join(n, ".")) - } - - case nodes.RangeVar: - name := relation{} - if n.Catalogname != nil { - name.Catalog = *n.Catalogname - } - if n.Schemaname != nil { - name.Schema = *n.Schemaname - } - if n.Relname != nil { - name.Name = *n.Relname - } - return &name, nil - - case *nodes.RangeVar: - name := relation{} - if n.Catalogname != nil { - name.Catalog = *n.Catalogname - } - if n.Schemaname != nil { - name.Schema = *n.Schemaname - } - if n.Relname != nil { - name.Name = *n.Relname - } - return &name, nil - - case nodes.TypeName: - return parseRelation(n.Names) - - case *nodes.TypeName: - return parseRelation(n.Names) +func parseRelationFromRangeVar(rv *nodes.RangeVar) *relation { + return &relation{ + Catalog: rv.Catalogname, + Schema: rv.Schemaname, + Name: rv.Relname, + } +} +func parseRelation(in *nodes.Node) (*relation, error) { + switch n := in.Node.(type) { + case *nodes.Node_List: + return parseRelationFromNodes(n.List.Items) + case *nodes.Node_RangeVar: + return parseRelationFromRangeVar(n.RangeVar), nil + case *nodes.Node_TypeName: + return parseRelationFromNodes(n.TypeName.Names) default: return nil, fmt.Errorf("unexpected node type: %T", n) } } -func parseColName(node nodes.Node) (*ast.ColumnRef, *ast.TableName, error) { - switch n := node.(type) { - case nodes.List: - parts := stringSlice(n) +func parseColName(node *nodes.Node) (*ast.ColumnRef, *ast.TableName, error) { + switch n := node.Node.(type) { + case *nodes.Node_List: + parts := stringSlice(n.List) var tbl *ast.TableName var ref *ast.ColumnRef switch len(parts) { @@ -172,8 +133,8 @@ func parseColName(node nodes.Node) (*ast.ColumnRef, *ast.TableName, error) { } } -func join(list nodes.List, sep string) string { - return strings.Join(stringSlice(list), sep) +func joinNodes(list []*nodes.Node, sep string) string { + return strings.Join(stringSliceFromNodes(list), sep) } func NewParser() *Parser { @@ -186,21 +147,18 @@ type Parser struct { var errSkip = errors.New("skip stmt") func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - contents, err := ioutil.ReadAll(r) + contents, err := io.ReadAll(r) if err != nil { return nil, err } - tree, err := pg.Parse(string(contents)) + tree, err := Parse(string(contents)) if err != nil { - return nil, err + pErr := normalizeErr(err) + return nil, pErr } var stmts []ast.Statement - for _, stmt := range tree.Statements { - raw, ok := stmt.(nodes.RawStmt) - if !ok { - return nil, fmt.Errorf("expected RawStmt; got %T", stmt) - } + for _, raw := range tree.Stmts { n, err := translate(raw.Stmt) if err == errSkip { continue @@ -214,117 +172,154 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { stmts = append(stmts, ast.Statement{ Raw: &ast.RawStmt{ Stmt: n, - StmtLocation: raw.StmtLocation, - StmtLen: raw.StmtLen, + StmtLocation: int(raw.StmtLocation), + StmtLen: int(raw.StmtLen), }, }) } return stmts, nil } +func normalizeErr(err error) error { + //TODO: errors.As complains that *parser.Error does not implement error + if pErr, ok := err.(*parser.Error); ok { + sErr := &sqlerr.Error{ + Message: pErr.Message, + //Err: pErr, + Line: pErr.Lineno, + Location: pErr.Cursorpos, + } + return sErr + } + + return err +} + // 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, } } -func translate(node nodes.Node) (ast.Node, error) { - switch n := node.(type) { +func translate(node *nodes.Node) (ast.Node, error) { + switch inner := node.Node.(type) { - case nodes.AlterEnumStmt: - name, err := parseTypeName(n.TypeName) + case *nodes.Node_AlterEnumStmt: + n := inner.AlterEnumStmt + rel, err := parseRelationFromNodes(n.TypeName) if err != nil { return nil, err } - if n.OldVal != nil { + if n.OldVal != "" { return &ast.AlterTypeRenameValueStmt{ - Type: name, - OldValue: n.OldVal, - NewValue: n.NewVal, + Type: rel.TypeName(), + OldValue: makeString(n.OldVal), + NewValue: makeString(n.NewVal), }, nil } else { return &ast.AlterTypeAddValueStmt{ - Type: name, - NewValue: n.NewVal, + Type: rel.TypeName(), + NewValue: makeString(n.NewVal), + NewValHasNeighbor: len(n.NewValNeighbor) > 0, + NewValNeighbor: makeString(n.NewValNeighbor), + NewValIsAfter: n.NewValIsAfter, SkipIfNewValExists: n.SkipIfNewValExists, }, nil } - case nodes.AlterObjectSchemaStmt: + case *nodes.Node_AlterObjectSchemaStmt: + n := inner.AlterObjectSchemaStmt switch n.ObjectType { - case nodes.OBJECT_TABLE: - tbl, err := parseTableName(*n.Relation) + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_VIEW, nodes.ObjectType_OBJECT_MATVIEW: + rel := parseRelationFromRangeVar(n.Relation) + return &ast.AlterTableSetSchemaStmt{ + Table: rel.TableName(), + NewSchema: makeString(n.Newschema), + MissingOk: n.MissingOk, + }, nil + + case nodes.ObjectType_OBJECT_TYPE: + rel, err := parseRelation(n.Object) if err != nil { return nil, err } - return &ast.AlterTableSetSchemaStmt{ - Table: tbl, - NewSchema: n.Newschema, + return &ast.AlterTypeSetSchemaStmt{ + Type: rel.TypeName(), + NewSchema: makeString(n.Newschema), }, nil } return nil, errSkip - case nodes.AlterTableStmt: - name, err := parseTableName(*n.Relation) - if err != nil { - return nil, err - } + case *nodes.Node_AlterTableStmt: + n := inner.AlterTableStmt + rel := parseRelationFromRangeVar(n.Relation) at := &ast.AlterTableStmt{ - Table: name, - Cmds: &ast.List{}, - } - for _, cmd := range n.Cmds.Items { - switch cmd := cmd.(type) { - case nodes.AlterTableCmd: - item := &ast.AlterTableCmd{Name: cmd.Name, MissingOk: cmd.MissingOk} - - switch cmd.Subtype { - case nodes.AT_AddColumn: - d := cmd.Def.(nodes.ColumnDef) - tn, err := parseTypeName(d.TypeName) + Table: rel.TableName(), + Cmds: &ast.List{}, + MissingOk: n.MissingOk, + } + for _, cmd := range n.Cmds { + switch cmdOneOf := cmd.Node.(type) { + case *nodes.Node_AlterTableCmd: + altercmd := cmdOneOf.AlterTableCmd + item := &ast.AlterTableCmd{Name: &altercmd.Name, MissingOk: altercmd.MissingOk} + + switch altercmd.Subtype { + case nodes.AlterTableType_AT_AddColumn: + d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) + if !ok { + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") + } + + rel, err := parseRelationFromNodes(d.ColumnDef.TypeName.Names) if err != nil { return nil, err } item.Subtype = ast.AT_AddColumn item.Def = &ast.ColumnDef{ - Colname: *d.Colname, - TypeName: tn, - IsNotNull: isNotNull(d), - IsArray: isArray(d.TypeName), + Colname: d.ColumnDef.Colname, + TypeName: rel.TypeName(), + IsNotNull: isNotNull(d.ColumnDef), + IsArray: isArray(d.ColumnDef.TypeName), + ArrayDims: len(d.ColumnDef.TypeName.ArrayBounds), } - case nodes.AT_AlterColumnType: - d := cmd.Def.(nodes.ColumnDef) + case nodes.AlterTableType_AT_AlterColumnType: + d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) + if !ok { + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") + } col := "" - if cmd.Name != nil { - col = *cmd.Name - } else if d.Colname != nil { - col = *d.Colname + if altercmd.Name != "" { + col = altercmd.Name + } else if d.ColumnDef.Colname != "" { + col = d.ColumnDef.Colname } else { return nil, fmt.Errorf("unknown name for alter column type") } - tn, err := parseTypeName(d.TypeName) + rel, err := parseRelationFromNodes(d.ColumnDef.TypeName.Names) if err != nil { return nil, err } item.Subtype = ast.AT_AlterColumnType item.Def = &ast.ColumnDef{ Colname: col, - TypeName: tn, - IsNotNull: isNotNull(d), - IsArray: isArray(d.TypeName), + TypeName: rel.TypeName(), + IsNotNull: isNotNull(d.ColumnDef), + IsArray: isArray(d.ColumnDef.TypeName), + ArrayDims: len(d.ColumnDef.TypeName.ArrayBounds), } - case nodes.AT_DropColumn: + case nodes.AlterTableType_AT_DropColumn: item.Subtype = ast.AT_DropColumn - case nodes.AT_DropNotNull: + case nodes.AlterTableType_AT_DropNotNull: item.Subtype = ast.AT_DropNotNull - case nodes.AT_SetNotNull: + case nodes.AlterTableType_AT_SetNotNull: item.Subtype = ast.AT_SetNotNull default: @@ -336,10 +331,11 @@ func translate(node nodes.Node) (ast.Node, error) { } return at, nil - case nodes.CommentStmt: + case *nodes.Node_CommentStmt: + n := inner.CommentStmt switch n.Objtype { - case nodes.OBJECT_COLUMN: + case nodes.ObjectType_OBJECT_COLUMN: col, tbl, err := parseColName(n.Object) if err != nil { return nil, fmt.Errorf("COMMENT ON COLUMN: %w", err) @@ -347,135 +343,172 @@ func translate(node nodes.Node) (ast.Node, error) { return &ast.CommentOnColumnStmt{ Col: col, Table: tbl, - Comment: n.Comment, + Comment: makeString(n.Comment), }, nil - case nodes.OBJECT_SCHEMA: - o, ok := n.Object.(nodes.String) + case nodes.ObjectType_OBJECT_SCHEMA: + o, ok := n.Object.Node.(*nodes.Node_String_) if !ok { return nil, fmt.Errorf("COMMENT ON SCHEMA: unexpected node type: %T", n.Object) } return &ast.CommentOnSchemaStmt{ - Schema: &ast.String{Str: o.Str}, - Comment: n.Comment, + Schema: &ast.String{Str: o.String_.Sval}, + Comment: makeString(n.Comment), }, nil - case nodes.OBJECT_TABLE: - name, err := parseTableName(n.Object) + case nodes.ObjectType_OBJECT_TABLE: + rel, err := parseRelation(n.Object) if err != nil { return nil, fmt.Errorf("COMMENT ON TABLE: %w", err) } return &ast.CommentOnTableStmt{ - Table: name, - Comment: n.Comment, + Table: rel.TableName(), + Comment: makeString(n.Comment), }, nil - case nodes.OBJECT_TYPE: - name, err := parseTypeName(n.Object) + case nodes.ObjectType_OBJECT_TYPE: + rel, err := parseRelation(n.Object) if err != nil { return nil, err } return &ast.CommentOnTypeStmt{ - Type: name, - Comment: n.Comment, + Type: rel.TypeName(), + Comment: makeString(n.Comment), + }, nil + + case nodes.ObjectType_OBJECT_VIEW: + rel, err := parseRelation(n.Object) + if err != nil { + return nil, fmt.Errorf("COMMENT ON VIEW: %w", err) + } + return &ast.CommentOnViewStmt{ + View: rel.TableName(), + Comment: makeString(n.Comment), }, nil } return nil, errSkip - case nodes.CompositeTypeStmt: - name, err := parseTypeName(n.Typevar) - if err != nil { - return nil, err - } + case *nodes.Node_CompositeTypeStmt: + n := inner.CompositeTypeStmt + rel := parseRelationFromRangeVar(n.Typevar) return &ast.CompositeTypeStmt{ - TypeName: name, + TypeName: rel.TypeName(), }, nil - case nodes.CreateStmt: - name, err := parseTableName(*n.Relation) - if err != nil { - return nil, err - } + case *nodes.Node_CreateStmt: + n := inner.CreateStmt + rel := parseRelationFromRangeVar(n.Relation) create := &ast.CreateTableStmt{ - Name: name, + Name: rel.TableName(), IfNotExists: n.IfNotExists, } + for _, node := range n.InhRelations { + switch item := node.Node.(type) { + case *nodes.Node_RangeVar: + if item.RangeVar.Inh { + rel := parseRelationFromRangeVar(item.RangeVar) + create.Inherits = append(create.Inherits, rel.TableName()) + } + } + } primaryKey := make(map[string]bool) - for _, elt := range n.TableElts.Items { - switch n := elt.(type) { - case nodes.Constraint: - if n.Contype == nodes.CONSTR_PRIMARY { - for _, item := range n.Keys.Items { - primaryKey[item.(nodes.String).Str] = true + for _, elt := range n.TableElts { + switch item := elt.Node.(type) { + case *nodes.Node_Constraint: + if item.Constraint.Contype == nodes.ConstrType_CONSTR_PRIMARY { + for _, key := range item.Constraint.Keys { + // FIXME: Possible nil pointer dereference + primaryKey[key.Node.(*nodes.Node_String_).String_.Sval] = true } } + + case *nodes.Node_TableLikeClause: + rel := parseRelationFromRangeVar(item.TableLikeClause.Relation) + create.ReferTable = rel.TableName() } } - for _, elt := range n.TableElts.Items { - switch n := elt.(type) { - case nodes.ColumnDef: - tn, err := parseTypeName(n.TypeName) + for _, elt := range n.TableElts { + switch item := elt.Node.(type) { + case *nodes.Node_ColumnDef: + rel, err := parseRelationFromNodes(item.ColumnDef.TypeName.Names) if err != nil { return nil, err } + + primary := false + for _, con := range item.ColumnDef.Constraints { + if constraint, ok := con.Node.(*nodes.Node_Constraint); ok { + primary = constraint.Constraint.Contype == nodes.ConstrType_CONSTR_PRIMARY + } + } + create.Cols = append(create.Cols, &ast.ColumnDef{ - Colname: *n.Colname, - TypeName: tn, - IsNotNull: isNotNull(n) || primaryKey[*n.Colname], - IsArray: isArray(n.TypeName), + Colname: item.ColumnDef.Colname, + TypeName: rel.TypeName(), + IsNotNull: isNotNull(item.ColumnDef) || primaryKey[item.ColumnDef.Colname], + IsArray: isArray(item.ColumnDef.TypeName), + ArrayDims: len(item.ColumnDef.TypeName.ArrayBounds), + PrimaryKey: primary, }) } } return create, nil - case nodes.CreateEnumStmt: - name, err := parseTypeName(n.TypeName) + case *nodes.Node_CreateEnumStmt: + n := inner.CreateEnumStmt + rel, err := parseRelationFromNodes(n.TypeName) if err != nil { return nil, err } stmt := &ast.CreateEnumStmt{ - TypeName: name, + TypeName: rel.TypeName(), Vals: &ast.List{}, } - for _, val := range n.Vals.Items { - switch v := val.(type) { - case nodes.String: + for _, val := range n.Vals { + switch v := val.Node.(type) { + case *nodes.Node_String_: stmt.Vals.Items = append(stmt.Vals.Items, &ast.String{ - Str: v.Str, + Str: v.String_.Sval, }) } } return stmt, nil - case nodes.CreateFunctionStmt: - fn, err := parseFuncName(n.Funcname) + case *nodes.Node_CreateFunctionStmt: + n := inner.CreateFunctionStmt + fn, err := parseRelationFromNodes(n.Funcname) if err != nil { return nil, err } - rt, err := parseTypeName(n.ReturnType) - if err != nil { - return nil, err + var rt *ast.TypeName + if n.ReturnType != nil { + rel, err := parseRelationFromNodes(n.ReturnType.Names) + if err != nil { + return nil, err + } + rt = rel.TypeName() } stmt := &ast.CreateFunctionStmt{ - Func: fn, + Func: fn.FuncName(), ReturnType: rt, Replace: n.Replace, Params: &ast.List{}, + Options: convertSlice(n.Options), } - for _, item := range n.Parameters.Items { - arg := item.(nodes.FunctionParameter) - tn, err := parseTypeName(arg.ArgType) + for _, item := range n.Parameters { + arg := item.Node.(*nodes.Node_FunctionParameter).FunctionParameter + rel, err := parseRelationFromNodes(arg.ArgType.Names) if err != nil { return nil, err } - mode, err := parseFuncParamMode(arg.Mode) + mode, err := convertFuncParamMode(arg.Mode) if err != nil { return nil, err } fp := &ast.FuncParam{ - Name: arg.Name, - Type: tn, + Name: &arg.Name, + Type: rel.TypeName(), Mode: mode, } if arg.Defexpr != nil { @@ -485,118 +518,128 @@ func translate(node nodes.Node) (ast.Node, error) { } return stmt, nil - case nodes.CreateSchemaStmt: + case *nodes.Node_CreateSchemaStmt: + n := inner.CreateSchemaStmt return &ast.CreateSchemaStmt{ - Name: n.Schemaname, + Name: makeString(n.Schemaname), IfNotExists: n.IfNotExists, }, nil - case nodes.DropStmt: + case *nodes.Node_DropStmt: + n := inner.DropStmt switch n.RemoveType { - case nodes.OBJECT_FUNCTION: + case nodes.ObjectType_OBJECT_FUNCTION: drop := &ast.DropFunctionStmt{ MissingOk: n.MissingOk, } - for _, obj := range n.Objects.Items { - owa, ok := obj.(nodes.ObjectWithArgs) + for _, obj := range n.Objects { + nowa, ok := obj.Node.(*nodes.Node_ObjectWithArgs) if !ok { return nil, fmt.Errorf("nodes.DropStmt: FUNCTION: unknown type in objects list: %T", obj) } - fn, err := parseFuncName(owa.Objname) + owa := nowa.ObjectWithArgs + fn, err := parseRelationFromNodes(owa.Objname) if err != nil { return nil, fmt.Errorf("nodes.DropStmt: FUNCTION: %w", err) } - args := make([]*ast.TypeName, len(owa.Objargs.Items)) - for i, objarg := range owa.Objargs.Items { - tn, ok := objarg.(nodes.TypeName) + args := make([]*ast.TypeName, len(owa.Objargs)) + for i, objarg := range owa.Objargs { + tn, ok := objarg.Node.(*nodes.Node_TypeName) if !ok { return nil, fmt.Errorf("nodes.DropStmt: FUNCTION: unknown type in objargs list: %T", objarg) } - at, err := parseTypeName(tn) + at, err := parseRelationFromNodes(tn.TypeName.Names) if err != nil { return nil, fmt.Errorf("nodes.DropStmt: FUNCTION: %w", err) } - args[i] = at + args[i] = at.TypeName() } drop.Funcs = append(drop.Funcs, &ast.FuncSpec{ - Name: fn, + Name: fn.FuncName(), Args: args, HasArgs: !owa.ArgsUnspecified, }) } return drop, nil - case nodes.OBJECT_SCHEMA: + case nodes.ObjectType_OBJECT_SCHEMA: drop := &ast.DropSchemaStmt{ MissingOk: n.MissingOk, } - for _, obj := range n.Objects.Items { - val, ok := obj.(nodes.String) + for _, obj := range n.Objects { + val, ok := obj.Node.(*nodes.Node_String_) if !ok { return nil, fmt.Errorf("nodes.DropStmt: SCHEMA: unknown type in objects list: %T", obj) } - drop.Schemas = append(drop.Schemas, &ast.String{Str: val.Str}) + drop.Schemas = append(drop.Schemas, &ast.String{Str: val.String_.Sval}) } return drop, nil - case nodes.OBJECT_TABLE: + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_VIEW, nodes.ObjectType_OBJECT_MATVIEW: drop := &ast.DropTableStmt{ IfExists: n.MissingOk, } - for _, obj := range n.Objects.Items { - name, err := parseTableName(obj) + for _, obj := range n.Objects { + name, err := parseRelation(obj) if err != nil { return nil, fmt.Errorf("nodes.DropStmt: TABLE: %w", err) } - drop.Tables = append(drop.Tables, name) + drop.Tables = append(drop.Tables, name.TableName()) } return drop, nil - case nodes.OBJECT_TYPE: + case nodes.ObjectType_OBJECT_TYPE: drop := &ast.DropTypeStmt{ IfExists: n.MissingOk, } - for _, obj := range n.Objects.Items { - name, err := parseTypeName(obj) + for _, obj := range n.Objects { + name, err := parseRelation(obj) if err != nil { return nil, fmt.Errorf("nodes.DropStmt: TYPE: %w", err) } - drop.Types = append(drop.Types, name) + drop.Types = append(drop.Types, name.TypeName()) } return drop, nil } return nil, errSkip - case nodes.RenameStmt: + case *nodes.Node_RenameStmt: + n := inner.RenameStmt switch n.RenameType { - case nodes.OBJECT_COLUMN: - tbl, err := parseTableName(*n.Relation) - if err != nil { - return nil, fmt.Errorf("nodes.RenameType: COLUMN: %w", err) - } + case nodes.ObjectType_OBJECT_COLUMN: + rel := parseRelationFromRangeVar(n.Relation) return &ast.RenameColumnStmt{ - Table: tbl, - Col: &ast.ColumnRef{Name: *n.Subname}, - NewName: n.Newname, + Table: rel.TableName(), + Col: &ast.ColumnRef{Name: n.Subname}, + NewName: makeString(n.Newname), + MissingOk: n.MissingOk, }, nil - case nodes.OBJECT_TABLE: - tbl, err := parseTableName(*n.Relation) + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_MATVIEW, nodes.ObjectType_OBJECT_VIEW: + rel := parseRelationFromRangeVar(n.Relation) + return &ast.RenameTableStmt{ + Table: rel.TableName(), + NewName: makeString(n.Newname), + MissingOk: n.MissingOk, + }, nil + + case nodes.ObjectType_OBJECT_TYPE: + rel, err := parseRelation(n.Object) if err != nil { - return nil, fmt.Errorf("nodes.RenameType: TABLE: %w", err) + return nil, fmt.Errorf("nodes.RenameStmt: TYPE: %w", err) } - return &ast.RenameTableStmt{ - Table: tbl, - NewName: n.Newname, + return &ast.RenameTypeStmt{ + Type: rel.TypeName(), + NewName: makeString(n.Newname), }, nil } return nil, errSkip default: - return convert(n) + return convert(node) } } diff --git a/internal/engine/postgresql/parse_default.go b/internal/engine/postgresql/parse_default.go new file mode 100644 index 0000000000..272f189649 --- /dev/null +++ b/internal/engine/postgresql/parse_default.go @@ -0,0 +1,10 @@ +//go:build !windows && cgo + +package postgresql + +import ( + nodes "github.com/pganalyze/pg_query_go/v6" +) + +var Parse = nodes.Parse +var Fingerprint = nodes.Fingerprint diff --git a/internal/engine/postgresql/parse_wasi.go b/internal/engine/postgresql/parse_wasi.go new file mode 100644 index 0000000000..377b812cdb --- /dev/null +++ b/internal/engine/postgresql/parse_wasi.go @@ -0,0 +1,10 @@ +//go:build windows || !cgo + +package postgresql + +import ( + nodes "github.com/wasilibs/go-pgquery" +) + +var Parse = nodes.Parse +var Fingerprint = nodes.Fingerprint diff --git a/internal/engine/postgresql/parse_windows.go b/internal/engine/postgresql/parse_windows.go deleted file mode 100644 index 4645a11c01..0000000000 --- a/internal/engine/postgresql/parse_windows.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build windows - -package postgresql - -import ( - "errors" - "io" - - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/sql/ast" -) - -func NewParser() *Parser { - return &Parser{} -} - -type Parser struct { -} - -func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - return nil, errors.New("the PostgreSQL engine does not support Windows") -} - -// 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/parser/parser_default.go b/internal/engine/postgresql/parser/parser_default.go new file mode 100644 index 0000000000..706c3bb097 --- /dev/null +++ b/internal/engine/postgresql/parser/parser_default.go @@ -0,0 +1,7 @@ +//go:build !windows && cgo + +package parser + +import "github.com/pganalyze/pg_query_go/v6/parser" + +type Error = parser.Error diff --git a/internal/engine/postgresql/parser/parser_wasi.go b/internal/engine/postgresql/parser/parser_wasi.go new file mode 100644 index 0000000000..e172d36c72 --- /dev/null +++ b/internal/engine/postgresql/parser/parser_wasi.go @@ -0,0 +1,7 @@ +//go:build windows || !cgo + +package parser + +import "github.com/wasilibs/go-pgquery/parser" + +type Error = parser.Error diff --git a/internal/engine/postgresql/pg_catalog.go b/internal/engine/postgresql/pg_catalog.go index 9600917006..9000b592f4 100644 --- a/internal/engine/postgresql/pg_catalog.go +++ b/internal/engine/postgresql/pg_catalog.go @@ -3,26653 +3,40610 @@ package postgresql import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func genPGCatalog() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - { - Name: "RI_FKey_cascade_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, +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"}, + }, }, - { - Name: "RI_FKey_cascade_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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[]"}, + }, }, - { - Name: "RI_FKey_check_ins", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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"}, + }, }, - { - Name: "RI_FKey_check_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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"}, + }, }, - { - Name: "RI_FKey_noaction_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + ReturnType: &ast.TypeName{Name: "anyarray"}, + }, + { + Name: "array_larger", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, + }, + { + Type: &ast.TypeName{Name: "anyarray"}, + }, }, - { - Name: "RI_FKey_noaction_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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"}, + }, }, - { - Name: "RI_FKey_restrict_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "array_ndims", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, + }, }, - { - Name: "RI_FKey_restrict_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "array_ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, + }, + { + Type: &ast.TypeName{Name: "anyarray"}, + }, }, - { - Name: "RI_FKey_setdefault_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "array_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, + }, }, - { - Name: "RI_FKey_setdefault_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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"}, + }, }, - { - Name: "RI_FKey_setnull_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + 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"}, + }, }, - { - Name: "RI_FKey_setnull_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, + ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, + }, + { + Name: "array_send", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, + }, }, - { - Name: "abbrev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "text"}, }, - { - Name: "abbrev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, + ReturnType: &ast.TypeName{Name: "anyarray"}, + }, + { + Name: "array_to_json", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyarray"}, }, - ReturnType: &ast.TypeName{Name: "text"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "smallint"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "bigint"}, }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, + ReturnType: &ast.TypeName{Name: "box"}, + }, + { + Name: "box", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "circle"}, }, - ReturnType: &ast.TypeName{Name: "real"}, }, - { - Name: "aclcontains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, + 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: "boolean"}, }, - { - Name: "acldefault", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "aclitem[]"}, }, - { - Name: "aclinsert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, + 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: "aclitem[]"}, }, - { - Name: "aclitemeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, + ReturnType: &ast.TypeName{Name: "character"}, + }, + { + Name: "bpcharcmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "aclitemin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "bpchareq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "aclitem"}, }, - { - Name: "aclitemout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "aclremove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpchargt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "aclitem[]"}, }, - { - Name: "acos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpchariclike", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "acosd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharicnlike", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "acosh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharicregexeq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharicregexne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "interval"}, }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, + 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: "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: "character"}, + }, + { + Name: "bpcharle", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "interval"}, }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharlike", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - 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: "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: "interval"}, }, - { - Name: "amvalidate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "any_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "bpcharout", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "character"}, }, - ReturnType: &ast.TypeName{Name: "any"}, }, - { - Name: "any_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, + 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: "cstring"}, }, - { - Name: "anyarray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "anyarray"}, }, - { - Name: "anyarray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint24cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "anyarray_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint28cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, - { - Name: "anyelement_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint2cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - ReturnType: &ast.TypeName{Name: "anyelement"}, }, - { - Name: "anyelement_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint42cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "anyenum_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint48cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "anyenum"}, }, - { - Name: "anyenum_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint4cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "anynonarray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint82cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - ReturnType: &ast.TypeName{Name: "anynonarray"}, }, - { - Name: "anynonarray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btint84cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "integer"}, + }, + { + Name: "btint8cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "anyrange"}, }, - { - Name: "anyrange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btnamecmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "anytextcat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btnametextcmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "text"}, }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btoidcmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oid"}, + }, + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btoidvectorcmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oidvector"}, + }, + { + Type: &ast.TypeName{Name: "oidvector"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btrecordcmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "record"}, + }, + { + Type: &ast.TypeName{Name: "record"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "array_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btrecordimagecmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "record"}, + }, + { + Type: &ast.TypeName{Name: "record"}, }, - ReturnType: &ast.TypeName{Name: "anyarray"}, }, - { - Name: "array_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "btrim", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "bytea"}, }, - ReturnType: &ast.TypeName{Name: "anyarray"}, }, - { - Name: "array_append", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "anyarray"}, }, - { - Name: "array_cat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "anyarray"}, }, - { - Name: "array_dims", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "byteane", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "bytea"}, }, - 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: "byteanlike", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "bytea"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - 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: "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: "anyarray"}, }, - { - Name: "array_fill", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, + 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: "anyarray"}, }, - { - Name: "array_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "boolean"}, }, - { - Name: "array_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "array_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "anyarray"}, }, - { - Name: "array_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "cash_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - 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: "money"}, + }, + { + Name: "cash_le", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "money"}, + }, + { + Type: &ast.TypeName{Name: "money"}, }, - 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: "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: "integer"}, }, - { - Name: "array_lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "array_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "boolean"}, }, - { - Name: "array_ndims", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "integer"}, }, - { - Name: "array_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "boolean"}, }, - { - Name: "array_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "cstring"}, }, - { - Name: "array_position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "array_position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "integer"}, }, - { - Name: "array_positions", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "integer[]"}, }, - { - Name: "array_prepend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "anyarray"}, }, - { - Name: "array_remove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "anyarray"}, }, - { - Name: "array_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "anyarray"}, }, - { - Name: "array_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "bytea"}, }, - { - Name: "array_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "anyarray"}, }, - { - Name: "array_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "json"}, }, - { - Name: "array_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "date_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - ReturnType: &ast.TypeName{Name: "json"}, }, - { - 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: "date"}, + }, + { + Name: "date_larger", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "date"}, + }, + { + Type: &ast.TypeName{Name: "date"}, }, - ReturnType: &ast.TypeName{Name: "text"}, }, - { - Name: "array_to_string", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "text"}, }, - { - Name: "array_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, + 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: "tsvector"}, }, - { - Name: "array_upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "arraycontained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "arraycontains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "boolean"}, }, - { - Name: "arrayoverlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "boolean"}, }, - { - Name: "ascii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "integer"}, }, - { - Name: "asin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "asind", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "asinh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "date_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "date"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "atan", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "atan2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "atan2d", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "atand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "atanh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "numeric"}, }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "numeric"}, }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, + 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: "interval"}, }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "numeric"}, }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, + 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: "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: "double precision"}, + }, + { + Name: "dist_sl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "lseg"}, }, - 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"}, - }, + { + Type: &ast.TypeName{Name: "line"}, }, - 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: "double precision"}, + }, + { + Name: "dist_sp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "lseg"}, }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_heap_pg_class_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + { + Type: &ast.TypeName{Name: "point"}, }, - 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: "double precision"}, + }, + { + Name: "div", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "numeric"}, + }, + { + Type: &ast.TypeName{Name: "numeric"}, }, - 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: "numeric"}, + }, + { + Name: "dlog1", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "double precision"}, }, - 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: "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: "void"}, }, - { - Name: "binary_upgrade_set_next_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "void"}, }, - { - Name: "binary_upgrade_set_next_toast_pg_class_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "void"}, }, - { - Name: "binary_upgrade_set_next_toast_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "void"}, }, - { - Name: "binary_upgrade_set_record_init_privs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "void"}, }, - { - Name: "bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "bit"}, }, - { - Name: "bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "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: "double precision"}, + }, + { + Name: "float84ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "double precision"}, + }, + { + Type: &ast.TypeName{Name: "real"}, }, - ReturnType: &ast.TypeName{Name: "bit"}, }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "bigint"}, }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "smallint"}, }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - 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: "bigint"}, + }, + { + Name: "generate_series", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + 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: "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: "bit_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "integer"}, }, - { - Name: "bit_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "integer"}, }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "smallint"}, }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "bigint"}, }, - { - Name: "bit_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "cstring"}, }, - { - Name: "bit_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bytea"}, }, - { - Name: "bitand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - Name: "bitcat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, + 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: "bit varying"}, }, - { - Name: "bitcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "integer"}, }, - { - Name: "biteq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bitnot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - Name: "bitor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - Name: "bitshiftleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "bit"}, }, - { - Name: "bitshiftright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "bit"}, }, - { - Name: "bittypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, + 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: "integer"}, }, - { - Name: "bittypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "cstring"}, }, - { - Name: "bitxor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, + 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: "bit"}, }, - { - Name: "bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, + 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: "bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "bool_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "bool_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "has_foreign_data_wrapper_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "booland_statefunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "has_function_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + { + Type: &ast.TypeName{Name: "oid"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "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: "boolin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "boolle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "boollt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "boolne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "boolor_statefunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "boolout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "cstring"}, }, - { - Name: "boolsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "bytea"}, }, - { - Name: "bound_box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box"}, }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, + 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: "box"}, }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box"}, }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box"}, }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "box"}, }, - { - Name: "box_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_above_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box"}, }, - { - Name: "box_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_below_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "point"}, }, - { - Name: "box_contain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_contain_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "double precision"}, }, - { - Name: "box_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box"}, }, - { - Name: "box_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "box"}, }, - { - Name: "box_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box"}, }, - { - Name: "box_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "box"}, }, - { - Name: "box_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "cstring"}, }, - { - Name: "box_overabove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_overbelow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "box_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "box_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "box_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "character"}, }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_pattern_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oid"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_pattern_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "character"}, }, - { - Name: "bpcharcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "has_tablespace_privilege", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bpchareq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "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: "bpchargt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "bpchariclike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - 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: "bpcharicnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - 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: "bpcharicregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - 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: "bpcharicregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - 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: "bpcharin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "hash_aclitem", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "aclitem"}, }, - ReturnType: &ast.TypeName{Name: "character"}, }, - { - Name: "bpcharle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "boolean"}, }, - { - Name: "bpcharlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "boolean"}, }, - { - Name: "bpcharlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "hashtid", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "tid"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "bpcharne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "hashtidextended", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "tid"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "bpcharnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "height", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "box"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "bpcharout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + ReturnType: &ast.TypeName{Name: "double precision"}, + }, + { + Name: "host", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "inet"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "bpcharregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "hostmask", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "inet"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "bpcharregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "bpcharsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "bytea"}, }, - { - Name: "bpchartypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, + 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: "integer"}, }, - { - Name: "bpchartypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "cstring"}, }, - { - Name: "brin_desummarize_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "void"}, }, - { - Name: "brin_summarize_new_values", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, + 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: "integer"}, }, - { - Name: "brin_summarize_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "integer"}, }, - { - Name: "broadcast", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "inet"}, }, - { - Name: "btarraycmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "integer"}, }, - { - Name: "btboolcmp", - Args: []*catalog.Argument{ - { - 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: "integer"}, }, - { - Name: "btbpchar_pattern_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "integer"}, }, - { - Name: "btcharcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "integer"}, }, - { - Name: "btfloat48cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "integer"}, }, - { - Name: "btfloat4cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, + 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: "integer"}, }, - { - Name: "btfloat84cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, + 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: "integer"}, }, - { - Name: "btfloat8cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "integer"}, }, - { - Name: "btint24cmp", - 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: "btint28cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "int24ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btint2cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "btint42cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "int28div", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btint48cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - 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: "integer"}, }, - { - Name: "btint4cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int28ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btint82cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int28gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btint84cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int28le", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btint8cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - 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: "integer"}, }, - { - Name: "btnamecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int28mi", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btnametextcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int28mul", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btoidcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int28ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btoidvectorcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int28pl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "smallint"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "btrecordcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, + 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: "integer"}, }, - { - Name: "btrecordimagecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, + 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: "integer"}, }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "text"}, }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "text"}, }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "bytea"}, }, - { - Name: "bttext_pattern_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "bttextcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "int42ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "bttextnamecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "bttidcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "int48div", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "byteacat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int48eq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, - { - Name: "byteacmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int48ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - 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: "int48gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - 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: "int48le", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - 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: "int48lt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "byteain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int48mi", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, - { - Name: "byteale", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int48mul", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "bytealike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "bytealt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int48pl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "integer"}, + }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "byteane", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "boolean"}, }, - { - Name: "byteanlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "boolean"}, }, - { - Name: "byteaout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "cstring"}, }, - { - Name: "byteasend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "bytea"}, }, - { - Name: "cardinality", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "integer"}, }, - { - Name: "cash_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "integer"}, }, - { - Name: "cash_div_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "double precision"}, }, - { - Name: "cash_div_flt4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int82ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - 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: "boolean"}, + }, + { + Name: "int82pl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "smallint"}, }, - 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: "bigint"}, + }, + { + Name: "int84div", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "bigint"}, + }, + { + Name: "int84eq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + 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: "boolean"}, + }, + { + Name: "int84ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "int84gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "int84le", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "int84lt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "cash_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "int84mi", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "bigint"}, + }, + { + Name: "int84mul", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "bigint"}, + }, + { + Name: "int84ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "boolean"}, + }, + { + Name: "int84pl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "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: "money"}, }, - { - Name: "cash_mul_flt8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "money"}, }, - { - Name: "cash_mul_int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "int8inc", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bigint"}, }, - 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: "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: "money"}, }, - { - Name: "cash_mul_int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - 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: "money"}, }, - { - Name: "cash_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "interval_hash", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "interval"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "cash_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "cstring"}, }, - { - Name: "cash_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "money"}, }, - { - Name: "cash_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "bytea"}, }, - { - Name: "cash_words", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "text"}, }, - { - Name: "cashlarger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "money"}, }, - { - Name: "cashsmaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "money"}, }, - { - Name: "cbrt", - Args: []*catalog.Argument{ - { - 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: "double precision"}, }, - { - Name: "ceil", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "interval_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "interval"}, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, - { - Name: "ceil", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "ceiling", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "ceiling", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "length", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, - { - Name: "center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "point"}, }, - { - Name: "center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "line", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "point"}, + }, + { + Type: &ast.TypeName{Name: "point"}, }, - ReturnType: &ast.TypeName{Name: "point"}, }, - { - Name: "char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "char"}, }, - { - Name: "char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "char"}, }, - { - Name: "char_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "integer"}, }, - { - Name: "char_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "integer"}, }, - { - Name: "character_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "character_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "chareq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "boolean"}, }, - { - Name: "charge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "chargt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "boolean"}, }, - { - Name: "charin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "char"}, }, - { - Name: "charle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "ltrim", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "bytea"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "charlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "boolean"}, }, - { - Name: "charne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "boolean"}, }, - { - Name: "charout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "cstring"}, }, - { - Name: "charsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, + 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: "bytea"}, }, - { - Name: "chr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "text"}, }, - { - Name: "cideq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, - { - Type: &ast.TypeName{Name: "cid"}, - }, + 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: "cidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "cid"}, }, - { - Name: "cidout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, + 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: "cstring"}, }, - { - Name: "cidr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "cidr"}, }, - { - Name: "cidr_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "cidr"}, }, - { - Name: "cidr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, + 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: "cstring"}, }, - { - Name: "cidr_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, + 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: "bytea"}, }, - { - Name: "cidsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, + 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: "bytea"}, }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "circle"}, }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "circle"}, }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, + 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: "circle"}, }, - { - Name: "circle_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_add_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "circle"}, }, - { - Name: "circle_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "point"}, }, - { - Name: "circle_contain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "multirange_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anymultirange"}, }, - 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: "cstring"}, + }, + { + Name: "multirange_overlaps_multirange", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anymultirange"}, + }, + { + Type: &ast.TypeName{Name: "anymultirange"}, }, - 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: "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: "circle_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "nameicregexeq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "boolean"}, + }, + { + Name: "nameicregexne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "namein", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - 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: "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: "circle_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + ReturnType: &ast.TypeName{Name: "cstring"}, + }, + { + Name: "nameregexeq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "nameregexne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "name"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "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: "boolean"}, }, - { - Name: "circle_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_mul_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "circle"}, }, - { - Name: "circle_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "cstring"}, }, - { - Name: "circle_overabove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_overbelow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "boolean"}, }, - { - Name: "circle_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "circle_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, + 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: "bytea"}, }, - { - Name: "circle_sub_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, + 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: "circle"}, }, - { - Name: "clock_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, + 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"}, + }, }, - { - Name: "close_lb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, + 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: "point"}, }, - { - Name: "close_ls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, + ReturnType: &ast.TypeName{Name: "oidvector"}, + }, + { + Name: "oidvectorle", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oidvector"}, + }, + { + Type: &ast.TypeName{Name: "oidvector"}, }, - 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: "boolean"}, + }, + { + Name: "oidvectorlt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oidvector"}, + }, + { + Type: &ast.TypeName{Name: "oidvector"}, }, - 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: "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: "point"}, }, - { - Name: "close_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, + ReturnType: &ast.TypeName{Name: "bytea"}, + }, + { + Name: "oidvectortypes", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "oidvector"}, }, - 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: "text"}, + }, + { + Name: "on_pb", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "point"}, + }, + { + Type: &ast.TypeName{Name: "box"}, }, - 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: "boolean"}, + }, + { + Name: "on_pl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "point"}, + }, + { + Type: &ast.TypeName{Name: "line"}, }, - ReturnType: &ast.TypeName{Name: "point"}, }, - { - Name: "close_sl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - 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: "point"}, }, - { - Name: "col_description", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "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: "boolean"}, + }, + { + Name: "on_sb", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "lseg"}, + }, + { + Type: &ast.TypeName{Name: "box"}, }, - 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: "boolean"}, + }, + { + Name: "on_sl", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "lseg"}, }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "convert_to", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + { + Type: &ast.TypeName{Name: "line"}, }, - 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: "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: "double precision"}, }, - { - Name: "cos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "cosd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "cosh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "cot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "cotd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, + 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: "bigint"}, }, - { - Name: "count", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, + 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"}, + }, }, - { - Name: "covar_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "covar_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "cstring_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "cstring"}, }, - { - Name: "cstring_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "cstring"}, }, - { - Name: "cstring_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "bytea"}, }, - { - Name: "cume_dist", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, + 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"}, + }, }, - { - Name: "current_database", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, + 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"}, + }, }, - { - Name: "current_query", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, + 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"}, + }, }, - { - Name: "current_schema", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, + 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"}, + }, }, - { - Name: "current_schemas", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "name[]"}, }, - { - Name: "current_setting", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, + 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: "current_setting", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "current_user", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, + ReturnType: &ast.TypeName{Name: "text[]"}, + }, + { + Name: "path", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "polygon"}, + }, }, - { - Name: "currtid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, + 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: "tid"}, }, - { - Name: "currtid2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, + 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: "tid"}, }, - { - Name: "currval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, + 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: "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: "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: "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: "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: "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: "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: "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: "point"}, + }, + { + Name: "point_ne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "point"}, + }, + { + Type: &ast.TypeName{Name: "point"}, }, - 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: "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: "xml"}, }, - { - Name: "date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, + 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: "date"}, }, - { - Name: "date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, + 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: "date"}, }, - { - Name: "date_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "boolean"}, + }, + { + Name: "poly_overbelow", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "polygon"}, + }, + { + Type: &ast.TypeName{Name: "polygon"}, }, - 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: "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: "integer"}, }, - { - Name: "date_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "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: "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: "range_ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyrange"}, + }, + { + Type: &ast.TypeName{Name: "anyrange"}, }, - 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: "range_gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyrange"}, + }, + { + Type: &ast.TypeName{Name: "anyrange"}, }, - 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: "range_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, + }, + { + Type: &ast.TypeName{Name: "oid"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "anyrange"}, + }, + { + Name: "range_intersect", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyrange"}, + }, + { + Type: &ast.TypeName{Name: "anyrange"}, }, - 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: "anyrange"}, + }, + { + Name: "range_intersect_agg", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anymultirange"}, }, - 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: "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"}, }, - 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"}, - }, + { + Type: &ast.TypeName{Name: "anyrange"}, + }, + }, + ReturnType: &ast.TypeName{Name: "anyrange"}, + }, + { + Name: "range_minus", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "anyrange"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + { + 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: "date"}, }, - { - Name: "date_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "date"}, }, - { - Name: "date_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "record_image_ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "record"}, + }, + { + Type: &ast.TypeName{Name: "record"}, }, - 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: "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: "date_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "record_in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, + }, + { + Type: &ast.TypeName{Name: "oid"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - 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: "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: "boolean"}, }, - { - Name: "date_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "date_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, + 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: "timestamp without time zone"}, }, - { - Name: "date_mii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - 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: "date"}, }, - { - Name: "date_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "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: "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: "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: "boolean"}, }, - { - Name: "date_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "cstring"}, }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, + 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: "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: "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: "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: "integer"}, + }, + { + Name: "regexp_like", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - 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: "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: "double precision"}, }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "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: "double precision"}, }, - { - Name: "date_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, + 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: "timestamp without time zone"}, }, - { - Name: "date_pli", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "date"}, }, - { - Name: "date_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "bytea"}, }, - { - Name: "date_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "date"}, }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, + 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: "timestamp without time zone"}, }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, + 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: "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: "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: "timestamp with time zone"}, }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, + 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: "interval"}, }, - { - Name: "daterange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "text[]"}, + }, + { + Name: "regexp_split_to_table", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + 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: "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: "daterange"}, }, - { - Name: "daterange_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "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: "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: "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: "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: "timestamp with time zone"}, }, - { - Name: "dcbrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "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: "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_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_lb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - 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_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: "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_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: "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: "smallint"}, - }, - }, - 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: "bigint"}, - }, - }, - 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: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - 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: "smallint"}, - }, - }, - 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: "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: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - 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_type", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - 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: "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_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: "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: "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_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: "generate_subscripts", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - 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: "integer"}, - }, - }, - 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_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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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"}, - }, - { - 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: "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: "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_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: "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: "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: "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: "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: "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"}, - }, - { - 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: "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: "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: "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_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: "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: "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: "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: "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: "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"}, - }, - { - 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_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: "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_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"}, - }, - { - 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_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: "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: "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: "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"}, - }, - { - 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_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: "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: "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: "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: "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: "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: "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: "oid"}, - }, - { - 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_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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "numeric"}, - }, - }, - 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: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - 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: "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: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - 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: "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: "real"}, - }, - }, - 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: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - 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: "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"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int4range"}, - }, - { - Name: "int4range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - 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: "double precision"}, - }, - }, - 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: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - 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: "oid"}, - }, - }, - 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: "jsonb"}, - }, - }, - 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: "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: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - 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: "isclosed", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - 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: "timestamp with time zone"}, - }, - }, - 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: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isfinite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - 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: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - 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: "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: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - 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: "line"}, - }, - }, - 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_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - 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{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - 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: "regconfig"}, - }, - { - 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: "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_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_object", - Args: []*catalog.Argument{}, - 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_path", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - 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_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[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_object", - Args: []*catalog.Argument{ - { - 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_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_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_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_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_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: "regconfig"}, - }, - { - 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: "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: "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: "lag", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - 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: "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"}, - }, - { - 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: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - 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: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - 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: "tsvector"}, - }, - }, - 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: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - 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"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - 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_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"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_import", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - 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: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - 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: "log10", - Args: []*catalog.Argument{ - { - 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: "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: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - 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: "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: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lseg"}, - }, - { - Name: "lseg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - 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: "text"}, - }, - { - 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: "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: "text"}, + }, + { + Name: "regexp_substr", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "macaddr"}, }, - { - Name: "macaddr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "regnamespacein", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, - { - Name: "macaddr_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, + ReturnType: &ast.TypeName{Name: "regnamespace"}, + }, + { + Name: "regnamespaceout", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "regnamespace"}, }, - 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: "cstring"}, + }, + { + Name: "regnamespacesend", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "regnamespace"}, }, - 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: "bytea"}, + }, + { + Name: "regoperatorin", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - 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: "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"}, }, - 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"}, - }, + { + 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"}, }, - 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"}, - }, - { - Name: "timezone", - Type: &ast.TypeName{Name: "text"}, - }, + { + Type: &ast.TypeName{Name: "boolean"}, }, - 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"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "set_masklen", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cidr"}, }, - 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"}, - }, + { + 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: "aclitem"}, }, - { - Name: "masklen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + ReturnType: &ast.TypeName{Name: "inet"}, + }, + { + Name: "setseed", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "double precision"}, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, + ReturnType: &ast.TypeName{Name: "void"}, + }, + { + Name: "setval", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "regclass"}, }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + { + Type: &ast.TypeName{Name: "bigint"}, }, - ReturnType: &ast.TypeName{Name: "inet"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, + ReturnType: &ast.TypeName{Name: "bigint"}, + }, + { + Name: "setval", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "regclass"}, }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + { + 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: "integer"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "smallint"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "strip", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "tsvector"}, }, - ReturnType: &ast.TypeName{Name: "oid"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, + ReturnType: &ast.TypeName{Name: "tsvector"}, + }, + { + Name: "strpos", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "real"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + ReturnType: &ast.TypeName{Name: "integer"}, + }, + { + Name: "substr", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, + 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: "date"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, + ReturnType: &ast.TypeName{Name: "bytea"}, + }, + { + Name: "substr", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, + 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: "time with time zone"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "substring", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bit"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "money"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, + 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: "timestamp without time zone"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, + ReturnType: &ast.TypeName{Name: "bit"}, + }, + { + Name: "substring", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "bytea"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "interval"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "text"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + ReturnType: &ast.TypeName{Name: "bytea"}, + }, + { + Name: "substring", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "integer"}, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "anyarray"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "character"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, + 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: "tid"}, }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "bigint"}, }, - { - Name: "md5", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "md5", - Args: []*catalog.Argument{ - { - 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: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "textcat", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "texteq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "interval"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "texteqname", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "character"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "textgename", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "smallint"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "textgtname", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "name"}, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "texticlike", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "oid"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - 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: "text"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "texticregexeq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "texticregexne", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "inet"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "time_hash", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "time without time zone"}, }, - ReturnType: &ast.TypeName{Name: "money"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, + 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: "timestamp without time zone"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, + 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: "real"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, + 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: "anyarray"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, + 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: "anyenum"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "double precision"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, + 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: "tid"}, }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "timestamp_hash", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "timestamp without time zone"}, }, - ReturnType: &ast.TypeName{Name: "date"}, }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - 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: "bigint"}, }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "smallint"}, }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "mode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, + 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: "anyelement"}, }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "money"}, }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "money"}, }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "money"}, }, - { - Name: "mul_d_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, + 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: "interval"}, }, - { - Name: "mxid_age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, + 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: "integer"}, }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character varying"}, - }, + 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: "name"}, }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "name"}, }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, + 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: "name"}, }, - { - Name: "nameconcatoid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, + 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: "name"}, }, - { - Name: "nameeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "nameeqtext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "namegetext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namegt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "namegttext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "timestamptz_gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "timestamp with time zone"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameiclike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + { + Type: &ast.TypeName{Name: "timestamp with time zone"}, }, - 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: "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: "nameicregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "nameicregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "boolean"}, }, - { - Name: "namein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + 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: "name"}, }, - { - Name: "namele", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "nameletext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namelike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namelt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "namelttext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namene", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "namenetext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "boolean"}, }, - { - Name: "namenlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "boolean"}, }, - { - Name: "nameout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "cstring"}, }, - { - Name: "nameregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "boolean"}, }, - { - Name: "nameregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, + 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: "namesend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, + 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: "bytea"}, }, - { - Name: "netmask", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "inet"}, }, - { - Name: "network", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "cidr"}, }, - { - Name: "network_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "timetz_out", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "time with time zone"}, }, - 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: "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: "boolean"}, }, - { - Name: "network_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "inet"}, }, - { - Name: "network_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "inet"}, }, - { - Name: "network_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_subeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_sup", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "network_supeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, + 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: "boolean"}, }, - { - Name: "nextval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, + 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: "bigint"}, }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - 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"}, + }, + { + Type: &ast.TypeName{Name: "text"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - 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: "boolean"}, }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, + 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: "boolean"}, }, - { - Name: "now", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, + ReturnType: &ast.TypeName{Name: "text"}, + }, + { + Name: "ts_headline", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "text"}, + }, + { + Type: &ast.TypeName{Name: "tsquery"}, + }, }, - { - Name: "npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, + 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: "integer"}, }, - { - Name: "npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, + 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: "integer"}, }, - { - Name: "nth_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "anyelement"}, }, - { - Name: "ntile", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "integer"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, + 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: "numeric"}, }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "integer"}, }, - { - Name: "numeric_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_div_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric_exp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_fac", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "boolean"}, }, - { - Name: "numeric_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + ReturnType: &ast.TypeName{Name: "xid8"}, + }, + { + Name: "xid8cmp", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "xid8"}, + }, + { + Type: &ast.TypeName{Name: "xid8"}, }, - 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: "integer"}, + }, + { + Name: "xid8eq", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "xid8"}, + }, + { + Type: &ast.TypeName{Name: "xid8"}, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, - { - Name: "numeric_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, + { + Name: "xid8ge", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "xid8"}, + }, + { + Type: &ast.TypeName{Name: "xid8"}, }, - 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: "boolean"}, + }, + { + Name: "xid8gt", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "xid8"}, + }, + { + Type: &ast.TypeName{Name: "xid8"}, }, - 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: "xid8in", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "cstring"}, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, - { - Name: "numeric_ln", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_log", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, - { - Name: "numeric_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric_mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, + 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: "numeric"}, }, + ReturnType: &ast.TypeName{Name: "boolean"}, + }, +} + +func genPGCatalog() *catalog.Schema { + s := &catalog.Schema{Name: "pg_catalog"} + s.Funcs = funcsgenPGCatalog + s.Tables = []*catalog.Table{ { - Name: "numeric_mul", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_aggregate", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "numeric_power", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggfnoid", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggkind", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "numeric_smaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggnumdirectargs", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggtransfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_sqrt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggfinalfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_sub", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggcombinefn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggserialfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_uminus", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggdeserialfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_uplus", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggmtransfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numerictypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "aggminvtransfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numerictypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "aggmfinalfn", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "numnode", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "aggfinalextra", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggmfinalextra", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggfinalmodify", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "aggmfinalmodify", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "numrange"}, - }, - { - Name: "numrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggsortop", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggtranstype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numrange"}, - }, - { - Name: "numrange_subdiff", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggtransspace", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "aggmtranstype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "obj_description", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "aggmtransspace", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "agginitval", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "obj_description", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "aggminitval", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "octet_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_am", }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "character"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "oid", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oideq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "amname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidgt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "amhandler", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "amtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "oidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_amop", }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidlarger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidle", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidlt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "amopfamily", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "oidsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "amoplefttype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "oidsmaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "amoprighttype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "amopstrategy", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidvectoreq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amoppurpose", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amopopr", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amopmethod", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amopsortfamily", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "oidvectorgt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_amproc", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "oidvector"}, - }, - { - Name: "oidvectorle", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorlt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amprocfamily", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amproclefttype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amprocrighttype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "oidvectorsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amprocnum", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "oidvectortypes", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oidvector"}, + Name: "amproc", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "on_pb", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_attrdef", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "point"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "box"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_pl", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "line"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_ppath", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_ps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "lseg"}, + Name: "adrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_sb", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "lseg"}, + Name: "adnum", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "box"}, + Name: "adbin", + Type: ast.TypeName{Name: "pg_node_tree"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "on_sl", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_attribute", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "lseg"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "line"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "opaque_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "opaque"}, - }, - { - Name: "opaque_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "opaque"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "attrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "atttypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "attstattarget", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "attlen", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "attnum", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "attndims", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attcacheoff", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "atttypmod", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attbyval", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attalign", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attstorage", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attcompression", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attnotnull", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "atthasdef", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "atthasmissing", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attidentity", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attgenerated", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attisdropped", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attislocal", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attinhcount", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "attcollation", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attfdwoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "attmissingval", + Type: ast.TypeName{Name: "anyarray"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "overlaps", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_auth_members", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "roleid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + 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), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "overlaps", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_authid", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "rolname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "rolsuper", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "rolinherit", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "rolcreaterole", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "rolcreatedb", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), + }, + { + Name: "rolcanlogin", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "rolreplication", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "rolbypassrls", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "rolconnlimit", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "rolpassword", + Type: ast.TypeName{Name: "text"}, + }, + { + Name: "rolvaliduntil", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "overlay", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_available_extension_versions", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "name", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "version", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "installed", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "superuser", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), + }, + { + Name: "trusted", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "relocatable", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "bytea"}, + Name: "schema", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "requires", + Type: ast.TypeName{Name: "_name"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "comment", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "overlay", - Args: []*catalog.Argument{ + 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), + }, { - Type: &ast.TypeName{Name: "bit"}, + Name: "default_version", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "bit"}, + Name: "installed_version", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "comment", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bit"}, }, { - Name: "overlay", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_backend_memory_contexts", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ident", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit"}, + Name: "total_nblocks", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "bit"}, + Name: "free_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "free_chunks", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "used_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bit"}, }, { - Name: "overlay", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_cast", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bytea"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "parse_ident", - Args: []*catalog.Argument{ { - Name: "str", - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "strict", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "path", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_add", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "castsource", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_add_pt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "casttarget", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "castfunc", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "castcontext", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_center", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "castmethod", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "point"}, }, { - Name: "path_contain_pt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_class", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "path"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_distance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "path_div_pt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_inter", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_length", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "reltype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "path_mul_pt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "reloftype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "relowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_n_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relam", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relfilenode", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "reltablespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relpages", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "reltuples", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relallvisible", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "reltoastrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relhasindex", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relisshared", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "path"}, + Name: "relpersistence", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_npoints", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relkind", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "path_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relnatts", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "path_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relchecks", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "path_sub_pt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relhasrules", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "relhastriggers", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "pclose", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "relhassubclass", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "percent_rank", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "relrowsecurity", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "relforcerowsecurity", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision[]"}, + Name: "relispopulated", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "relreplident", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "relispartition", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "relrewrite", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision[]"}, + Name: "relfrozenxid", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "relminmxid", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "relacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "interval[]"}, - }, - { - Name: "percentile_disc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "reloptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "relpartbound", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "anyelement"}, }, { - Name: "percentile_disc", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_collation", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "double precision[]"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "pg_advisory_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "collname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_unlock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "collnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "collowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_unlock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "collprovider", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - 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"}, + Name: "collisdeterministic", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_unlock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "collencoding", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "collcollate", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_xact_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "collctype", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "colliculocale", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_xact_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "collversion", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "void"}, }, { - Name: "pg_advisory_xact_lock_shared", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_config", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "setting", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "void"}, }, { - Name: "pg_advisory_xact_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_constraint", }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_backend_pid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_backup_start_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_blocking_pids", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "pg_cancel_backend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_char_to_encoding", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_collation_for", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "any"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_collation_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_column_is_updatable", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "smallint"}, + Name: "conname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "connamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_column_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "any"}, + Name: "contype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_conf_load_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_conversion_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "condeferrable", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_create_restore_point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "condeferred", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_current_logfile", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "convalidated", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_current_logfile", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - 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_database_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "conrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_database_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "contypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_ddl_command_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "conindid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "pg_ddl_command"}, - }, - { - Name: "pg_ddl_command_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_ddl_command"}, + Name: "conparentid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_ddl_command_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_ddl_command"}, + Name: "confrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_dependencies_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "confupdtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "pg_dependencies"}, - }, - { - Name: "pg_dependencies_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_dependencies"}, + Name: "confdeltype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_dependencies_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_dependencies"}, + Name: "confmatchtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_describe_object", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "conislocal", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "coninhcount", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "connoinherit", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_drop_replication_slot", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "conkey", + Type: ast.TypeName{Name: "_int2"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_encoding_max_length", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "confkey", + Type: ast.TypeName{Name: "_int2"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_encoding_to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "conpfeqop", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - 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"}, + Name: "conppeqop", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "conffeqop", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_file_rename", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "confdelsetcols", + Type: ast.TypeName{Name: "_int2"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "conexclop", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "conbin", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_file_rename", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_conversion", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_file_unlink", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_file_write", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_filenode_relation", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "conname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_function_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "connamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_get_constraintdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "conowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "conforencoding", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_constraintdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "contoencoding", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "conproc", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "condefault", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "pg_get_expr", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_cursors", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_node_tree"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "statement", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "is_holdable", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), + }, + { + Name: "is_binary", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_expr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_node_tree"}, + Name: "is_scrollable", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "creation_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "pg_get_function_arg_default", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_database", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_arguments", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_identity_arguments", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_result", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_functiondef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_indexdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "datdba", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_indexdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "encoding", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_partition_constraintdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datlocprovider", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_partkeydef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datistemplate", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_replica_identity_index", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "datallowconn", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_get_ruledef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datconnlimit", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "datfrozenxid", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_ruledef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datminmxid", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_serial_sequence", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "dattablespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "datcollate", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_statisticsobjdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datctype", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_triggerdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "daticulocale", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_triggerdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "datcollversion", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "datacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "pg_get_userbyid", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_db_role_setting", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "setdatabase", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "setrole", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "setconfig", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "pg_has_role", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_default_acl", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "name"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "defaclrole", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "defaclnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "defaclobjtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "defaclacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsNotNull: true, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_has_role", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_depend", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_import_system_collations", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regnamespace"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_index_column_has_property", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "classid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "objid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_index_has_property", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "refclassid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "refobjid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_indexam_has_property", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "refobjsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "deptype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_indexam_progress_phasename", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_description", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_indexes_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_is_in_backup", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - 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"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer[]"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), + }, + { + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_jit_available", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - 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_logdir_ls", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_logical_emit_message", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "boolean"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "description", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, }, { - Name: "pg_logical_emit_message", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_enum", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "boolean"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bytea"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_ls_dir", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_ls_dir", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "enumtypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_lsn_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "enumsortorder", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "enumlabel", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, { - Name: "pg_lsn_eq", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_event_trigger", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_hash", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_lsn_hash_extended", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "evtname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "evtevent", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_lsn_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "evtowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "evtfoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "evtenabled", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), + }, + { + Name: "evttags", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_lsn_lt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_extension", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_mi", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "pg_lsn_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_lsn_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "extname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_mcv_list_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "extowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "pg_mcv_list"}, - }, - { - Name: "pg_mcv_list_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_mcv_list"}, + Name: "extnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_mcv_list_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_mcv_list"}, + 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, }, - }, - 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"}, + Name: "extcondition", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "pg_ndistinct"}, }, { - Name: "pg_ndistinct_out", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_file_settings", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_ndistinct"}, + Name: "sourcefile", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_ndistinct_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_ndistinct"}, + Name: "sourceline", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_nextoid", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "seqno", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "regclass"}, + Name: "setting", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_node_tree_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "applied", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "pg_node_tree_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_node_tree"}, + Name: "error", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, { - Name: "pg_node_tree_send", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_foreign_data_wrapper", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_node_tree"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_opclass_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_operator_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_opfamily_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_partition_root", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_postmaster_start_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_promote", - Args: []*catalog.Argument{ { - Name: "wait", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, + Name: "fdwname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Name: "wait_seconds", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, + Name: "fdwowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "fdwhandler", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "fdwvalidator", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "fdwacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, + }, + { + Name: "fdwoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_foreign_server", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "srvname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "srvowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "srvfdw", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "srvtype", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "srvversion", + Type: ast.TypeName{Name: "text"}, + }, + { + Name: "srvacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "srvoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "pg_read_file_old", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_foreign_table", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_relation_filenode", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_relation_filepath", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_relation_is_publishable", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_relation_is_updatable", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "ftrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "ftserver", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_relation_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "ftoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_relation_size", - Args: []*catalog.Argument{ + 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), + }, { - Type: &ast.TypeName{Name: "regclass"}, + Name: "grosysid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "grolist", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, }, - 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{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_hba_file_rules", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "line_number", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "type", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_create", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "database", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_replication_origin_drop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "user_name", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_oid", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "address", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_replication_origin_progress", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "netmask", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "auth_method", + Type: ast.TypeName{Name: "text"}, }, - }, - 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"}, + Name: "options", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, - }, - 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"}, + Name: "error", + 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{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ident_file_mappings", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "line_number", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "map_name", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - 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"}, + Name: "sys_name", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "pg_sequence_last_value", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "pg_username", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_size_bytes", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "error", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_size_pretty", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_index", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_size_pretty", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_sleep", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_sleep_for", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_sleep_until", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_start_backup", - Args: []*catalog.Argument{ { - Name: "label", - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Name: "fast", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "exclusive", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, + Name: "indrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_stat_clear_snapshot", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_get_analyze_count", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indnatts", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_autoanalyze_count", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indnkeyatts", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_autovacuum_count", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indisunique", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_backend_activity", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indnullsnotdistinct", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_activity_start", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indisprimary", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_backend_client_addr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indisexclusion", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "pg_stat_get_backend_client_port", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indimmediate", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_backend_dbid", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indisclustered", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - 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"}, + Name: "indisvalid", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_backend_start", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indcheckxmin", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_backend_userid", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indisready", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_stat_get_backend_wait_event", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indislive", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_wait_event_type", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indisreplident", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_xact_start", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "indkey", + Type: ast.TypeName{Name: "int2vector"}, + IsNotNull: true, + IsArray: true, }, - }, - 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"}, + Name: "indcollation", + Type: ast.TypeName{Name: "oidvector"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_blocks_hit", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indclass", + Type: ast.TypeName{Name: "oidvector"}, + IsNotNull: true, + IsArray: true, }, - }, - 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_blk_read_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indoption", + Type: ast.TypeName{Name: "int2vector"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_blk_write_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indexprs", + Type: ast.TypeName{Name: "pg_node_tree"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_blocks_fetched", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indpred", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_stat_get_db_blocks_hit", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_checksum_failures", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_checksum_last_failure", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indexname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_db_conflict_all", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tablespace", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_bufferpin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "indexdef", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_stat_get_db_conflict_lock", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_inherits", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_snapshot", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_startup_deadlock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_tablespace", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_deadlocks", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_numbackends", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_db_stat_reset_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_db_temp_bytes", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "inhdetachpending", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_stat_get_db_temp_files", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_init_privs", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_deleted", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_fetched", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_inserted", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_returned", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_updated", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_xact_commit", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_xact_rollback", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_dead_tuples", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_function_calls", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "privtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_function_self_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "initprivs", + Type: ast.TypeName{Name: "_aclitem"}, + IsNotNull: true, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, { - Name: "pg_stat_get_function_total_time", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_language", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_last_analyze_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_autoanalyze_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_autovacuum_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_vacuum_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_live_tuples", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_mod_since_analyze", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_numscans", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_snapshot_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_tuples_deleted", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_fetched", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanispl", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_hot_updated", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanpltrusted", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_inserted", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanplcallfoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_returned", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "laninline", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_updated", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanvalidator", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_vacuum_count", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "lanacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_stat_get_xact_blocks_fetched", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_largeobject", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_blocks_hit", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_function_calls", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_function_self_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_xact_function_total_time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_xact_numscans", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_deleted", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "loid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_fetched", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "pageno", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_hot_updated", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "data", + Type: ast.TypeName{Name: "bytea"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_stat_get_xact_tuples_inserted", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_largeobject_metadata", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_returned", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_updated", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_reset", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_single_function_counters", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_single_table_counters", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_statistics_obj_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_stop_backup", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - 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"}, + Name: "lomowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_table_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "lomacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "pg_tablespace_databases", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_locks", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "locktype", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_tablespace_location", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "database", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_tablespace_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "relation", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_tablespace_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "page", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_terminate_backend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "tuple", + Type: ast.TypeName{Name: "int2"}, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_total_relation_size", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "virtualxid", + Type: ast.TypeName{Name: "text"}, }, - }, - 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: "integer"}, + Name: "transactionid", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "classid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "objid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int2"}, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "virtualtransaction", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "mode", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "granted", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "fastpath", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), + }, + { + Name: "waitstart", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_try_advisory_xact_lock_shared", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_matviews", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "matviewname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock_shared", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "matviewowner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_config_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tablespace", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_dict_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "hasindexes", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_parser_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "ispopulated", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_template_is_visible", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "definition", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "pg_type_is_visible", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_namespace", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_typeof", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "any"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regtype"}, - }, - { - Name: "pg_wal_lsn_diff", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "pg_lsn"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_xact_commit_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "phraseto_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "nspname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), + }, + { + Name: "nspowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "phraseto_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "nspacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "pi", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, }, { - Name: "plainto_tsquery", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_opclass", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "plainto_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "circle"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "opcmethod", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "box"}, + Name: "opcname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "lseg"}, + Name: "opcnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "opcowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_above", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "opcfamily", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "opcintype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_add", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "opcdefault", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "opckeytype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "point"}, }, { - Name: "point_below", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_operator", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "point"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_distance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "point_div", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprkind", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_horiz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprcanmerge", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprcanhash", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "oprleft", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_left", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprright", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprresult", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_mul", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprcom", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprnegate", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprcode", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oprrest", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "oprjoin", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, { - Name: "point_right", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_opfamily", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "point"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "point_sub", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_vert", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_above", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "opfmethod", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "opfname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_below", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "opfnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "opfowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "poly_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_parameter_acl", }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "poly_contain", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_contain_pt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_contained", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_distance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "parname", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "poly_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "paracl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "polygon"}, }, { - Name: "poly_left", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_partitioned_table", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_npoints", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "poly_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "poly_overabove", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overbelow", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partstrat", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overlap", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partnatts", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partdefid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overleft", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partattrs", + Type: ast.TypeName{Name: "int2vector"}, + IsNotNull: true, + IsArray: true, }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partclass", + Type: ast.TypeName{Name: "oidvector"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overright", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partcollation", + Type: ast.TypeName{Name: "oidvector"}, + IsNotNull: true, + IsArray: true, }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "partexprs", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "poly_right", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_policies", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_same", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "policyname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "permissive", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "roles", + Type: ast.TypeName{Name: "_name"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "cmd", + Type: ast.TypeName{Name: "text"}, + }, + { + Name: "qual", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "circle"}, + Name: "with_check", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "polygon"}, }, { - Name: "polygon", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_policy", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "circle"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "box"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "popen", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "path"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bytea"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "polname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit"}, + Name: "polrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit"}, + Name: "polcmd", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "postgresql_fdw_validator", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text[]"}, + Name: "polpermissive", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "polroles", + Type: ast.TypeName{Name: "_oid"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pow", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "polqual", + Type: ast.TypeName{Name: "pg_node_tree"}, }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "polwithcheck", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, { - Name: "pow", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_prepared_statements", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "statement", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "power", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "prepare_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "parameter_types", + Type: ast.TypeName{Name: "_regtype"}, + IsArray: true, + }, + { + Name: "from_sql", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "power", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "generic_plans", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "custom_plans", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, { - Name: "pt_contained_circle", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_prepared_xacts", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "point"}, + Name: "transaction", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "circle"}, + Name: "gid", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pt_contained_poly", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "point"}, + Name: "prepared", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "polygon"}, + Name: "owner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), + }, + { + Name: "database", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "query_to_xml", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_proc", + }, + Columns: []*catalog.Column{ { - Name: "query", - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "query_to_xml_and_xmlschema", - Args: []*catalog.Argument{ { - Name: "query", - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "proname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "query_to_xmlschema", - Args: []*catalog.Argument{ { - Name: "query", - Type: &ast.TypeName{Name: "text"}, + Name: "pronamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "proowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "prolang", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "procost", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "querytree", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "prorows", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_ident", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "provariadic", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_literal", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "prosupport", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_literal", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "prokind", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_nullable", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "prosecdef", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_nullable", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "proleakproof", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "radians", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "proisstrict", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "radius", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "circle"}, + Name: "proretset", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - 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"}, + Name: "provolatile", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proparallel", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_after", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pronargs", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pronargdefaults", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_before", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "prorettype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proargtypes", + Type: ast.TypeName{Name: "oidvector"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proallargtypes", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proargmodes", + Type: ast.TypeName{Name: "_char"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "range_contained_by", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proargnames", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proargdefaults", + Type: ast.TypeName{Name: "pg_node_tree"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contains", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "protrftypes", + Type: ast.TypeName{Name: "_oid"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "prosrc", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contains_elem", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "probin", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "prosqlbody", + Type: ast.TypeName{Name: "pg_node_tree"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proconfig", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "proacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "range_ge", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_publication", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_intersect", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "puballtables", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubinsert", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubupdate", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubdelete", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_merge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubtruncate", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pubviaroot", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "anyrange"}, }, { - Name: "range_minus", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_publication_namespace", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "range_overlaps", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overleft", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pnpubid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "pnnspid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "range_overright", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_publication_rel", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "range_union", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "rank", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "record_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "prpubid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "prrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "prqual", + Type: ast.TypeName{Name: "pg_node_tree"}, }, { - Type: &ast.TypeName{Name: "record"}, + Name: "prattrs", + Type: ast.TypeName{Name: "int2vector"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "record_image_eq", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_publication_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "record"}, + Name: "pubname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "attnames", + Type: ast.TypeName{Name: "_name"}, + IsArray: true, + }, + { + Name: "rowfilter", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "record_image_gt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_range", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "record"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "rngtypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "rngsubtype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "rngmultitypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "rngcollation", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "rngsubopc", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "rngcanonical", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "rngsubdiff", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "record"}, }, { - Name: "record_le", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_replication_origin", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "record"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "record"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "roident", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "record_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "roname", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "regclass", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_replication_origin_status", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "local_id", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "regclassin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "external_id", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "regclassout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "remote_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regclasssend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "local_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "regconfigin", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_replication_slots", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "slot_name", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "regconfig"}, - }, - { - Name: "regconfigout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "plugin", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regconfigsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "slot_type", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regdictionaryin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "datoid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regdictionary"}, - }, - { - Name: "regdictionaryout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regdictionary"}, + Name: "database", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regdictionarysend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regdictionary"}, + Name: "temporary", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "active", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "active_pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "catalog_xmin", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_matches", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "wal_status", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "safe_wal_size", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "two_phase", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "text[]"}, }, { - Name: "regexp_matches", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_rewrite", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "rulename", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ev_class", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ev_type", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ev_enabled", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "is_instead", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ev_qual", + Type: ast.TypeName{Name: "pg_node_tree"}, + IsNotNull: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ev_action", + Type: ast.TypeName{Name: "pg_node_tree"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "text[]"}, }, { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_roles", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "rolname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "rolsuper", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "rolinherit", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "rolcreaterole", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "rolcreatedb", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regnamespacein", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "rolcanlogin", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "regnamespace"}, - }, - { - Name: "regnamespaceout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regnamespace"}, + Name: "rolreplication", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regnamespacesend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regnamespace"}, + Name: "rolconnlimit", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regoperatorin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "rolpassword", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "regoperator"}, - }, - { - Name: "regoperatorout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regoperator"}, + Name: "rolvaliduntil", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regoperatorsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regoperator"}, + Name: "rolbypassrls", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regoperin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "rolconfig", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "regoper"}, - }, - { - Name: "regoperout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regoper"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, { - Name: "regopersend", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_rules", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "regoper"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regprocedurein", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "regprocedure"}, - }, - { - Name: "regprocedureout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regprocedure"}, + Name: "rulename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regproceduresend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regprocedure"}, + Name: "definition", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "regprocin", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_seclabel", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regproc"}, - }, - { - Name: "regprocout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regproc"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regprocsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regproc"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regr_avgx", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_avgy", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_count", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "regr_intercept", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "provider", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "label", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, { - Name: "regr_r2", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_seclabels", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_slope", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objtype", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_sxx", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objnamespace", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "objname", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_sxy", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "provider", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "label", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, { - Name: "regr_syy", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_sequence", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regrolein", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "regrole"}, - }, - { - Name: "regroleout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regrole"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regrolesend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regrole"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regtypein", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "regtype"}, - }, - { - Name: "regtypeout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regtype"}, + Name: "seqrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regtypesend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regtype"}, + Name: "seqtypid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "repeat", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "seqstart", + Type: ast.TypeName{Name: "int8"}, + IsNotNull: true, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "seqincrement", + Type: ast.TypeName{Name: "int8"}, + IsNotNull: true, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "replace", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "seqmax", + Type: ast.TypeName{Name: "int8"}, + IsNotNull: true, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "seqmin", + Type: ast.TypeName{Name: "int8"}, + IsNotNull: true, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "seqcache", + Type: ast.TypeName{Name: "int8"}, + IsNotNull: true, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "reverse", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "seqcycle", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "right", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_sequences", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "sequencename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "sequenceowner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "data_type", + Type: ast.TypeName{Name: "regtype"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "start_value", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "min_value", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "row_number", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "row_security_active", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "max_value", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "row_security_active", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "increment_by", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "row_to_json", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "cycle", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "cache_size", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "row_to_json", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "record"}, + Name: "last_value", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "json"}, }, { - Name: "rpad", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_settings", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "setting", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rpad", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "unit", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "category", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "short_desc", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rtrim", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "extra_desc", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "context", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rtrim", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "vartype", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "scale", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "source", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "schema_to_xml", - Args: []*catalog.Argument{ { - Name: "schema", - Type: &ast.TypeName{Name: "name"}, + Name: "min_val", + Type: ast.TypeName{Name: "text"}, }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "max_val", + Type: ast.TypeName{Name: "text"}, }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "enumvals", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "boot_val", + 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: "reset_val", + Type: ast.TypeName{Name: "text"}, }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "sourcefile", + Type: ast.TypeName{Name: "text"}, }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "sourceline", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "pending_restart", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "xml"}, }, { - Name: "schema_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "schema", - Type: &ast.TypeName{Name: "name"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_shadow", + }, + Columns: []*catalog.Column{ { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "usename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "usesysid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "usecreatedb", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - 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"}, + Name: "usesuper", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "userepl", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "usebypassrls", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "set_bit", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "passwd", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "valuntil", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "useconfig", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "set_byte", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_shdepend", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "set_config", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "set_masklen", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cidr"}, + Name: "dbid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "classid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "set_masklen", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "inet"}, + Name: "objid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "objsubid", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "setseed", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "refclassid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "setval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "refobjid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "deptype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "bigint"}, }, { - Name: "setval", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_shdescription", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "regclass"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "setweight", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "char"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text[]"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "setweight", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "char"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "sha224", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "description", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "sha256", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_shmem_allocations", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "sha384", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "off", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "sha512", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "size", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "shell_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "allocated_size", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "opaque"}, }, { - Name: "shell_out", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_shseclabel", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "opaque"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "shobj_description", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "oid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sign", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "sign", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "similar_escape", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "objoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "classoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sind", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "provider", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sinh", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "label", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, }, - ReturnType: &ast.TypeName{Name: "double precision"}, }, { - Name: "slope", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_activity", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "point"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "point"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "spg_poly_quad_compress", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "polygon"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "split_part", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "leader_pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "usesysid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "usename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sqrt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "application_name", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "sqrt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "client_addr", + Type: ast.TypeName{Name: "inet"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "starts_with", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "client_hostname", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "client_port", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - 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: "smallint"}, + Name: "backend_start", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "xact_start", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "query_start", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "state_change", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "wait_event_type", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "wait_event", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "state", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "backend_xid", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "backend_xmin", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "query_id", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "query", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "backend_type", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, { - Name: "stddev_samp", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_all_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "string_agg", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "idx_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "bytea"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "string_agg", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_all_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "string_to_array", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "string_to_array", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "strip", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "strpos", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "n_live_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "n_dead_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "n_mod_since_analyze", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "n_ins_since_vacuum", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "last_vacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "last_autovacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "last_analyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "last_autoanalyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "vacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "autovacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "analyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "autoanalyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "substring", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_archiver", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "archived_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "last_archived_wal", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "last_archived_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "failed_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "last_failed_wal", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bytea"}, + Name: "last_failed_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "substring", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_bgwriter", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "checkpoints_timed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "checkpoints_req", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "checkpoint_write_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "checkpoint_sync_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "buffers_checkpoint", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "buffers_clean", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit"}, + Name: "maxwritten_clean", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "buffers_backend", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit"}, + Name: "buffers_backend_fsync", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "buffers_alloc", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bit"}, }, { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_database", }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "money"}, + Name: "numbackends", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "xact_commit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "xact_rollback", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - 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"}, + Name: "tup_returned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "table_am_handler"}, - }, - { - Name: "table_am_handler_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "table_am_handler"}, + Name: "tup_fetched", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "table_to_xml", - Args: []*catalog.Argument{ { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, + Name: "tup_inserted", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "tup_updated", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "tup_deleted", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "conflicts", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "table_to_xml_and_xmlschema", - Args: []*catalog.Argument{ { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, + Name: "temp_files", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "temp_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "deadlocks", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "checksum_failures", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "table_to_xmlschema", - Args: []*catalog.Argument{ { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, + Name: "checksum_last_failure", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, + Name: "blk_read_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, + Name: "blk_write_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, + Name: "session_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "tan", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "active_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tand", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "idle_in_transaction_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tanh", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "sessions", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "sessions_abandoned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "character"}, + Name: "sessions_fatal", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "sessions_killed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "char"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_database_conflicts", }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "inet"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "confl_tablespace", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "confl_lock", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "confl_snapshot", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_larger", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "confl_bufferpin", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "confl_deadlock", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "text_le", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_gssapi", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "gss_authenticated", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "principal", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "encrypted", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "text_pattern_ge", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_analyze", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "phase", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "sample_blks_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "sample_blks_scanned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ext_stats_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_smaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ext_stats_computed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "child_tables_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "textanycat", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "child_tables_done", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "anynonarray"}, + Name: "current_child_table_relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "textcat", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_basebackup", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "phase", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "texteq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "backup_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "backup_streamed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texteqname", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tablespaces_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "tablespaces_streamed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "textgename", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_cluster", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textgtname", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticlike", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "command", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "phase", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticnlike", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cluster_index_relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_tuples_scanned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexeq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_tuples_written", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_blks_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_blks_scanned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "index_rebuild_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "textin", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_copy", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "textlen", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "textlename", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textlike", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "command", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "type", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textltname", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "bytes_processed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "bytes_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tuples_processed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "tuples_excluded", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "textnename", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_create_index", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textnlike", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "index_relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "textregexeq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "command", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "phase", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textregexne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "lockers_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "lockers_done", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "current_locker_pid", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "tideq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "blocks_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "blocks_done", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "tuples_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "tuples_done", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidgt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "partitions_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "partitions_done", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "tidin", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_progress_vacuum", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "tidlarger", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "datid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "datname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "tidle", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "phase", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidlt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "heap_blks_total", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "heap_blks_scanned", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "heap_blks_vacuumed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "index_vacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "max_dead_tuples", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tidsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "num_dead_tuples", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "tidsmaller", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_recovery_prefetch", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tid"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tid"}, + Name: "prefetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "skip_init", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "skip_new", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "skip_fpw", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "skip_rep", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "wal_distance", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "block_distance", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "io_depth", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, { - Name: "time_eq", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_replication", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "usesysid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "usename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "application_name", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "client_addr", + Type: ast.TypeName{Name: "inet"}, }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "client_hostname", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_hash", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "client_port", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "time_hash_extended", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "backend_start", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "backend_xmin", + Type: ast.TypeName{Name: "xid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "time_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "state", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "sent_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "write_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_larger", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "flush_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "replay_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "write_lag", + Type: ast.TypeName{Name: "interval"}, + Length: toPointer(16), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "flush_lag", + Type: ast.TypeName{Name: "interval"}, + Length: toPointer(16), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "replay_lag", + Type: ast.TypeName{Name: "interval"}, + Length: toPointer(16), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "sync_priority", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_mi_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "sync_state", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "reply_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, }, { - Name: "time_mi_time", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_replication_slots", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "slot_name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "spill_txns", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "time_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "spill_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "spill_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "stream_txns", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "time_pl_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "stream_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "stream_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "total_txns", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "time_smaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "total_bytes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, }, { - Name: "timedate_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_slru", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "date"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, - }, - 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: "timestamp with time zone"}, + Name: "blks_zeroed", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "date"}, + Name: "blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "blks_written", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "date"}, + Name: "blks_exists", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "flushes", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "truncates", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, { - Name: "timestamp_cmp_date", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_ssl", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "ssl", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_cmp_timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "version", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "cipher", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "bits", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "client_dn", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_eq_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "client_serial", + Type: ast.TypeName{Name: "numeric"}, }, { - Type: &ast.TypeName{Name: "date"}, + Name: "issuer_dn", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timestamp_eq_timestamptz", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_subscription", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "subid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "subname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "received_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge_timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "latest_end_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "latest_end_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timestamp_gt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_subscription_stats", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "subid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "subname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_gt_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "apply_error_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "sync_error_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timestamp_gt_timestamptz", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_sys_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_hash", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_hash_extended", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "timestamp_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "idx_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, }, { - Name: "timestamp_larger", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_sys_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_le_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_le_timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "n_live_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt_timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_dead_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_mod_since_analyze", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_mi", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_ins_since_vacuum", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "last_vacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "timestamp_mi_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "last_autovacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "last_analyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "last_autoanalyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "vacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "autovacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ne_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "analyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "autoanalyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timestamp_ne_timestamptz", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_user_functions", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "funcid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "funcname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamp_pl_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "calls", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "total_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "self_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "timestamp_smaller", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_user_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamptypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "date"}, + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "idx_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, }, { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_user_tables", }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "date"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_cmp_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_cmp_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_eq_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_live_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "n_dead_tup", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_eq_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_mod_since_analyze", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_ins_since_vacuum", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "last_vacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "last_autovacuum", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "last_analyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "last_autoanalyze", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "vacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "autovacuum_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "analyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "autoanalyze_count", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timestamptz_gt_date", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_wal", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "wal_records", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "wal_fpi", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_gt_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "wal_bytes", + Type: ast.TypeName{Name: "numeric"}, }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "wal_buffers_full", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "wal_write", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "wal_sync", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "wal_write_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_larger", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "wal_sync_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "stats_reset", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, }, { - Name: "timestamptz_le", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_wal_receiver", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "pid", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "status", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_le_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "receive_start_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "receive_start_tli", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_le_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "written_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "flushed_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "received_tli", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "last_msg_send_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "last_msg_receipt_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "latest_end_lsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "latest_end_time", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "slot_name", + Type: ast.TypeName{Name: "text"}, + }, + { + Name: "sender_host", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_mi", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "sender_port", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "conninfo", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "interval"}, }, { - Name: "timestamptz_mi_interval", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_xact_all_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ne_date", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ne_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamptz_pl_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, }, { - Name: "timestamptz_send", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_xact_sys_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "timestamptz_smaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptztypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptztypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timetypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time without time zone"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, }, { - Name: "timetz_cmp", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_xact_user_functions", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "funcid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetz_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "funcname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "calls", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "total_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "self_time", + Type: ast.TypeName{Name: "float8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timetz_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stat_xact_user_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_hash", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetz_hash_extended", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "seq_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "timetz_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "seq_tup_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "idx_scan", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "idx_tup_fetch", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_larger", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "n_tup_ins", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "n_tup_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "n_tup_del", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "n_tup_hot_upd", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "timetz_lt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_all_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_mi_interval", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, { - Name: "timetz_pl_interval", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_all_sequences", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "interval"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "timetz_smaller", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, }, { - Name: "timetzdate_pl", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_all_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "date"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timetztypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetztypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "heap_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "heap_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "toast_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "toast_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tidx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "tidx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, }, { - Name: "timezone", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_sys_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "time with time zone"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, }, { - Name: "to_ascii", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_sys_sequences", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_ascii", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "name"}, + Name: "blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_ascii", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "to_char", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_sys_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "heap_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "toast_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), + }, + { + Name: "toast_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "interval"}, + Name: "tidx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "tidx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "to_char", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_user_indexes", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "indexrelid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), + }, + { + Name: "indexrelname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "to_date", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_user_sequences", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "to_hex", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_hex", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_json", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "json"}, }, { - Name: "to_jsonb", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statio_user_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "relid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "to_number", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "relname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "to_regclass", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "to_regnamespace", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "heap_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regnamespace"}, - }, - { - Name: "to_regoper", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regoper"}, - }, - { - Name: "to_regoperator", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "idx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regoperator"}, - }, - { - Name: "to_regproc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "toast_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regproc"}, - }, - { - Name: "to_regprocedure", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "toast_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regprocedure"}, - }, - { - Name: "to_regrole", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tidx_blks_read", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "regrole"}, - }, - { - Name: "to_regtype", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tidx_blks_hit", + Type: ast.TypeName{Name: "int8"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "regtype"}, }, { - Name: "to_timestamp", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statistic", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "to_timestamp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "to_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "to_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "json"}, + Name: "starelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "staattnum", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stainherit", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stanullfrac", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "stawidth", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stadistinct", + Type: ast.TypeName{Name: "float4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "stakind1", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stakind2", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "json"}, + Name: "stakind3", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - 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"}, + Name: "stakind4", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stakind5", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "staop1", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "trigger_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "staop2", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "trigger_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "trigger"}, + Name: "staop3", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "staop4", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "macaddr"}, + Name: "staop5", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "macaddr8"}, + Name: "stacoll1", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "stacoll2", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "stacoll3", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "stacoll4", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ts_delete", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "stacoll5", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stanumbers1", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_delete", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "stanumbers2", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text[]"}, + Name: "stanumbers3", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_filter", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "stanumbers4", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "char[]"}, + Name: "stanumbers5", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "json"}, + Name: "stavalues1", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stavalues2", + Type: ast.TypeName{Name: "anyarray"}, }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stavalues3", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "stavalues4", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stavalues5", + Type: ast.TypeName{Name: "anyarray"}, }, }, - ReturnType: &ast.TypeName{Name: "jsonb"}, }, { - Name: "ts_headline", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statistic_ext", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stxrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stxname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), + }, + { + Name: "stxnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stxowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "json"}, + Name: "stxstattarget", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stxkeys", + Type: ast.TypeName{Name: "int2vector"}, + IsNotNull: true, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stxkind", + Type: ast.TypeName{Name: "_char"}, + IsNotNull: true, + IsArray: true, + }, + { + Name: "stxexprs", + Type: ast.TypeName{Name: "pg_node_tree"}, }, }, - ReturnType: &ast.TypeName{Name: "json"}, }, { - Name: "ts_headline", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_statistic_ext_data", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "json"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "json"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "stxoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stxdinherit", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stxdndistinct", + Type: ast.TypeName{Name: "pg_ndistinct"}, }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "stxddependencies", + Type: ast.TypeName{Name: "pg_dependencies"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "stxdmcv", + Type: ast.TypeName{Name: "pg_mcv_list"}, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "stxdexpr", + Type: ast.TypeName{Name: "_pg_statistic"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "text"}, }, { - Name: "ts_headline", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stats", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "jsonb"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "attname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "inherited", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "null_frac", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "avg_width", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_lexize", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regdictionary"}, + Name: "n_distinct", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "most_common_vals", + Type: ast.TypeName{Name: "anyarray"}, }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "ts_match_qv", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_freqs", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "histogram_bounds", + Type: ast.TypeName{Name: "anyarray"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_match_tq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "correlation", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_elems", + Type: ast.TypeName{Name: "anyarray"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_match_tt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "most_common_elem_freqs", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "elem_count_histogram", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "ts_match_vq", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stats_ext", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real[]"}, + Name: "statistics_schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "statistics_name", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "statistics_owner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "attnames", + Type: ast.TypeName{Name: "_name"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "exprs", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "kinds", + Type: ast.TypeName{Name: "_char"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "inherited", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real[]"}, + Name: "n_distinct", + Type: ast.TypeName{Name: "pg_ndistinct"}, }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "dependencies", + Type: ast.TypeName{Name: "pg_dependencies"}, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_vals", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, + }, + { + Name: "most_common_val_nulls", + Type: ast.TypeName{Name: "_bool"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "most_common_freqs", + Type: ast.TypeName{Name: "_float8"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_base_freqs", + Type: ast.TypeName{Name: "_float8"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "real"}, }, { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_stats_ext_exprs", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "statistics_schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "statistics_name", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "statistics_owner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real[]"}, + Name: "expr", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "inherited", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "null_frac", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real[]"}, + Name: "avg_width", + Type: ast.TypeName{Name: "int4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "n_distinct", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_vals", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "most_common_freqs", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rewrite", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "histogram_bounds", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "text"}, + Name: "correlation", + Type: ast.TypeName{Name: "float4"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "ts_rewrite", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_elems", + Type: ast.TypeName{Name: "anyarray"}, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "most_common_elem_freqs", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "elem_count_histogram", + Type: ast.TypeName{Name: "_float4"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "tsquery"}, }, { - Name: "tsm_handler_in", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_subscription", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsm_handler"}, - }, - { - Name: "tsm_handler_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsm_handler"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tsq_mcontained", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsq_mcontains", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_and", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subdbid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subskiplsn", + Type: ast.TypeName{Name: "pg_lsn"}, + IsNotNull: true, + Length: toPointer(8), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "tsquery_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subenabled", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subbinary", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "substream", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_gt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subtwophasestate", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subdisableonerr", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subconninfo", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subslotname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subsynccommit", + Type: ast.TypeName{Name: "text"}, + IsNotNull: true, }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "subpublications", + Type: ast.TypeName{Name: "_text"}, + IsNotNull: true, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "tsquery_ne", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_subscription_rel", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_not", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_or", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_phrase", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "srsubid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "srrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_phrase", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "srsubstate", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "srsublsn", + Type: ast.TypeName{Name: "pg_lsn"}, + Length: toPointer(8), }, }, - ReturnType: &ast.TypeName{Name: "tsquery"}, }, { - Name: "tsqueryin", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_tables", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "schemaname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsqueryout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tablename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tsquerysend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsquery"}, + Name: "tableowner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "tsrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "tablespace", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "hasindexes", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "hasrules", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "tsrange"}, - }, - { - Name: "tsrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "hastriggers", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "rowsecurity", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "tsrange"}, }, { - Name: "tsrange_subdiff", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_tablespace", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp without time zone"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tstzrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tstzrange"}, - }, - { - Name: "tstzrange", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tstzrange"}, - }, - { - Name: "tstzrange_subdiff", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "spcname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "timestamp with time zone"}, + Name: "spcowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tsvector_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "spcacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "spcoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "integer"}, }, { - Name: "tsvector_concat", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_timezone_abbrevs", + }, + Columns: []*catalog.Column{ + { + Name: "abbrev", + Type: ast.TypeName{Name: "text"}, + }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "utc_offset", + Type: ast.TypeName{Name: "interval"}, + Length: toPointer(16), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "is_dst", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "tsvector"}, }, { - Name: "tsvector_eq", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_timezone_names", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "name", + Type: ast.TypeName{Name: "text"}, }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "abbrev", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "utc_offset", + Type: ast.TypeName{Name: "interval"}, + Length: toPointer(16), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "is_dst", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "tsvector_gt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_transform", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_ne", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "trftype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_to_array", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "trflang", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "trffromsql", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "tsvectorout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "trftosql", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "cstring"}, }, { - Name: "tsvectorsend", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_trigger", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "tsvector"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - 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"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "txid_snapshot"}, - }, - { - Name: "txid_snapshot_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "txid_snapshot_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "txid_snapshot_xip", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_snapshot_xmax", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_snapshot_xmin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_status", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "tgrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "txid_visible_in_snapshot", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "tgparentid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "txid_snapshot"}, + Name: "tgname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "unique_key_recheck", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "unknownin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "tgfoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), + }, + { + Name: "tgtype", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "unknown"}, - }, - { - Name: "unknownout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "unknown"}, + Name: "tgenabled", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "unknownsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "unknown"}, + Name: "tgisinternal", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "unnest", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyarray"}, + Name: "tgconstrrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "upper", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "tgconstrindid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "upper", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tgconstraint", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "upper_inc", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tgdeferrable", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "upper_inf", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyrange"}, + Name: "tginitdeferred", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_cmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgnargs", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgattr", + Type: ast.TypeName{Name: "int2vector"}, + IsNotNull: true, + IsArray: true, }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "uuid_eq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgargs", + Type: ast.TypeName{Name: "bytea"}, + IsNotNull: true, }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgqual", + Type: ast.TypeName{Name: "pg_node_tree"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_ge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgoldtable", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tgnewtable", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "uuid_gt", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ts_config", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_hash", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "uuid_hash_extended", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bigint"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "uuid_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_le", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cfgname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), + }, + { + Name: "cfgnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_lt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cfgowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cfgparser", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "uuid_ne", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ts_config_map", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "uuid_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "uuid"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "mapcfg", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "maptokentype", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "mapseqno", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "mapdict", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "numeric"}, }, { - Name: "var_samp", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ts_dict", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "real"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "varbit", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "dictname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "dictnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bit varying"}, - }, - { - Name: "varbit_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "dictowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "dicttemplate", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "dictinitoption", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "bit varying"}, }, { - Name: "varbit_out", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ts_parser", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varbit_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "varbitcmp", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varbiteq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitge", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prsname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitgt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prsnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prsstart", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitle", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prstoken", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prsend", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitlt", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prsheadline", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "prslextype", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "varbitne", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_ts_template", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "bit varying"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbittypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varbittypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varchar", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "name"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "character varying"}, - }, - { - Name: "varchar", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "character varying"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "boolean"}, + Name: "tmplname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "character varying"}, - }, - { - Name: "varcharin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "tmplnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "oid"}, + Name: "tmplinit", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "tmpllexize", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, }, - ReturnType: &ast.TypeName{Name: "character varying"}, }, { - Name: "varcharout", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_type", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "character varying"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varcharsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "character varying"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "varchartypmodin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring[]"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varchartypmodout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "bigint"}, + Name: "ctid", + Type: ast.TypeName{Name: "tid"}, + IsNotNull: true, + Length: toPointer(6), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "integer"}, + Name: "oid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "smallint"}, + Name: "typname", + Type: ast.TypeName{Name: "name"}, + IsNotNull: true, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "real"}, + Name: "typnamespace", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "typowner", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "version", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "void_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "typlen", + Type: ast.TypeName{Name: "int2"}, + IsNotNull: true, + Length: toPointer(2), }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "void_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "void"}, + Name: "typbyval", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "void_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "void"}, + Name: "typtype", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "websearch_to_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "typcategory", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "websearch_to_tsquery", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "regconfig"}, + Name: "typispreferred", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "text"}, + Name: "typisdefined", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "width", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "box"}, + Name: "typdelim", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "double precision"}, + Name: "typrelid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "typsubscript", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "double precision"}, + Name: "typelem", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "typarray", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "numeric"}, + Name: "typinput", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "typoutput", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "numeric"}, + Name: "typreceive", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "typsend", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "anyelement"}, + Name: "typmodin", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "anyarray"}, + Name: "typmodout", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "xideq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typanalyze", + Type: ast.TypeName{Name: "regproc"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xid"}, + Name: "typalign", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xideqint4", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typstorage", + Type: ast.TypeName{Name: "char"}, + IsNotNull: true, + Length: toPointer(1), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "typnotnull", + Type: ast.TypeName{Name: "bool"}, + IsNotNull: true, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidin", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "typbasetype", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xid"}, - }, - { - Name: "xidneq", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typtypmod", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xid"}, + Name: "typndims", + Type: ast.TypeName{Name: "int4"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidneqint4", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typcollation", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "integer"}, + Name: "typdefaultbin", + Type: ast.TypeName{Name: "pg_node_tree"}, }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidout", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typdefault", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "xidsend", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xid"}, + Name: "typacl", + Type: ast.TypeName{Name: "_aclitem"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "bytea"}, }, { - Name: "xml", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_user", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "usename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xml_in", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "cstring"}, + Name: "usesysid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xml_is_well_formed", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "usecreatedb", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_is_well_formed_content", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "usesuper", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_is_well_formed_document", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "userepl", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_out", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "usebypassrls", + Type: ast.TypeName{Name: "bool"}, + Length: toPointer(1), }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "xml_send", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "passwd", + Type: ast.TypeName{Name: "text"}, }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "xmlagg", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "valuntil", + Type: ast.TypeName{Name: "timestamptz"}, + Length: toPointer(8), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xmlcomment", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "useconfig", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "xml"}, }, { - Name: "xmlconcat2", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_user_mapping", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "tableoid", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "cmax", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xmlexists", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "xmax", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "cmin", + Type: ast.TypeName{Name: "cid"}, + IsNotNull: true, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xmlvalidate", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "xml"}, + Name: "xmin", + Type: ast.TypeName{Name: "xid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text"}, + 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), }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xpath", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "umserver", + Type: ast.TypeName{Name: "oid"}, + IsNotNull: true, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "umoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "xml[]"}, }, { - Name: "xpath", - Args: []*catalog.Argument{ + Rel: &ast.TableName{ + Catalog: "pg_catalog", + Schema: "pg_catalog", + Name: "pg_user_mappings", + }, + Columns: []*catalog.Column{ { - Type: &ast.TypeName{Name: "text"}, + Name: "umid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "srvid", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, { - Type: &ast.TypeName{Name: "text[]"}, + Name: "srvname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), + }, + { + Name: "umuser", + Type: ast.TypeName{Name: "oid"}, + Length: toPointer(4), }, - }, - ReturnType: &ast.TypeName{Name: "xml[]"}, - }, - { - Name: "xpath_exists", - Args: []*catalog.Argument{ { - Type: &ast.TypeName{Name: "text"}, + Name: "usename", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "umoptions", + Type: ast.TypeName{Name: "_text"}, + IsArray: true, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, { - Name: "xpath_exists", - Args: []*catalog.Argument{ + 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), + }, { - Type: &ast.TypeName{Name: "text"}, + Name: "viewname", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "xml"}, + Name: "viewowner", + Type: ast.TypeName{Name: "name"}, + Length: toPointer(64), }, { - Type: &ast.TypeName{Name: "text[]"}, + Name: "definition", + Type: ast.TypeName{Name: "text"}, }, }, - ReturnType: &ast.TypeName{Name: "boolean"}, }, } return s diff --git a/internal/engine/postgresql/pg_temp.go b/internal/engine/postgresql/pg_temp.go index 6d41fa9246..bedf105910 100644 --- a/internal/engine/postgresql/pg_temp.go +++ b/internal/engine/postgresql/pg_temp.go @@ -1,28 +1,9 @@ package postgresql import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) func pgTemp() *catalog.Schema { return &catalog.Schema{Name: "pg_temp"} } - -func typeName(name string) *ast.TypeName { - return &ast.TypeName{Name: name} -} - -func argN(name string, n int) *catalog.Function { - var args []*catalog.Argument - for i := 0; i < n; i++ { - args = append(args, &catalog.Argument{ - Type: &ast.TypeName{Name: "any"}, - }) - } - return &catalog.Function{ - Name: name, - Args: args, - ReturnType: &ast.TypeName{Name: "any"}, - } -} diff --git a/internal/engine/postgresql/reserved.go b/internal/engine/postgresql/reserved.go index 8f796ffa19..b03a6a7e9f 100644 --- a/internal/engine/postgresql/reserved.go +++ b/internal/engine/postgresql/reserved.go @@ -1,6 +1,80 @@ 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 uses $1, $2, etc. +func (p *Parser) Param(n int) string { + return fmt.Sprintf("$%d", n) +} + +// NamedParam returns the named parameter placeholder for the given name. +// PostgreSQL/sqlc uses @name syntax. +func (p *Parser) NamedParam(name string) string { + return "@" + name +} + +// Cast returns a type cast expression. +// PostgreSQL uses expr::type syntax. +func (p *Parser) Cast(arg, typeName string) string { + return arg + "::" + typeName +} // https://www.postgresql.org/docs/current/sql-keywords-appendix.html func (p *Parser) IsReservedKeyword(s string) bool { diff --git a/internal/engine/postgresql/rewrite_test.go b/internal/engine/postgresql/rewrite_test.go index f416d70750..4a2460cd2f 100644 --- a/internal/engine/postgresql/rewrite_test.go +++ b/internal/engine/postgresql/rewrite_test.go @@ -4,8 +4,8 @@ import ( "strings" "testing" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" "github.com/google/go-cmp/cmp" ) @@ -30,6 +30,7 @@ func TestApply(t *testing.T) { } if astutils.Join(fun.Funcname, ".") == "sqlc.arg" { cr.Replace(&ast.ParamRef{ + Dollar: true, Number: 1, Location: fun.Location, }) diff --git a/internal/engine/postgresql/utils.go b/internal/engine/postgresql/utils.go index 67d1fbcc44..b8d49b1a97 100644 --- a/internal/engine/postgresql/utils.go +++ b/internal/engine/postgresql/utils.go @@ -1,29 +1,27 @@ -// +build !windows - package postgresql import ( - nodes "github.com/lfittl/pg_query_go/nodes" + nodes "github.com/pganalyze/pg_query_go/v6" ) func isArray(n *nodes.TypeName) bool { if n == nil { return false } - return len(n.ArrayBounds.Items) > 0 + return len(n.ArrayBounds) > 0 } -func isNotNull(n nodes.ColumnDef) bool { +func isNotNull(n *nodes.ColumnDef) bool { if n.IsNotNull { return true } - for _, c := range n.Constraints.Items { - switch n := c.(type) { - case nodes.Constraint: - if n.Contype == nodes.CONSTR_NOTNULL { + for _, c := range n.Constraints { + switch inner := c.Node.(type) { + case *nodes.Node_Constraint: + if inner.Constraint.Contype == nodes.ConstrType_CONSTR_NOTNULL { return true } - if n.Contype == nodes.CONSTR_PRIMARY { + if inner.Constraint.Contype == nodes.ConstrType_CONSTR_PRIMARY { return true } } @@ -31,12 +29,35 @@ func isNotNull(n nodes.ColumnDef) bool { return false } -func IsNamedParamFunc(node nodes.Node) bool { - fun, ok := node.(nodes.FuncCall) - return ok && join(fun.Funcname, ".") == "sqlc.arg" +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 == "" { + return b + } + return []byte(s)[0] } -func IsNamedParamSign(node nodes.Node) bool { - expr, ok := node.(nodes.A_Expr) - return ok && join(expr.Name, ".") == "@" +func makeUint32Slice(in []uint64) []uint32 { + out := make([]uint32, len(in)) + for i, v := range in { + out[i] = uint32(v) + } + return out +} + +func makeString(s string) *string { + if s == "" { + return nil + } + return &s } diff --git a/internal/engine/sqlite/analyzer/analyze.go b/internal/engine/sqlite/analyzer/analyze.go new file mode 100644 index 0000000000..3af9f99a30 --- /dev/null +++ b/internal/engine/sqlite/analyzer/analyze.go @@ -0,0 +1,369 @@ +package analyzer + +import ( + "context" + "fmt" + "strings" + "sync" + + "github.com/ncruces/go-sqlite3" + _ "github.com/ncruces/go-sqlite3/embed" + + core "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +type Analyzer struct { + db config.Database + conn *sqlite3.Conn + dbg opts.Debug + replacer *shfmt.Replacer + mu sync.Mutex +} + +func New(db config.Database) *Analyzer { + return &Analyzer{ + db: db, + dbg: opts.DebugFromEnv(), + 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 a.dbg.OnlyManagedDatabases { + 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 := 0; i < colCount; i++ { + name := stmt.ColumnName(i) + declType := stmt.ColumnDeclType(i) + tableName := stmt.ColumnTableName(i) + originName := stmt.ColumnOriginName(i) + dbName := stmt.ColumnDatabaseName(i) + + // Normalize the data type + dataType := normalizeType(declType) + + // Determine if column is NOT NULL + // SQLite doesn't provide this info directly from prepared statements, + // so we default to nullable (false) + notNull := false + + 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 +} + +// EnsureConn initializes the database connection if not already done. +// This is useful for database-only mode where we need to connect before analyzing queries. +func (a *Analyzer) EnsureConn(ctx context.Context, migrations []string) error { + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn != nil { + return nil + } + + var uri string + applyMigrations := a.db.Managed + if a.db.Managed { + // For managed databases, create an in-memory database + uri = ":memory:" + } else if a.dbg.OnlyManagedDatabases { + return 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 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 fmt.Errorf("migration failed: %s: %w", m, err) + } + } + } + + return nil +} + +// GetColumnNames implements the expander.ColumnGetter interface. +// It prepares a query and returns the column names from the result set description. +func (a *Analyzer) GetColumnNames(ctx context.Context, query string) ([]string, error) { + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn == nil { + return nil, fmt.Errorf("database connection not initialized") + } + + stmt, _, err := a.conn.Prepare(query) + if err != nil { + return nil, err + } + defer stmt.Close() + + colCount := stmt.ColumnCount() + columns := make([]string, colCount) + for i := 0; i < colCount; i++ { + columns[i] = stmt.ColumnName(i) + } + + return columns, nil +} + +// IntrospectSchema queries the database to build a catalog containing +// tables and columns for the database. +func (a *Analyzer) IntrospectSchema(ctx context.Context, schemas []string) (*catalog.Catalog, error) { + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn == nil { + return nil, fmt.Errorf("database connection not initialized") + } + + // Build catalog + cat := &catalog.Catalog{ + DefaultSchema: "main", + } + + // Create default schema + mainSchema := &catalog.Schema{Name: "main"} + cat.Schemas = append(cat.Schemas, mainSchema) + + // Query tables from sqlite_master + stmt, _, err := a.conn.Prepare("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'") + if err != nil { + return nil, fmt.Errorf("introspect tables: %w", err) + } + + tableNames := []string{} + for stmt.Step() { + tableName := stmt.ColumnText(0) + tableNames = append(tableNames, tableName) + } + stmt.Close() + + // For each table, get column information using PRAGMA table_info + for _, tableName := range tableNames { + tbl := &catalog.Table{ + Rel: &ast.TableName{ + Name: tableName, + }, + } + + pragmaStmt, _, err := a.conn.Prepare(fmt.Sprintf("PRAGMA table_info('%s')", tableName)) + if err != nil { + return nil, fmt.Errorf("pragma table_info for %s: %w", tableName, err) + } + + for pragmaStmt.Step() { + // PRAGMA table_info returns: cid, name, type, notnull, dflt_value, pk + colName := pragmaStmt.ColumnText(1) + colType := pragmaStmt.ColumnText(2) + notNull := pragmaStmt.ColumnInt(3) != 0 + + tbl.Columns = append(tbl.Columns, &catalog.Column{ + Name: colName, + Type: ast.TypeName{Name: normalizeType(colType)}, + IsNotNull: notNull, + }) + } + pragmaStmt.Close() + + mainSchema.Tables = append(mainSchema.Tables, tbl) + } + + return cat, 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/analyzer/analyze_test.go b/internal/engine/sqlite/analyzer/analyze_test.go new file mode 100644 index 0000000000..320b692597 --- /dev/null +++ b/internal/engine/sqlite/analyzer/analyze_test.go @@ -0,0 +1,119 @@ +package analyzer + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func TestAnalyzer_Analyze(t *testing.T) { + db := config.Database{ + Managed: true, + } + a := New(db) + defer a.Close(context.Background()) + + ctx := context.Background() + + migrations := []string{ + `CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + email TEXT + )`, + } + + query := `SELECT id, name, email FROM users WHERE id = ?` + node := &ast.TODO{} + + result, err := a.Analyze(ctx, node, query, migrations, nil) + if err != nil { + t.Fatalf("Analyze failed: %v", err) + } + + if len(result.Columns) != 3 { + t.Errorf("Expected 3 columns, got %d", len(result.Columns)) + } + + expectedCols := []struct { + name string + dataType string + }{ + {"id", "integer"}, + {"name", "text"}, + {"email", "text"}, + } + + for i, expected := range expectedCols { + if i >= len(result.Columns) { + break + } + col := result.Columns[i] + if col.Name != expected.name { + t.Errorf("Column %d: expected name %q, got %q", i, expected.name, col.Name) + } + if col.DataType != expected.dataType { + t.Errorf("Column %d: expected dataType %q, got %q", i, expected.dataType, col.DataType) + } + if col.Table == nil || col.Table.Name != "users" { + t.Errorf("Column %d: expected table 'users', got %v", i, col.Table) + } + } + + if len(result.Params) != 1 { + t.Errorf("Expected 1 parameter, got %d", len(result.Params)) + } +} + +func TestAnalyzer_InvalidQuery(t *testing.T) { + db := config.Database{ + Managed: true, + } + a := New(db) + defer a.Close(context.Background()) + + ctx := context.Background() + + migrations := []string{ + `CREATE TABLE users (id INTEGER PRIMARY KEY)`, + } + + query := `SELECT * FROM nonexistent` + node := &ast.TODO{} + + _, err := a.Analyze(ctx, node, query, migrations, nil) + if err == nil { + t.Error("Expected error for invalid query, got nil") + } +} + +func TestNormalizeType(t *testing.T) { + tests := []struct { + input string + expected string + }{ + {"INTEGER", "integer"}, + {"INT", "integer"}, + {"BIGINT", "integer"}, + {"TEXT", "text"}, + {"VARCHAR(255)", "text"}, + {"BLOB", "blob"}, + {"REAL", "real"}, + {"FLOAT", "real"}, + {"DOUBLE", "real"}, + {"BOOLEAN", "boolean"}, + {"DATETIME", "datetime"}, + {"", "any"}, + } + + for _, tt := range tests { + t.Run(tt.input, func(t *testing.T) { + result := normalizeType(tt.input) + if result != tt.expected { + t.Errorf("normalizeType(%q) = %q, want %q", tt.input, result, tt.expected) + } + }) + } +} diff --git a/internal/engine/sqlite/catalog.go b/internal/engine/sqlite/catalog.go index 876290babd..d7d27489a9 100644 --- a/internal/engine/sqlite/catalog.go +++ b/internal/engine/sqlite/catalog.go @@ -1,8 +1,18 @@ package sqlite -import "github.com/kyleconroy/sqlc/internal/sql/catalog" +import "github.com/sqlc-dev/sqlc/internal/sql/catalog" func NewCatalog() *catalog.Catalog { - c := catalog.New("main") - return c + def := "main" + return &catalog.Catalog{ + DefaultSchema: def, + Schemas: []*catalog.Schema{ + defaultSchema(def), + }, + 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 index 3df2775a81..bf6dcd8316 100644 --- a/internal/engine/sqlite/catalog_test.go +++ b/internal/engine/sqlite/catalog_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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" @@ -239,13 +239,13 @@ func TestUpdate(t *testing.T) { t.Fatal(err) } - c := NewCatalog() + c := newTestCatalog() if err := c.Build(stmts); err != nil { t.Log(test.stmt) t.Fatal(err) } - e := NewCatalog() + e := newTestCatalog() if test.s != nil { var replaced bool for i := range e.Schemas { @@ -260,7 +260,7 @@ func TestUpdate(t *testing.T) { } } - if diff := cmp.Diff(e, c, cmpopts.EquateEmpty()); diff != "" { + 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 acddf38070..e9868f5be6 100644 --- a/internal/engine/sqlite/convert.go +++ b/internal/engine/sqlite/convert.go @@ -1,271 +1,1340 @@ package sqlite import ( - "github.com/antlr/antlr4/runtime/Go/antlr" + "fmt" + "log" + "strconv" + "strings" - "github.com/kyleconroy/sqlc/internal/engine/sqlite/parser" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/antlr4-go/antlr/v4" + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) +type cc struct { + paramCount int +} + type node interface { GetParser() antlr.Parser } -func convertAlter_table_stmtContext(c *parser.Alter_table_stmtContext) ast.Node { - if newTable, ok := c.New_table_name().(*parser.New_table_nameContext); ok { - name := newTable.Any_name().GetText() - return &ast.RenameTableStmt{ - Table: parseTableName(c), - NewName: &name, +func todo(funcname string, n 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 + } + return strings.ToLower(id) +} + +func NewIdentifier(t string) *ast.String { + return &ast.String{Str: identifier(t)} +} + +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 := identifier(newTable.Any_name().GetText()) + return &ast.RenameTableStmt{ + Table: parseTableName(n), + NewName: &name, + } + } + + if newCol, ok := n.GetNew_column_name().(*parser.Column_nameContext); ok { + name := identifier(newCol.Any_name().GetText()) + return &ast.RenameColumnStmt{ + Table: parseTableName(n), + Col: &ast.ColumnRef{ + Name: identifier(n.GetOld_column_name().GetText()), + }, + NewName: &name, + } } } - if newCol, ok := c.New_column_name().(*parser.New_column_nameContext); ok { - name := newCol.Any_name().GetText() - return &ast.RenameColumnStmt{ - Table: parseTableName(c), - Col: &ast.ColumnRef{ - Name: c.Column_name().GetText(), - }, - 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(), + }, + IsNotNull: hasNotNullConstraint(def.AllColumn_constraint()), + }, + }) + return stmt } } - if def, ok := c.Column_def().(*parser.Column_defContext); ok { + if n.DROP_() != nil { stmt := &ast.AlterTableStmt{ - Table: parseTableName(c), + Table: parseTableName(n), Cmds: &ast.List{}, } - name := def.Column_name().GetText() + name := n.Column_name(0).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(), - }, - }, + Subtype: ast.AT_DropColumn, }) return stmt } - return &ast.TODO{} + return todo("convertAlter_table_stmtContext", n) } -func convertAttach_stmtContext(c *parser.Attach_stmtContext) ast.Node { - name := c.Database_name().GetText() +func (c *cc) convertAttach_stmtContext(n *parser.Attach_stmtContext) ast.Node { + name := n.Schema_name().GetText() return &ast.CreateSchemaStmt{ Name: &name, } } -func convertCreate_table_stmtContext(c *parser.Create_table_stmtContext) ast.Node { +func (c *cc) convertCreate_table_stmtContext(n *parser.Create_table_stmtContext) ast.Node { stmt := &ast.CreateTableStmt{ - Name: parseTableName(c), - IfNotExists: c.K_EXISTS() != nil, + Name: parseTableName(n), + IfNotExists: n.EXISTS_() != nil, } - for _, idef := range c.AllColumn_def() { + 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: def.Column_name().GetText(), + Colname: identifier(def.Column_name().GetText()), IsNotNull: hasNotNullConstraint(def.AllColumn_constraint()), - TypeName: &ast.TypeName{Name: def.Type_name().GetText()}, + TypeName: &ast.TypeName{Name: typeName}, }) } } return stmt } -func convertDrop_table_stmtContext(c *parser.Drop_table_stmtContext) ast.Node { - return &ast.DropTableStmt{ - IfExists: c.K_EXISTS() != nil, - Tables: []*ast.TableName{parseTableName(c)}, +func (c *cc) convertCreate_virtual_table_stmtContext(n *parser.Create_virtual_table_stmtContext) ast.Node { + switch moduleName := n.Module_name().GetText(); moduleName { + case "fts5": + // https://www.sqlite.org/fts5.html + return c.convertCreate_virtual_table_fts5(n) + default: + return todo( + fmt.Sprintf("create_virtual_table. unsupported module name: %q", moduleName), + n, + ) } } -func convertExprContext(c *parser.ExprContext) ast.Node { - return &ast.TODO{} +func (c *cc) convertCreate_virtual_table_fts5(n *parser.Create_virtual_table_stmtContext) 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() + } + + 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"}, + }) + } + } + + return stmt } -func convertFactored_select_stmtContext(c *parser.Factored_select_stmtContext) ast.Node { - var tables []ast.Node - var cols []ast.Node - for _, icore := range c.AllSelect_core() { +func (c *cc) convertCreate_view_stmtContext(n *parser.Create_view_stmtContext) ast.Node { + viewName := n.View_name().GetText() + relation := &ast.RangeVar{ + Relname: &viewName, + } + + if n.Schema_name() != nil { + schemaName := n.Schema_name().GetText() + relation.Schemaname = &schemaName + } + + return &ast.ViewStmt{ + View: relation, + Aliases: &ast.List{}, + Query: c.convert(n.Select_stmt()), + 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) convertDelete_stmtContext(n Delete_stmt) ast.Node { + if qualifiedName, ok := n.Qualified_table_name().(*parser.Qualified_table_nameContext); ok { + + tableName := identifier(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 + } + + 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: identifier(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}, + } + } + return todo("convertDrop_stmtContext", n) +} + +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)) + } + args := &ast.List{Items: argNodes} + + 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(), + } + } + } + + return todo("convertFuncContext", n) +} + +func (c *cc) convertExprContext(n *parser.ExprContext) ast.Node { + return &ast.Expr{} +} + +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)) + } + } + if table, ok := n.Table_name().(*parser.Table_nameContext); ok { + tableName := table.GetText() + if tableName != "" { + items = append(items, NewIdentifier(tableName)) + } + } + items = append(items, NewIdentifier(n.Column_name().GetText())) + return &ast.ColumnRef{ + Fields: &ast.List{ + Items: items, + }, + Location: n.GetStart().GetStart(), + } +} + +func (c *cc) convertComparison(n *parser.Expr_comparisonContext) ast.Node { + lexpr := c.convert(n.Expr(0)) + + 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) + } + } + + return &ast.In{ + Expr: lexpr, + List: rexprs, + Not: false, + Sel: nil, + Location: n.GetStart().GetStart(), + } + } + + 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)), + } +} + +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, + }) + } + } + + var selectStmt *ast.SelectStmt + for s, icore := range n.AllSelect_core() { core, ok := icore.(*parser.Select_coreContext) if !ok { continue } - for _, icol := range core.AllResult_column() { - col, ok := icol.(*parser.Result_columnContext) - if !ok { - continue + 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++ + } + + 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-- } - var val ast.Node - iexpr := col.Expr() - switch { - case col.STAR() != nil: - val = &ast.ColumnRef{ - Fields: &ast.List{ - Items: []ast.Node{ - &ast.A_Star{}, - }, - }, - Location: col.GetStart().GetStart(), + + for i < l { + groups.Items = append(groups.Items, c.convert(core.Expr(i))) + i++ + } + } + 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{}, + }) + } } - case iexpr != nil: - val = convert(iexpr) + 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(), + }) } - if val == nil { - continue + } + 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 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, } - cols = append(cols, &ast.ResTarget{ - Val: val, - Location: col.GetStart().GetStart(), - }) } - for _, ifrom := range core.AllTable_or_subquery() { - from, ok := ifrom.(*parser.Table_or_subqueryContext) - if !ok { - continue + } + + limitCount, limitOffset := c.convertLimit_stmtContext(n.Limit_stmt()) + selectStmt.LimitCount = limitCount + selectStmt.LimitOffset = limitOffset + // Only set WithClause if there are CTEs + if len(ctes.Items) > 0 { + selectStmt.WithClause = &ast.WithClause{Ctes: &ctes} + } + return selectStmt +} + +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 +} + +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, } - rel := from.Table_name().GetText() - name := ast.RangeVar{ - Relname: &rel, - Location: from.GetStart().GetStart(), + jo := join.Join_operator(i) + if jo.NATURAL_() != nil { + joinExpr.IsNatural = true } - if from.Schema_name() != nil { - text := from.Schema_name().GetText() - name.Schemaname = &text + 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 + } + 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 { + continue + } + target := &ast.ResTarget{ + Location: col.GetStart().GetStart(), + } + var val ast.Node + iexpr := col.Expr() + switch { + case col.STAR() != nil: + val = c.convertWildCardField(col) + case iexpr != nil: + val = c.convert(iexpr) + } + + if val == nil { + continue + } + + if col.Column_alias() != nil { + name := identifier(col.Column_alias().GetText()) + target.Name = &name + } + + target.Val = val + cols = append(cols, target) + } + return cols +} + +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())) + } + items = append(items, &ast.A_Star{}) + + return &ast.ColumnRef{ + Fields: &ast.List{ + Items: items, + }, + Location: n.GetStart().GetStart(), + } +} + +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 } - tables = append(tables, &name) + list.Items = append(list.Items, &ast.CaseExpr{ + Xpr: c.convert(term.Expr()), + Location: term.Expr().GetStart().GetStart(), + }) } + return list + } + return todo("convertOrderby_stmtContext", n) +} + +func (c *cc) convertLimit_stmtContext(n parser.ILimit_stmtContext) (ast.Node, ast.Node) { + if n == nil { + return nil, nil } - return &ast.SelectStmt{ - FromClause: &ast.List{Items: tables}, - TargetList: &ast.List{Items: cols}, + + 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)) + } } + + return limitCount, limitOffset } -func convertSql_stmtContext(n *parser.Sql_stmtContext) ast.Node { +func (c *cc) convertSql_stmtContext(n *parser.Sql_stmtContext) ast.Node { if stmt := n.Alter_table_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Analyze_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Attach_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Begin_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Commit_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Compound_select_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Create_index_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Create_table_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Create_trigger_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Create_view_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Create_virtual_table_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Delete_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Delete_stmt_limited(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Detach_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Drop_index_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Drop_table_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Drop_trigger_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Drop_view_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } - if stmt := n.Factored_select_stmt(); stmt != nil { - return convert(stmt) + if stmt := n.Drop_stmt(); stmt != nil { + return c.convert(stmt) } if stmt := n.Insert_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Pragma_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Reindex_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Release_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Rollback_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Savepoint_stmt(); stmt != nil { - return convert(stmt) - } - if stmt := n.Simple_select_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Select_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Update_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Update_stmt_limited(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } if stmt := n.Vacuum_stmt(); stmt != nil { - return convert(stmt) + return c.convert(stmt) } return nil } -func convert(node node) ast.Node { +func (c *cc) convertLiteral(n *parser.Expr_literalContext) ast.Node { + if literal, ok := n.Literal_value().(*parser.Literal_valueContext); ok { + + if literal.NUMERIC_LITERAL() != nil { + i, _ := strconv.ParseInt(literal.GetText(), 10, 64) + return &ast.A_Const{ + Val: &ast.Integer{Ival: i}, + Location: n.GetStart().GetStart(), + } + } + + 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(), + } + } + + if literal.TRUE_() != nil || literal.FALSE_() != nil { + var i int64 + if literal.TRUE_() != nil { + i = 1 + } + + return &ast.A_Const{ + Val: &ast.Integer{Ival: i}, + Location: n.GetStart().GetStart(), + } + } + + if literal.NULL_() != nil { + return &ast.A_Const{ + Val: &ast.Null{}, + Location: n.GetStart().GetStart(), + } + } + } + return todo("convertLiteral", n) +} + +func (c *cc) convertBinaryNode(n *parser.Expr_binaryContext) ast.Node { + return &ast.A_Expr{ + Name: &ast.List{ + Items: []ast.Node{ + &ast.String{Str: n.GetChild(1).(antlr.TerminalNode).GetText()}, + }, + }, + Lexpr: c.convert(n.Expr(0)), + Rexpr: c.convert(n.Expr(1)), + } +} + +func (c *cc) convertBoolNode(n *parser.Expr_boolContext) ast.Node { + var op ast.BoolExprType + if n.AND_() != nil { + op = ast.BoolExprTypeAnd + } else if n.OR_() != nil { + op = ast.BoolExprTypeOr + } + return &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{ + Items: []ast.Node{ + c.convert(n.Expr(0)), + c.convert(n.Expr(1)), + }, + }, + } +} + +func (c *cc) convertUnaryExpr(n *parser.Expr_unaryContext) ast.Node { + op := n.Unary_operator() + if op == nil { + return c.convert(n.Expr()) + } + + // Get the inner expression + expr := c.convert(n.Expr()) + + // Check the operator type + if opCtx, ok := op.(*parser.Unary_operatorContext); ok { + if opCtx.NOT_() != nil { + // NOT expression + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{ + Items: []ast.Node{expr}, + }, + } + } + if opCtx.MINUS() != nil { + // Negative number: -expr + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "-"}}}, + Rexpr: expr, + } + } + if opCtx.PLUS() != nil { + // Positive number: +expr (just return expr) + return expr + } + if opCtx.TILDE() != nil { + // Bitwise NOT: ~expr + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "~"}}}, + Rexpr: expr, + } + } + } + + return expr +} + +func (c *cc) convertParam(n *parser.Expr_bindContext) ast.Node { + if n.NUMBERED_BIND_PARAMETER() != nil { + // Parameter numbers start at one + c.paramCount += 1 + + text := n.GetText() + number := c.paramCount + if len(text) > 1 { + number, _ = strconv.Atoi(text[1:]) + } + return &ast.ParamRef{ + Number: number, + Location: n.GetStart().GetStart(), + Dollar: len(text) > 1, + } + } + + 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(), + } + } + + return todo("convertParam", n) +} + +func (c *cc) convertInSelectNode(n *parser.Expr_in_selectContext) ast.Node { + // Check if this is EXISTS or NOT EXISTS + if n.EXISTS_() != nil { + linkType := ast.EXISTS_SUBLINK + sublink := &ast.SubLink{ + SubLinkType: linkType, + Subselect: c.convert(n.Select_stmt()), + } + if n.NOT_() != nil { + // NOT EXISTS is represented as a BoolExpr NOT wrapping the EXISTS + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{ + Items: []ast.Node{sublink}, + }, + } + } + return sublink + } + + // Check if this is an IN/NOT IN expression: expr IN (SELECT ...) + if n.IN_() != nil && len(n.AllExpr()) > 0 { + linkType := ast.ANY_SUBLINK + sublink := &ast.SubLink{ + SubLinkType: linkType, + Testexpr: c.convert(n.Expr(0)), + Subselect: c.convert(n.Select_stmt()), + } + if n.NOT_() != nil { + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "NOT IN"}}}, + Lexpr: c.convert(n.Expr(0)), + Rexpr: &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: c.convert(n.Select_stmt()), + }, + } + } + return sublink + } + + // Plain subquery in parentheses (SELECT ...) + return &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: 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 := identifier(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, + } + } + + insert := &ast.InsertStmt{ + Relation: rel, + Cols: c.convertColumnNames(n.AllColumn_name()), + ReturningList: c.convertReturning_caluseContext(n.Returning_clause()), + } + + // Check if this is a DEFAULT VALUES insert + hasDefaultValues := false + for _, child := range n.GetChildren() { + if term, ok := child.(antlr.TerminalNode); ok { + if term.GetSymbol().GetTokenType() == parser.SQLiteParserDEFAULT_ { + hasDefaultValues = true + break + } + } + } + + if hasDefaultValues { + // For DEFAULT VALUES, set the flag instead of creating an empty values list + insert.DefaultValues = true + } else 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)) + } + } + } + + insert.SelectStmt = &ast.SelectStmt{ + FromClause: &ast.List{}, + TargetList: &ast.List{}, + ValuesLists: &valuesLists, + } + } + + return insert +} + +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, + }) + } + return list +} + +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 + } + + if from.Table_name() != nil { + rel := identifier(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() + // Convert function arguments + var args []ast.Node + for _, expr := range from.AllExpr() { + args = append(args, c.convert(expr)) + } + 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: args, + }, + 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) + } + } + + 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) convertUpdate_stmtContext(n Update_stmt) ast.Node { + if n == nil { + return nil + } + + relations := &ast.List{} + tableName := identifier(n.Qualified_table_name().GetText()) + rel := ast.RangeVar{ + Relname: &tableName, + Location: n.GetStart().GetStart(), + } + 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) + } + + var where ast.Node = nil + if n.WHERE_() != nil { + where = c.convert(n.Expr(len(n.AllExpr()) - 1)) + } + + stmt := &ast.UpdateStmt{ + Relations: relations, + TargetList: list, + WhereClause: where, + FromClause: &ast.List{}, + WithClause: nil, // TODO: support with clause + } + 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, ok := n.(interface { + Limit_stmt() parser.ILimit_stmtContext + }); ok { + limitCount, _ := c.convertLimit_stmtContext(n.Limit_stmt()) + stmt.LimitCount = limitCount + } + return stmt +} + +func (c *cc) convertBetweenExpr(n *parser.Expr_betweenContext) 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, + } +} + +func (c *cc) convertCastExpr(n *parser.Expr_castContext) ast.Node { + name := n.Type_name().GetText() + return &ast.TypeCast{ + Arg: c.convert(n.Expr()), + TypeName: &ast.TypeName{ + Name: name, + Names: &ast.List{Items: []ast.Node{ + NewIdentifier(name), + }}, + ArrayBounds: &ast.List{}, + }, + Location: n.GetStart().GetStart(), + } +} + +func (c *cc) convertCollateExpr(n *parser.Expr_collateContext) ast.Node { + return &ast.CollateExpr{ + Xpr: c.convert(n.Expr()), + Arg: NewIdentifier(n.Collation_name().GetText()), + Location: n.GetStart().GetStart(), + } +} + +func (c *cc) convertCase(n *parser.Expr_caseContext) ast.Node { + e := &ast.CaseExpr{ + Args: &ast.List{}, + } + es := n.AllExpr() + if n.ELSE_() != nil { + e.Defresult = c.convert(es[len(es)-1]) + es = es[:len(es)-1] + } + if len(es)%2 == 1 { + e.Arg = c.convert(es[0]) + es = es[1:] + } + for i := 0; i < len(es); i += 2 { + e.Args.Items = append(e.Args.Items, &ast.CaseWhen{ + Expr: c.convert(es[i+0]), + Result: c.convert(es[i+1]), + }) + } + return e +} + +func (c *cc) convert(node node) ast.Node { switch n := node.(type) { case *parser.Alter_table_stmtContext: - return convertAlter_table_stmtContext(n) + return c.convertAlter_table_stmtContext(n) case *parser.Attach_stmtContext: - return convertAttach_stmtContext(n) + return c.convertAttach_stmtContext(n) case *parser.Create_table_stmtContext: - return convertCreate_table_stmtContext(n) + 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_table_stmtContext: - return convertDrop_table_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 convertExprContext(n) + 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_boolContext: + return c.convertBoolNode(n) + + case *parser.Expr_listContext: + return c.convertExprListContext(n) + + case *parser.Expr_binaryContext: + return c.convertBinaryNode(n) + + case *parser.Expr_unaryContext: + return c.convertUnaryExpr(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: - return convertFactored_select_stmtContext(n) + // 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 convertSql_stmtContext(n) + return c.convertSql_stmtContext(n) + + case *parser.Update_stmtContext: + return c.convertUpdate_stmtContext(n) + + case *parser.Update_stmt_limitedContext: + return c.convertUpdate_stmtContext(n) + + case *parser.Expr_castContext: + return c.convertCastExpr(n) + + case *parser.Expr_caseContext: + return c.convertCase(n) default: - return &ast.TODO{} + return todo("convert(case=default)", n) } } diff --git a/internal/engine/sqlite/format.go b/internal/engine/sqlite/format.go new file mode 100644 index 0000000000..39ac859ca5 --- /dev/null +++ b/internal/engine/sqlite/format.go @@ -0,0 +1,35 @@ +package sqlite + +// QuoteIdent returns a quoted identifier if it needs quoting. +// SQLite uses double quotes for quoting identifiers (SQL standard), +// though backticks are also supported for MySQL compatibility. +func (p *Parser) QuoteIdent(s string) string { + // For now, don't quote - return as-is + 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. +// SQLite uses ? for positional parameters. +func (p *Parser) Param(n int) string { + return "?" +} + +// NamedParam returns the named parameter placeholder for the given name. +// SQLite uses :name syntax for named parameters. +func (p *Parser) NamedParam(name string) string { + return ":" + name +} + +// 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 91746abe93..13425b156e 100644 --- a/internal/engine/sqlite/parse.go +++ b/internal/engine/sqlite/parse.go @@ -4,13 +4,11 @@ import ( "errors" "fmt" "io" - "io/ioutil" - "github.com/antlr/antlr4/runtime/Go/antlr" - - "github.com/kyleconroy/sqlc/internal/engine/sqlite/parser" - "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/antlr4-go/antlr/v4" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) type errorListener struct { @@ -40,7 +38,7 @@ type Parser struct { } func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - blob, err := ioutil.ReadAll(r) + blob, err := io.ReadAll(r) if err != nil { return nil, err } @@ -66,26 +64,32 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { return nil, fmt.Errorf("expected Sql_stmt_listContext; got %T\n", istmt) } loc := 0 + for _, stmt := range list.AllSql_stmt() { - out := convert(stmt) + converter := &cc{} + out := converter.convert(stmt) if _, ok := out.(*ast.TODO); ok { + loc = stmt.GetStop().GetStop() + 2 continue } + len := (stmt.GetStop().GetStop() + 1) - loc stmts = append(stmts, ast.Statement{ Raw: &ast.RawStmt{ Stmt: out, StmtLocation: loc, - StmtLen: stmt.GetStop().GetStop() - loc + 1, + StmtLen: len, }, }) - loc = stmt.GetStop().GetStop() - loc + loc = stmt.GetStop().GetStop() + 2 } } return stmts, nil } -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ - Dash: true, +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 new file mode 100644 index 0000000000..960048667f --- /dev/null +++ b/internal/engine/sqlite/parser/.gitignore @@ -0,0 +1,2 @@ + +antlr-4.12.0-complete.jar diff --git a/internal/engine/sqlite/parser/Makefile b/internal/engine/sqlite/parser/Makefile index c4644188c3..bacae8a36b 100644 --- a/internal/engine/sqlite/parser/Makefile +++ b/internal/engine/sqlite/parser/Makefile @@ -1,2 +1,7 @@ -sqlite_parser.go: SQLite.g4 - antlr -Dlanguage=Go SQLite.g4 +sqlite_parser.go: SQLiteLexer.g4 SQLiteParser.g4 antlr-4.13.1-complete.jar + java -jar antlr-4.13.1-complete.jar -Dlanguage=Go SQLiteLexer.g4 SQLiteParser.g4 + +antlr-4.13.1-complete.jar: + curl -O https://www.antlr.org/download/antlr-4.13.1-complete.jar + + diff --git a/internal/engine/sqlite/parser/SQLite.g4 b/internal/engine/sqlite/parser/SQLite.g4 deleted file mode 100644 index 74426fb8ad..0000000000 --- a/internal/engine/sqlite/parser/SQLite.g4 +++ /dev/null @@ -1,909 +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 - */ -grammar SQLite; - -parse - : ( sql_stmt_list )* EOF - ; - -sql_stmt_list - : ';'* sql_stmt ( ';'+ sql_stmt )* ';'* - ; - -sql_stmt - : ( K_EXPLAIN ( K_QUERY K_PLAN )? )? ( alter_table_stmt - | analyze_stmt - | attach_stmt - | begin_stmt - | commit_stmt - | compound_select_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_index_stmt - | drop_table_stmt - | drop_trigger_stmt - | drop_view_stmt - | factored_select_stmt - | insert_stmt - | pragma_stmt - | reindex_stmt - | release_stmt - | rollback_stmt - | savepoint_stmt - | simple_select_stmt - | select_stmt - | update_stmt - | update_stmt_limited - | vacuum_stmt ) - ; - -alter_table_stmt - : K_ALTER K_TABLE ( database_name '.' )? table_name - ( K_RENAME K_TO new_table_name - | K_RENAME K_COLUMN? column_name K_TO new_column_name - | K_ADD K_COLUMN? column_def - ) - ; - -analyze_stmt - : K_ANALYZE ( database_name | table_or_index_name | database_name '.' table_or_index_name )? - ; - -attach_stmt - : K_ATTACH K_DATABASE? expr K_AS database_name - ; - -begin_stmt - : K_BEGIN ( K_DEFERRED | K_IMMEDIATE | K_EXCLUSIVE )? ( K_TRANSACTION transaction_name? )? - ; - -commit_stmt - : ( K_COMMIT | K_END ) ( K_TRANSACTION transaction_name? )? - ; - -compound_select_stmt - : with_clause? - select_core ( ( K_UNION K_ALL? | K_INTERSECT | K_EXCEPT ) select_core )+ - ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? - ; - -create_index_stmt - : K_CREATE K_UNIQUE? K_INDEX ( K_IF K_NOT K_EXISTS )? - ( database_name '.' )? index_name K_ON table_name '(' indexed_column ( ',' indexed_column )* ')' - ( K_WHERE expr )? - ; - -create_table_stmt - : K_CREATE ( K_TEMP | K_TEMPORARY )? K_TABLE ( K_IF K_NOT K_EXISTS )? - ( database_name '.' )? table_name - ( '(' column_def ( ',' column_def )*? ( ',' table_constraint )* ')' ( K_WITHOUT IDENTIFIER )? - | K_AS select_stmt - ) - ; - -create_trigger_stmt - : K_CREATE ( K_TEMP | K_TEMPORARY )? K_TRIGGER ( K_IF K_NOT K_EXISTS )? - ( database_name '.' )? trigger_name ( K_BEFORE | K_AFTER | K_INSTEAD K_OF )? - ( K_DELETE | K_INSERT | K_UPDATE ( K_OF column_name ( ',' column_name )* )? ) K_ON ( database_name '.' )? table_name - ( K_FOR K_EACH K_ROW )? ( K_WHEN expr )? - K_BEGIN ( ( update_stmt | insert_stmt | delete_stmt | select_stmt ) ';' )+ K_END - ; - -create_view_stmt - : K_CREATE ( K_TEMP | K_TEMPORARY )? K_VIEW ( K_IF K_NOT K_EXISTS )? - ( database_name '.' )? view_name K_AS select_stmt - ; - -create_virtual_table_stmt - : K_CREATE K_VIRTUAL K_TABLE ( K_IF K_NOT K_EXISTS )? - ( database_name '.' )? table_name - K_USING module_name ( '(' module_argument ( ',' module_argument )* ')' )? - ; - -delete_stmt - : with_clause? K_DELETE K_FROM qualified_table_name - ( K_WHERE expr )? - ; - -delete_stmt_limited - : with_clause? K_DELETE K_FROM qualified_table_name - ( K_WHERE expr )? - ( ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? - )? - ; - -detach_stmt - : K_DETACH K_DATABASE? database_name - ; - -drop_index_stmt - : K_DROP K_INDEX ( K_IF K_EXISTS )? ( database_name '.' )? index_name - ; - -drop_table_stmt - : K_DROP K_TABLE ( K_IF K_EXISTS )? ( database_name '.' )? table_name - ; - -drop_trigger_stmt - : K_DROP K_TRIGGER ( K_IF K_EXISTS )? ( database_name '.' )? trigger_name - ; - -drop_view_stmt - : K_DROP K_VIEW ( K_IF K_EXISTS )? ( database_name '.' )? view_name - ; - -factored_select_stmt - : with_clause? - select_core ( compound_operator select_core )* - ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? - ; - -insert_stmt - : with_clause? ( K_INSERT - | K_REPLACE - | K_INSERT K_OR K_REPLACE - | K_INSERT K_OR K_ROLLBACK - | K_INSERT K_OR K_ABORT - | K_INSERT K_OR K_FAIL - | K_INSERT K_OR K_IGNORE ) K_INTO - ( database_name '.' )? table_name ( '(' column_name ( ',' column_name )* ')' )? - ( K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* - | select_stmt - | K_DEFAULT K_VALUES - ) - ; - -pragma_stmt - : K_PRAGMA ( database_name '.' )? pragma_name ( '=' pragma_value - | '(' pragma_value ')' )? - ; - -reindex_stmt - : K_REINDEX ( collation_name - | ( database_name '.' )? ( table_name | index_name ) - )? - ; - -release_stmt - : K_RELEASE K_SAVEPOINT? savepoint_name - ; - -rollback_stmt - : K_ROLLBACK ( K_TRANSACTION transaction_name? )? ( K_TO K_SAVEPOINT? savepoint_name )? - ; - -savepoint_stmt - : K_SAVEPOINT savepoint_name - ; - -simple_select_stmt - : with_clause? - select_core ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? - ; - -select_stmt - : with_clause? - select_or_values ( compound_operator select_or_values )* - ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? - ; - -select_or_values - : K_SELECT ( K_DISTINCT | K_ALL )? result_column ( ',' result_column )* - ( K_FROM ( table_or_subquery ( ',' table_or_subquery )* | join_clause ) )? - ( K_WHERE expr )? - ( K_GROUP K_BY expr ( ',' expr )* ( K_HAVING expr )? )? - | K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* - ; - -update_stmt - : with_clause? K_UPDATE ( K_OR K_ROLLBACK - | K_OR K_ABORT - | K_OR K_REPLACE - | K_OR K_FAIL - | K_OR K_IGNORE )? qualified_table_name - K_SET column_name '=' expr ( ',' column_name '=' expr )* ( K_WHERE expr )? - ; - -update_stmt_limited - : with_clause? K_UPDATE ( K_OR K_ROLLBACK - | K_OR K_ABORT - | K_OR K_REPLACE - | K_OR K_FAIL - | K_OR K_IGNORE )? qualified_table_name - K_SET column_name '=' expr ( ',' column_name '=' expr )* ( K_WHERE expr )? - ( ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? - K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? - )? - ; - -vacuum_stmt - : K_VACUUM - ; - -column_def - : column_name type_name? column_constraint* - ; - -type_name - : name+? ( '(' signed_number ')' - | '(' signed_number ',' signed_number ')' )? - ; - -column_constraint - : ( K_CONSTRAINT name )? - ( K_PRIMARY K_KEY ( K_ASC | K_DESC )? conflict_clause K_AUTOINCREMENT? - | K_NOT? K_NULL conflict_clause - | K_UNIQUE conflict_clause - | K_CHECK '(' expr ')' - | K_DEFAULT (signed_number | literal_value | '(' expr ')') - | K_COLLATE collation_name - | foreign_key_clause - ) - ; - -conflict_clause - : ( K_ON K_CONFLICT ( K_ROLLBACK - | K_ABORT - | K_FAIL - | K_IGNORE - | K_REPLACE - ) - )? - ; - -/* - 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 - | BIND_PARAMETER - | ( ( database_name '.' )? table_name '.' )? column_name - | unary_operator expr - | expr '||' expr - | expr ( '*' | '/' | '%' ) expr - | expr ( '+' | '-' ) expr - | expr ( '<<' | '>>' | '&' | '|' ) expr - | expr ( '<' | '<=' | '>' | '>=' ) expr - | expr ( '=' | '==' | '!=' | '<>' ) expr - | expr K_NOT? K_IN ( '(' ( select_stmt - | expr ( ',' expr )* - )? - ')' - | ( database_name '.' )? table_name ) - | expr K_AND expr - | expr K_OR expr - | function_name '(' ( K_DISTINCT? expr ( ',' expr )* | '*' )? ')' - | '(' expr ')' - | K_CAST '(' expr K_AS type_name ')' - | expr K_COLLATE collation_name - | expr K_NOT? ( K_LIKE | K_GLOB | K_REGEXP | K_MATCH ) expr ( K_ESCAPE expr )? - | expr ( K_ISNULL | K_NOTNULL | K_NOT K_NULL ) - | expr K_IS K_NOT? expr - | expr K_NOT? K_BETWEEN expr K_AND expr - | ( ( K_NOT )? K_EXISTS )? '(' select_stmt ')' - | K_CASE expr? ( K_WHEN expr K_THEN expr )+ ( K_ELSE expr )? K_END - | raise_function - ; - -foreign_key_clause - : K_REFERENCES foreign_table ( '(' column_name ( ',' column_name )* ')' )? - ( ( K_ON ( K_DELETE | K_UPDATE ) ( K_SET K_NULL - | K_SET K_DEFAULT - | K_CASCADE - | K_RESTRICT - | K_NO K_ACTION ) - | K_MATCH name - ) - )* - ( K_NOT? K_DEFERRABLE ( K_INITIALLY K_DEFERRED | K_INITIALLY K_IMMEDIATE )? )? - ; - -raise_function - : K_RAISE '(' ( K_IGNORE - | ( K_ROLLBACK | K_ABORT | K_FAIL ) ',' error_message ) - ')' - ; - -indexed_column - : column_name ( K_COLLATE collation_name )? ( K_ASC | K_DESC )? - ; - -table_constraint - : ( K_CONSTRAINT name )? - ( ( K_PRIMARY K_KEY | K_UNIQUE ) '(' indexed_column ( ',' indexed_column )* ')' conflict_clause - | K_CHECK '(' expr ')' - | K_FOREIGN K_KEY '(' column_name ( ',' column_name )* ')' foreign_key_clause - ) - ; - -with_clause - : K_WITH K_RECURSIVE? common_table_expression ( ',' common_table_expression )* - ; - -qualified_table_name - : ( database_name '.' )? table_name ( K_INDEXED K_BY index_name - | K_NOT K_INDEXED )? - ; - -ordering_term - : expr ( K_COLLATE collation_name )? ( K_ASC | K_DESC )? - ; - -pragma_value - : signed_number - | name - | STRING_LITERAL - ; - -common_table_expression - : table_name ( '(' column_name ( ',' column_name )* ')' )? K_AS '(' select_stmt ')' - ; - -result_column - : '*' - | table_name '.' '*' - | expr ( K_AS? column_alias )? - ; - -table_or_subquery - : ( schema_name '.' )? table_name ( K_AS? table_alias )? - ( K_INDEXED K_BY index_name - | K_NOT K_INDEXED )? - | ( schema_name '.' )? table_function_name '(' ( expr ( ',' expr )* )? ')' ( K_AS? table_alias )? - | '(' ( table_or_subquery ( ',' table_or_subquery )* - | join_clause ) - ')' - | '(' select_stmt ')' ( K_AS? table_alias )? - ; - -join_clause - : table_or_subquery ( join_operator table_or_subquery join_constraint )* - ; - -join_operator - : ',' - | K_NATURAL? ( K_LEFT K_OUTER? | K_INNER | K_CROSS )? K_JOIN - ; - -join_constraint - : ( K_ON expr - | K_USING '(' column_name ( ',' column_name )* ')' )? - ; - -select_core - : K_SELECT ( K_DISTINCT | K_ALL )? result_column ( ',' result_column )* - ( K_FROM ( table_or_subquery ( ',' table_or_subquery )* | join_clause ) )? - ( K_WHERE expr )? - ( K_GROUP K_BY expr ( ',' expr )* ( K_HAVING expr )? )? - | K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* - ; - -compound_operator - : K_UNION - | K_UNION K_ALL - | K_INTERSECT - | K_EXCEPT - ; - -signed_number - : ( '+' | '-' )? NUMERIC_LITERAL - ; - -literal_value - : NUMERIC_LITERAL - | STRING_LITERAL - | BLOB_LITERAL - | K_NULL - | K_CURRENT_TIME - | K_CURRENT_DATE - | K_CURRENT_TIMESTAMP - ; - -unary_operator - : '-' - | '+' - | '~' - | K_NOT - ; - -error_message - : STRING_LITERAL - ; - -module_argument // TODO check what exactly is permitted here - : expr - | column_def - ; - -column_alias - : IDENTIFIER - | STRING_LITERAL - ; - -keyword - : K_ABORT - | K_ACTION - | K_ADD - | K_AFTER - | K_ALL - | K_ALTER - | K_ANALYZE - | K_AND - | K_AS - | K_ASC - | K_ATTACH - | K_AUTOINCREMENT - | K_BEFORE - | K_BEGIN - | K_BETWEEN - | K_BY - | K_CASCADE - | K_CASE - | K_CAST - | K_CHECK - | K_COLLATE - | K_COLUMN - | K_COMMIT - | K_CONFLICT - | K_CONSTRAINT - | K_CREATE - | K_CROSS - | K_CURRENT_DATE - | K_CURRENT_TIME - | K_CURRENT_TIMESTAMP - | K_DATABASE - | K_DEFAULT - | K_DEFERRABLE - | K_DEFERRED - | K_DELETE - | K_DESC - | K_DETACH - | K_DISTINCT - | K_DROP - | K_EACH - | K_ELSE - | K_END - | K_ESCAPE - | K_EXCEPT - | K_EXCLUSIVE - | K_EXISTS - | K_EXPLAIN - | K_FAIL - | K_FOR - | K_FOREIGN - | K_FROM - | K_FULL - | K_GLOB - | K_GROUP - | K_HAVING - | K_IF - | K_IGNORE - | K_IMMEDIATE - | K_IN - | K_INDEX - | K_INDEXED - | K_INITIALLY - | K_INNER - | K_INSERT - | K_INSTEAD - | K_INTERSECT - | K_INTO - | K_IS - | K_ISNULL - | K_JOIN - | K_KEY - | K_LEFT - | K_LIKE - | K_LIMIT - | K_MATCH - | K_NATURAL - | K_NO - | K_NOT - | K_NOTNULL - | K_NULL - | K_OF - | K_OFFSET - | K_ON - | K_OR - | K_ORDER - | K_OUTER - | K_PLAN - | K_PRAGMA - | K_PRIMARY - | K_QUERY - | K_RAISE - | K_RECURSIVE - | K_REFERENCES - | K_REGEXP - | K_REINDEX - | K_RELEASE - | K_RENAME - | K_REPLACE - | K_RESTRICT - | K_RIGHT - | K_ROLLBACK - | K_ROW - | K_SAVEPOINT - | K_SELECT - | K_SET - | K_TABLE - | K_TEMP - | K_TEMPORARY - | K_THEN - | K_TO - | K_TRANSACTION - | K_TRIGGER - | K_UNION - | K_UNIQUE - | K_UPDATE - | K_USING - | K_VACUUM - | K_VALUES - | K_VIEW - | K_VIRTUAL - | K_WHEN - | K_WHERE - | K_WITH - | K_WITHOUT - ; - -// TODO check all names below - -name - : any_name - ; - -function_name - : any_name - ; - -database_name - : any_name - ; - -schema_name - : any_name - ; - -table_function_name - : any_name - ; - -table_name - : any_name - ; - -table_or_index_name - : any_name - ; - -new_table_name - : any_name - ; - -column_name - : any_name - ; - -new_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 ')' - ; - -transaction_name - : any_name - ; - -any_name - : IDENTIFIER - | keyword - | STRING_LITERAL - | '(' any_name ')' - ; - -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 -K_ABORT : A B O R T; -K_ACTION : A C T I O N; -K_ADD : A D D; -K_AFTER : A F T E R; -K_ALL : A L L; -K_ALTER : A L T E R; -K_ANALYZE : A N A L Y Z E; -K_AND : A N D; -K_AS : A S; -K_ASC : A S C; -K_ATTACH : A T T A C H; -K_AUTOINCREMENT : A U T O I N C R E M E N T; -K_BEFORE : B E F O R E; -K_BEGIN : B E G I N; -K_BETWEEN : B E T W E E N; -K_BY : B Y; -K_CASCADE : C A S C A D E; -K_CASE : C A S E; -K_CAST : C A S T; -K_CHECK : C H E C K; -K_COLLATE : C O L L A T E; -K_COLUMN : C O L U M N; -K_COMMIT : C O M M I T; -K_CONFLICT : C O N F L I C T; -K_CONSTRAINT : C O N S T R A I N T; -K_CREATE : C R E A T E; -K_CROSS : C R O S S; -K_CURRENT_DATE : C U R R E N T '_' D A T E; -K_CURRENT_TIME : C U R R E N T '_' T I M E; -K_CURRENT_TIMESTAMP : C U R R E N T '_' T I M E S T A M P; -K_DATABASE : D A T A B A S E; -K_DEFAULT : D E F A U L T; -K_DEFERRABLE : D E F E R R A B L E; -K_DEFERRED : D E F E R R E D; -K_DELETE : D E L E T E; -K_DESC : D E S C; -K_DETACH : D E T A C H; -K_DISTINCT : D I S T I N C T; -K_DROP : D R O P; -K_EACH : E A C H; -K_ELSE : E L S E; -K_END : E N D; -K_ESCAPE : E S C A P E; -K_EXCEPT : E X C E P T; -K_EXCLUSIVE : E X C L U S I V E; -K_EXISTS : E X I S T S; -K_EXPLAIN : E X P L A I N; -K_FAIL : F A I L; -K_FOR : F O R; -K_FOREIGN : F O R E I G N; -K_FROM : F R O M; -K_FULL : F U L L; -K_GLOB : G L O B; -K_GROUP : G R O U P; -K_HAVING : H A V I N G; -K_IF : I F; -K_IGNORE : I G N O R E; -K_IMMEDIATE : I M M E D I A T E; -K_IN : I N; -K_INDEX : I N D E X; -K_INDEXED : I N D E X E D; -K_INITIALLY : I N I T I A L L Y; -K_INNER : I N N E R; -K_INSERT : I N S E R T; -K_INSTEAD : I N S T E A D; -K_INTERSECT : I N T E R S E C T; -K_INTO : I N T O; -K_IS : I S; -K_ISNULL : I S N U L L; -K_JOIN : J O I N; -K_KEY : K E Y; -K_LEFT : L E F T; -K_LIKE : L I K E; -K_LIMIT : L I M I T; -K_MATCH : M A T C H; -K_NATURAL : N A T U R A L; -K_NO : N O; -K_NOT : N O T; -K_NOTNULL : N O T N U L L; -K_NULL : N U L L; -K_OF : O F; -K_OFFSET : O F F S E T; -K_ON : O N; -K_OR : O R; -K_ORDER : O R D E R; -K_OUTER : O U T E R; -K_PLAN : P L A N; -K_PRAGMA : P R A G M A; -K_PRIMARY : P R I M A R Y; -K_QUERY : Q U E R Y; -K_RAISE : R A I S E; -K_RECURSIVE : R E C U R S I V E; -K_REFERENCES : R E F E R E N C E S; -K_REGEXP : R E G E X P; -K_REINDEX : R E I N D E X; -K_RELEASE : R E L E A S E; -K_RENAME : R E N A M E; -K_REPLACE : R E P L A C E; -K_RESTRICT : R E S T R I C T; -K_RIGHT : R I G H T; -K_ROLLBACK : R O L L B A C K; -K_ROW : R O W; -K_SAVEPOINT : S A V E P O I N T; -K_SELECT : S E L E C T; -K_SET : S E T; -K_TABLE : T A B L E; -K_TEMP : T E M P; -K_TEMPORARY : T E M P O R A R Y; -K_THEN : T H E N; -K_TO : T O; -K_TRANSACTION : T R A N S A C T I O N; -K_TRIGGER : T R I G G E R; -K_UNION : U N I O N; -K_UNIQUE : U N I Q U E; -K_UPDATE : U P D A T E; -K_USING : U S I N G; -K_VACUUM : V A C U U M; -K_VALUES : V A L U E S; -K_VIEW : V I E W; -K_VIRTUAL : V I R T U A L; -K_WHEN : W H E N; -K_WHERE : W H E R E; -K_WITH : W I T H; -K_WITHOUT : W I T H O U T; - -IDENTIFIER - : '"' (~'"' | '""')* '"' - | '`' (~'`' | '``')* '`' - | '[' ~']'* ']' - | [a-zA-Z_] [a-zA-Z_0-9]* // TODO check: needs more chars in set - ; - -NUMERIC_LITERAL - : DIGIT+ ( '.' DIGIT* )? ( E [-+]? DIGIT+ )? - | '.' DIGIT+ ( E [-+]? DIGIT+ )? - ; - -BIND_PARAMETER - : '?' DIGIT* - | [:@$] IDENTIFIER - ; - -STRING_LITERAL - : '\'' ( ~'\'' | '\'\'' )* '\'' - ; - -BLOB_LITERAL - : X STRING_LITERAL - ; - -SINGLE_LINE_COMMENT - : '--' ~[\r\n]* -> channel(HIDDEN) - ; - -MULTILINE_COMMENT - : '/*' .*? ( '*/' | EOF ) -> channel(HIDDEN) - ; - -SPACES - : [ \u000B\t\r\n] -> channel(HIDDEN) - ; - -UNEXPECTED_CHAR - : . - ; - -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/SQLite.interp b/internal/engine/sqlite/parser/SQLite.interp deleted file mode 100644 index a7cead0848..0000000000 --- a/internal/engine/sqlite/parser/SQLite.interp +++ /dev/null @@ -1,408 +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 - -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 -K_ABORT -K_ACTION -K_ADD -K_AFTER -K_ALL -K_ALTER -K_ANALYZE -K_AND -K_AS -K_ASC -K_ATTACH -K_AUTOINCREMENT -K_BEFORE -K_BEGIN -K_BETWEEN -K_BY -K_CASCADE -K_CASE -K_CAST -K_CHECK -K_COLLATE -K_COLUMN -K_COMMIT -K_CONFLICT -K_CONSTRAINT -K_CREATE -K_CROSS -K_CURRENT_DATE -K_CURRENT_TIME -K_CURRENT_TIMESTAMP -K_DATABASE -K_DEFAULT -K_DEFERRABLE -K_DEFERRED -K_DELETE -K_DESC -K_DETACH -K_DISTINCT -K_DROP -K_EACH -K_ELSE -K_END -K_ESCAPE -K_EXCEPT -K_EXCLUSIVE -K_EXISTS -K_EXPLAIN -K_FAIL -K_FOR -K_FOREIGN -K_FROM -K_FULL -K_GLOB -K_GROUP -K_HAVING -K_IF -K_IGNORE -K_IMMEDIATE -K_IN -K_INDEX -K_INDEXED -K_INITIALLY -K_INNER -K_INSERT -K_INSTEAD -K_INTERSECT -K_INTO -K_IS -K_ISNULL -K_JOIN -K_KEY -K_LEFT -K_LIKE -K_LIMIT -K_MATCH -K_NATURAL -K_NO -K_NOT -K_NOTNULL -K_NULL -K_OF -K_OFFSET -K_ON -K_OR -K_ORDER -K_OUTER -K_PLAN -K_PRAGMA -K_PRIMARY -K_QUERY -K_RAISE -K_RECURSIVE -K_REFERENCES -K_REGEXP -K_REINDEX -K_RELEASE -K_RENAME -K_REPLACE -K_RESTRICT -K_RIGHT -K_ROLLBACK -K_ROW -K_SAVEPOINT -K_SELECT -K_SET -K_TABLE -K_TEMP -K_TEMPORARY -K_THEN -K_TO -K_TRANSACTION -K_TRIGGER -K_UNION -K_UNIQUE -K_UPDATE -K_USING -K_VACUUM -K_VALUES -K_VIEW -K_VIRTUAL -K_WHEN -K_WHERE -K_WITH -K_WITHOUT -IDENTIFIER -NUMERIC_LITERAL -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 -compound_select_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_index_stmt -drop_table_stmt -drop_trigger_stmt -drop_view_stmt -factored_select_stmt -insert_stmt -pragma_stmt -reindex_stmt -release_stmt -rollback_stmt -savepoint_stmt -simple_select_stmt -select_stmt -select_or_values -update_stmt -update_stmt_limited -vacuum_stmt -column_def -type_name -column_constraint -conflict_clause -expr -foreign_key_clause -raise_function -indexed_column -table_constraint -with_clause -qualified_table_name -ordering_term -pragma_value -common_table_expression -result_column -table_or_subquery -join_clause -join_operator -join_constraint -select_core -compound_operator -signed_number -literal_value -unary_operator -error_message -module_argument -column_alias -keyword -name -function_name -database_name -schema_name -table_function_name -table_name -table_or_index_name -new_table_name -column_name -new_column_name -collation_name -foreign_table -index_name -trigger_name -view_name -module_name -pragma_name -savepoint_name -table_alias -transaction_name -any_name - - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 159, 1691, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 3, 2, 7, 2, 170, 10, 2, 12, 2, 14, 2, 173, 11, 2, 3, 2, 3, 2, 3, 3, 7, 3, 178, 10, 3, 12, 3, 14, 3, 181, 11, 3, 3, 3, 3, 3, 6, 3, 185, 10, 3, 13, 3, 14, 3, 186, 3, 3, 7, 3, 190, 10, 3, 12, 3, 14, 3, 193, 11, 3, 3, 3, 7, 3, 196, 10, 3, 12, 3, 14, 3, 199, 11, 3, 3, 4, 3, 4, 3, 4, 5, 4, 204, 10, 4, 5, 4, 206, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 238, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 245, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 253, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 261, 10, 5, 3, 5, 5, 5, 264, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 273, 10, 6, 3, 7, 3, 7, 5, 7, 277, 10, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 285, 10, 8, 3, 8, 3, 8, 5, 8, 289, 10, 8, 5, 8, 291, 10, 8, 3, 9, 3, 9, 3, 9, 5, 9, 296, 10, 9, 5, 9, 298, 10, 9, 3, 10, 5, 10, 301, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 306, 10, 10, 3, 10, 3, 10, 5, 10, 310, 10, 10, 3, 10, 6, 10, 313, 10, 10, 13, 10, 14, 10, 314, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 7, 10, 322, 10, 10, 12, 10, 14, 10, 325, 11, 10, 5, 10, 327, 10, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 333, 10, 10, 5, 10, 335, 10, 10, 3, 11, 3, 11, 5, 11, 339, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 345, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 350, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 359, 10, 11, 12, 11, 14, 11, 362, 11, 11, 3, 11, 3, 11, 3, 11, 5, 11, 367, 10, 11, 3, 12, 3, 12, 5, 12, 371, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 377, 10, 12, 3, 12, 3, 12, 3, 12, 5, 12, 382, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 389, 10, 12, 12, 12, 14, 12, 392, 11, 12, 3, 12, 3, 12, 7, 12, 396, 10, 12, 12, 12, 14, 12, 399, 11, 12, 3, 12, 3, 12, 3, 12, 5, 12, 404, 10, 12, 3, 12, 3, 12, 5, 12, 408, 10, 12, 3, 13, 3, 13, 5, 13, 412, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 418, 10, 13, 3, 13, 3, 13, 3, 13, 5, 13, 423, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 430, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 439, 10, 13, 12, 13, 14, 13, 442, 11, 13, 5, 13, 444, 10, 13, 5, 13, 446, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 452, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 458, 10, 13, 3, 13, 3, 13, 5, 13, 462, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 469, 10, 13, 3, 13, 3, 13, 6, 13, 473, 10, 13, 13, 13, 14, 13, 474, 3, 13, 3, 13, 3, 14, 3, 14, 5, 14, 481, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 487, 10, 14, 3, 14, 3, 14, 3, 14, 5, 14, 492, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 504, 10, 15, 3, 15, 3, 15, 3, 15, 5, 15, 509, 10, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 518, 10, 15, 12, 15, 14, 15, 521, 11, 15, 3, 15, 3, 15, 5, 15, 525, 10, 15, 3, 16, 5, 16, 528, 10, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 535, 10, 16, 3, 17, 5, 17, 538, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 545, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 552, 10, 17, 12, 17, 14, 17, 555, 11, 17, 5, 17, 557, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 563, 10, 17, 5, 17, 565, 10, 17, 3, 18, 3, 18, 5, 18, 569, 10, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 577, 10, 19, 3, 19, 3, 19, 3, 19, 5, 19, 582, 10, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 590, 10, 20, 3, 20, 3, 20, 3, 20, 5, 20, 595, 10, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 603, 10, 21, 3, 21, 3, 21, 3, 21, 5, 21, 608, 10, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 616, 10, 22, 3, 22, 3, 22, 3, 22, 5, 22, 621, 10, 22, 3, 22, 3, 22, 3, 23, 5, 23, 626, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 632, 10, 23, 12, 23, 14, 23, 635, 11, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 642, 10, 23, 12, 23, 14, 23, 645, 11, 23, 5, 23, 647, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 653, 10, 23, 5, 23, 655, 10, 23, 3, 24, 5, 24, 658, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 677, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 683, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 690, 10, 24, 12, 24, 14, 24, 693, 11, 24, 3, 24, 3, 24, 5, 24, 697, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 704, 10, 24, 12, 24, 14, 24, 707, 11, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 715, 10, 24, 12, 24, 14, 24, 718, 11, 24, 3, 24, 3, 24, 7, 24, 722, 10, 24, 12, 24, 14, 24, 725, 11, 24, 3, 24, 3, 24, 3, 24, 5, 24, 730, 10, 24, 3, 25, 3, 25, 3, 25, 3, 25, 5, 25, 736, 10, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 5, 25, 745, 10, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 752, 10, 26, 3, 26, 3, 26, 5, 26, 756, 10, 26, 5, 26, 758, 10, 26, 3, 27, 3, 27, 5, 27, 762, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 5, 28, 769, 10, 28, 5, 28, 771, 10, 28, 3, 28, 3, 28, 5, 28, 775, 10, 28, 3, 28, 5, 28, 778, 10, 28, 3, 29, 3, 29, 3, 29, 3, 30, 5, 30, 784, 10, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 7, 30, 792, 10, 30, 12, 30, 14, 30, 795, 11, 30, 5, 30, 797, 10, 30, 3, 30, 3, 30, 3, 30, 3, 30, 5, 30, 803, 10, 30, 5, 30, 805, 10, 30, 3, 31, 5, 31, 808, 10, 31, 3, 31, 3, 31, 3, 31, 3, 31, 7, 31, 814, 10, 31, 12, 31, 14, 31, 817, 11, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 7, 31, 824, 10, 31, 12, 31, 14, 31, 827, 11, 31, 5, 31, 829, 10, 31, 3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 835, 10, 31, 5, 31, 837, 10, 31, 3, 32, 3, 32, 5, 32, 841, 10, 32, 3, 32, 3, 32, 3, 32, 7, 32, 846, 10, 32, 12, 32, 14, 32, 849, 11, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 855, 10, 32, 12, 32, 14, 32, 858, 11, 32, 3, 32, 5, 32, 861, 10, 32, 5, 32, 863, 10, 32, 3, 32, 3, 32, 5, 32, 867, 10, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 874, 10, 32, 12, 32, 14, 32, 877, 11, 32, 3, 32, 3, 32, 5, 32, 881, 10, 32, 5, 32, 883, 10, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 890, 10, 32, 12, 32, 14, 32, 893, 11, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 901, 10, 32, 12, 32, 14, 32, 904, 11, 32, 3, 32, 3, 32, 7, 32, 908, 10, 32, 12, 32, 14, 32, 911, 11, 32, 5, 32, 913, 10, 32, 3, 33, 5, 33, 916, 10, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 929, 10, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 7, 33, 941, 10, 33, 12, 33, 14, 33, 944, 11, 33, 3, 33, 3, 33, 5, 33, 948, 10, 33, 3, 34, 5, 34, 951, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 964, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 976, 10, 34, 12, 34, 14, 34, 979, 11, 34, 3, 34, 3, 34, 5, 34, 983, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 990, 10, 34, 12, 34, 14, 34, 993, 11, 34, 5, 34, 995, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 1001, 10, 34, 5, 34, 1003, 10, 34, 3, 35, 3, 35, 3, 36, 3, 36, 5, 36, 1009, 10, 36, 3, 36, 7, 36, 1012, 10, 36, 12, 36, 14, 36, 1015, 11, 36, 3, 37, 6, 37, 1018, 10, 37, 13, 37, 14, 37, 1019, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 1032, 10, 37, 3, 38, 3, 38, 5, 38, 1036, 10, 38, 3, 38, 3, 38, 3, 38, 5, 38, 1041, 10, 38, 3, 38, 3, 38, 5, 38, 1045, 10, 38, 3, 38, 5, 38, 1048, 10, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 1066, 10, 38, 3, 38, 3, 38, 3, 38, 5, 38, 1071, 10, 38, 3, 39, 3, 39, 3, 39, 5, 39, 1076, 10, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1084, 10, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1089, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1098, 10, 40, 3, 40, 3, 40, 3, 40, 7, 40, 1103, 10, 40, 12, 40, 14, 40, 1106, 11, 40, 3, 40, 5, 40, 1109, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1125, 10, 40, 3, 40, 5, 40, 1128, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1136, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 6, 40, 1143, 10, 40, 13, 40, 14, 40, 1144, 3, 40, 3, 40, 5, 40, 1149, 10, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1154, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1183, 10, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1188, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1197, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 7, 40, 1205, 10, 40, 12, 40, 14, 40, 1208, 11, 40, 5, 40, 1210, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1216, 10, 40, 3, 40, 5, 40, 1219, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1226, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1232, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1239, 10, 40, 7, 40, 1241, 10, 40, 12, 40, 14, 40, 1244, 11, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 7, 41, 1252, 10, 41, 12, 41, 14, 41, 1255, 11, 41, 3, 41, 3, 41, 5, 41, 1259, 10, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 1271, 10, 41, 3, 41, 3, 41, 5, 41, 1275, 10, 41, 7, 41, 1277, 10, 41, 12, 41, 14, 41, 1280, 11, 41, 3, 41, 5, 41, 1283, 10, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 1290, 10, 41, 5, 41, 1292, 10, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 1300, 10, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 5, 43, 1307, 10, 43, 3, 43, 5, 43, 1310, 10, 43, 3, 44, 3, 44, 5, 44, 1314, 10, 44, 3, 44, 3, 44, 3, 44, 5, 44, 1319, 10, 44, 3, 44, 3, 44, 3, 44, 3, 44, 7, 44, 1325, 10, 44, 12, 44, 14, 44, 1328, 11, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 7, 44, 1344, 10, 44, 12, 44, 14, 44, 1347, 11, 44, 3, 44, 3, 44, 3, 44, 5, 44, 1352, 10, 44, 3, 45, 3, 45, 5, 45, 1356, 10, 45, 3, 45, 3, 45, 3, 45, 7, 45, 1361, 10, 45, 12, 45, 14, 45, 1364, 11, 45, 3, 46, 3, 46, 3, 46, 5, 46, 1369, 10, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 5, 46, 1377, 10, 46, 3, 47, 3, 47, 3, 47, 5, 47, 1382, 10, 47, 3, 47, 5, 47, 1385, 10, 47, 3, 48, 3, 48, 3, 48, 5, 48, 1390, 10, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 7, 49, 1397, 10, 49, 12, 49, 14, 49, 1400, 11, 49, 3, 49, 3, 49, 5, 49, 1404, 10, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 5, 50, 1418, 10, 50, 3, 50, 5, 50, 1421, 10, 50, 5, 50, 1423, 10, 50, 3, 51, 3, 51, 3, 51, 5, 51, 1428, 10, 51, 3, 51, 3, 51, 5, 51, 1432, 10, 51, 3, 51, 5, 51, 1435, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1442, 10, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1447, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 7, 51, 1454, 10, 51, 12, 51, 14, 51, 1457, 11, 51, 5, 51, 1459, 10, 51, 3, 51, 3, 51, 5, 51, 1463, 10, 51, 3, 51, 5, 51, 1466, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 7, 51, 1472, 10, 51, 12, 51, 14, 51, 1475, 11, 51, 3, 51, 5, 51, 1478, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1486, 10, 51, 3, 51, 5, 51, 1489, 10, 51, 5, 51, 1491, 10, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 7, 52, 1498, 10, 52, 12, 52, 14, 52, 1501, 11, 52, 3, 53, 3, 53, 5, 53, 1505, 10, 53, 3, 53, 3, 53, 5, 53, 1509, 10, 53, 3, 53, 3, 53, 5, 53, 1513, 10, 53, 3, 53, 5, 53, 1516, 10, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 7, 54, 1525, 10, 54, 12, 54, 14, 54, 1528, 11, 54, 3, 54, 3, 54, 5, 54, 1532, 10, 54, 3, 55, 3, 55, 5, 55, 1536, 10, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1541, 10, 55, 12, 55, 14, 55, 1544, 11, 55, 3, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1550, 10, 55, 12, 55, 14, 55, 1553, 11, 55, 3, 55, 5, 55, 1556, 10, 55, 5, 55, 1558, 10, 55, 3, 55, 3, 55, 5, 55, 1562, 10, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1569, 10, 55, 12, 55, 14, 55, 1572, 11, 55, 3, 55, 3, 55, 5, 55, 1576, 10, 55, 5, 55, 1578, 10, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1585, 10, 55, 12, 55, 14, 55, 1588, 11, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1596, 10, 55, 12, 55, 14, 55, 1599, 11, 55, 3, 55, 3, 55, 7, 55, 1603, 10, 55, 12, 55, 14, 55, 1606, 11, 55, 5, 55, 1608, 10, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 5, 56, 1615, 10, 56, 3, 57, 5, 57, 1618, 10, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 5, 61, 1630, 10, 61, 3, 62, 3, 62, 3, 63, 3, 63, 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 3, 72, 3, 72, 3, 73, 3, 73, 3, 74, 3, 74, 3, 75, 3, 75, 3, 76, 3, 76, 3, 77, 3, 77, 3, 78, 3, 78, 3, 79, 3, 79, 3, 80, 3, 80, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 5, 82, 1678, 10, 82, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 5, 84, 1689, 10, 84, 3, 84, 4, 390, 1019, 3, 78, 85, 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, 2, 21, 5, 2, 60, 60, 71, 71, 84, 84, 4, 2, 49, 49, 68, 68, 4, 2, 7, 7, 108, 108, 3, 2, 133, 134, 4, 2, 31, 31, 64, 64, 4, 2, 36, 36, 62, 62, 7, 2, 27, 27, 74, 74, 83, 83, 124, 124, 127, 127, 4, 2, 9, 9, 14, 15, 3, 2, 10, 11, 3, 2, 16, 19, 3, 2, 20, 23, 4, 2, 8, 8, 24, 26, 6, 2, 79, 79, 99, 99, 101, 101, 120, 120, 4, 2, 61, 61, 141, 141, 5, 2, 27, 27, 74, 74, 127, 127, 6, 2, 54, 56, 106, 106, 152, 152, 154, 155, 4, 2, 10, 12, 104, 104, 4, 2, 151, 151, 154, 154, 3, 2, 27, 150, 2, 1946, 2, 171, 3, 2, 2, 2, 4, 179, 3, 2, 2, 2, 6, 205, 3, 2, 2, 2, 8, 239, 3, 2, 2, 2, 10, 265, 3, 2, 2, 2, 12, 274, 3, 2, 2, 2, 14, 282, 3, 2, 2, 2, 16, 292, 3, 2, 2, 2, 18, 300, 3, 2, 2, 2, 20, 336, 3, 2, 2, 2, 22, 368, 3, 2, 2, 2, 24, 409, 3, 2, 2, 2, 26, 478, 3, 2, 2, 2, 28, 497, 3, 2, 2, 2, 30, 527, 3, 2, 2, 2, 32, 537, 3, 2, 2, 2, 34, 566, 3, 2, 2, 2, 36, 572, 3, 2, 2, 2, 38, 585, 3, 2, 2, 2, 40, 598, 3, 2, 2, 2, 42, 611, 3, 2, 2, 2, 44, 625, 3, 2, 2, 2, 46, 657, 3, 2, 2, 2, 48, 731, 3, 2, 2, 2, 50, 746, 3, 2, 2, 2, 52, 759, 3, 2, 2, 2, 54, 765, 3, 2, 2, 2, 56, 779, 3, 2, 2, 2, 58, 783, 3, 2, 2, 2, 60, 807, 3, 2, 2, 2, 62, 912, 3, 2, 2, 2, 64, 915, 3, 2, 2, 2, 66, 950, 3, 2, 2, 2, 68, 1004, 3, 2, 2, 2, 70, 1006, 3, 2, 2, 2, 72, 1017, 3, 2, 2, 2, 74, 1035, 3, 2, 2, 2, 76, 1075, 3, 2, 2, 2, 78, 1153, 3, 2, 2, 2, 80, 1245, 3, 2, 2, 2, 82, 1293, 3, 2, 2, 2, 84, 1303, 3, 2, 2, 2, 86, 1313, 3, 2, 2, 2, 88, 1353, 3, 2, 2, 2, 90, 1368, 3, 2, 2, 2, 92, 1378, 3, 2, 2, 2, 94, 1389, 3, 2, 2, 2, 96, 1391, 3, 2, 2, 2, 98, 1422, 3, 2, 2, 2, 100, 1490, 3, 2, 2, 2, 102, 1492, 3, 2, 2, 2, 104, 1515, 3, 2, 2, 2, 106, 1531, 3, 2, 2, 2, 108, 1607, 3, 2, 2, 2, 110, 1614, 3, 2, 2, 2, 112, 1617, 3, 2, 2, 2, 114, 1621, 3, 2, 2, 2, 116, 1623, 3, 2, 2, 2, 118, 1625, 3, 2, 2, 2, 120, 1629, 3, 2, 2, 2, 122, 1631, 3, 2, 2, 2, 124, 1633, 3, 2, 2, 2, 126, 1635, 3, 2, 2, 2, 128, 1637, 3, 2, 2, 2, 130, 1639, 3, 2, 2, 2, 132, 1641, 3, 2, 2, 2, 134, 1643, 3, 2, 2, 2, 136, 1645, 3, 2, 2, 2, 138, 1647, 3, 2, 2, 2, 140, 1649, 3, 2, 2, 2, 142, 1651, 3, 2, 2, 2, 144, 1653, 3, 2, 2, 2, 146, 1655, 3, 2, 2, 2, 148, 1657, 3, 2, 2, 2, 150, 1659, 3, 2, 2, 2, 152, 1661, 3, 2, 2, 2, 154, 1663, 3, 2, 2, 2, 156, 1665, 3, 2, 2, 2, 158, 1667, 3, 2, 2, 2, 160, 1669, 3, 2, 2, 2, 162, 1677, 3, 2, 2, 2, 164, 1679, 3, 2, 2, 2, 166, 1688, 3, 2, 2, 2, 168, 170, 5, 4, 3, 2, 169, 168, 3, 2, 2, 2, 170, 173, 3, 2, 2, 2, 171, 169, 3, 2, 2, 2, 171, 172, 3, 2, 2, 2, 172, 174, 3, 2, 2, 2, 173, 171, 3, 2, 2, 2, 174, 175, 7, 2, 2, 3, 175, 3, 3, 2, 2, 2, 176, 178, 7, 3, 2, 2, 177, 176, 3, 2, 2, 2, 178, 181, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, 182, 3, 2, 2, 2, 181, 179, 3, 2, 2, 2, 182, 191, 5, 6, 4, 2, 183, 185, 7, 3, 2, 2, 184, 183, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 184, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 190, 5, 6, 4, 2, 189, 184, 3, 2, 2, 2, 190, 193, 3, 2, 2, 2, 191, 189, 3, 2, 2, 2, 191, 192, 3, 2, 2, 2, 192, 197, 3, 2, 2, 2, 193, 191, 3, 2, 2, 2, 194, 196, 7, 3, 2, 2, 195, 194, 3, 2, 2, 2, 196, 199, 3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 197, 198, 3, 2, 2, 2, 198, 5, 3, 2, 2, 2, 199, 197, 3, 2, 2, 2, 200, 203, 7, 73, 2, 2, 201, 202, 7, 116, 2, 2, 202, 204, 7, 113, 2, 2, 203, 201, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 206, 3, 2, 2, 2, 205, 200, 3, 2, 2, 2, 205, 206, 3, 2, 2, 2, 206, 237, 3, 2, 2, 2, 207, 238, 5, 8, 5, 2, 208, 238, 5, 10, 6, 2, 209, 238, 5, 12, 7, 2, 210, 238, 5, 14, 8, 2, 211, 238, 5, 16, 9, 2, 212, 238, 5, 18, 10, 2, 213, 238, 5, 20, 11, 2, 214, 238, 5, 22, 12, 2, 215, 238, 5, 24, 13, 2, 216, 238, 5, 26, 14, 2, 217, 238, 5, 28, 15, 2, 218, 238, 5, 30, 16, 2, 219, 238, 5, 32, 17, 2, 220, 238, 5, 34, 18, 2, 221, 238, 5, 36, 19, 2, 222, 238, 5, 38, 20, 2, 223, 238, 5, 40, 21, 2, 224, 238, 5, 42, 22, 2, 225, 238, 5, 44, 23, 2, 226, 238, 5, 46, 24, 2, 227, 238, 5, 48, 25, 2, 228, 238, 5, 50, 26, 2, 229, 238, 5, 52, 27, 2, 230, 238, 5, 54, 28, 2, 231, 238, 5, 56, 29, 2, 232, 238, 5, 58, 30, 2, 233, 238, 5, 60, 31, 2, 234, 238, 5, 64, 33, 2, 235, 238, 5, 66, 34, 2, 236, 238, 5, 68, 35, 2, 237, 207, 3, 2, 2, 2, 237, 208, 3, 2, 2, 2, 237, 209, 3, 2, 2, 2, 237, 210, 3, 2, 2, 2, 237, 211, 3, 2, 2, 2, 237, 212, 3, 2, 2, 2, 237, 213, 3, 2, 2, 2, 237, 214, 3, 2, 2, 2, 237, 215, 3, 2, 2, 2, 237, 216, 3, 2, 2, 2, 237, 217, 3, 2, 2, 2, 237, 218, 3, 2, 2, 2, 237, 219, 3, 2, 2, 2, 237, 220, 3, 2, 2, 2, 237, 221, 3, 2, 2, 2, 237, 222, 3, 2, 2, 2, 237, 223, 3, 2, 2, 2, 237, 224, 3, 2, 2, 2, 237, 225, 3, 2, 2, 2, 237, 226, 3, 2, 2, 2, 237, 227, 3, 2, 2, 2, 237, 228, 3, 2, 2, 2, 237, 229, 3, 2, 2, 2, 237, 230, 3, 2, 2, 2, 237, 231, 3, 2, 2, 2, 237, 232, 3, 2, 2, 2, 237, 233, 3, 2, 2, 2, 237, 234, 3, 2, 2, 2, 237, 235, 3, 2, 2, 2, 237, 236, 3, 2, 2, 2, 238, 7, 3, 2, 2, 2, 239, 240, 7, 32, 2, 2, 240, 244, 7, 132, 2, 2, 241, 242, 5, 130, 66, 2, 242, 243, 7, 4, 2, 2, 243, 245, 3, 2, 2, 2, 244, 241, 3, 2, 2, 2, 244, 245, 3, 2, 2, 2, 245, 246, 3, 2, 2, 2, 246, 263, 5, 136, 69, 2, 247, 248, 7, 123, 2, 2, 248, 249, 7, 136, 2, 2, 249, 264, 5, 140, 71, 2, 250, 252, 7, 123, 2, 2, 251, 253, 7, 48, 2, 2, 252, 251, 3, 2, 2, 2, 252, 253, 3, 2, 2, 2, 253, 254, 3, 2, 2, 2, 254, 255, 5, 142, 72, 2, 255, 256, 7, 136, 2, 2, 256, 257, 5, 144, 73, 2, 257, 264, 3, 2, 2, 2, 258, 260, 7, 29, 2, 2, 259, 261, 7, 48, 2, 2, 260, 259, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 262, 3, 2, 2, 2, 262, 264, 5, 70, 36, 2, 263, 247, 3, 2, 2, 2, 263, 250, 3, 2, 2, 2, 263, 258, 3, 2, 2, 2, 264, 9, 3, 2, 2, 2, 265, 272, 7, 33, 2, 2, 266, 273, 5, 130, 66, 2, 267, 273, 5, 138, 70, 2, 268, 269, 5, 130, 66, 2, 269, 270, 7, 4, 2, 2, 270, 271, 5, 138, 70, 2, 271, 273, 3, 2, 2, 2, 272, 266, 3, 2, 2, 2, 272, 267, 3, 2, 2, 2, 272, 268, 3, 2, 2, 2, 272, 273, 3, 2, 2, 2, 273, 11, 3, 2, 2, 2, 274, 276, 7, 37, 2, 2, 275, 277, 7, 57, 2, 2, 276, 275, 3, 2, 2, 2, 276, 277, 3, 2, 2, 2, 277, 278, 3, 2, 2, 2, 278, 279, 5, 78, 40, 2, 279, 280, 7, 35, 2, 2, 280, 281, 5, 130, 66, 2, 281, 13, 3, 2, 2, 2, 282, 284, 7, 40, 2, 2, 283, 285, 9, 2, 2, 2, 284, 283, 3, 2, 2, 2, 284, 285, 3, 2, 2, 2, 285, 290, 3, 2, 2, 2, 286, 288, 7, 137, 2, 2, 287, 289, 5, 164, 83, 2, 288, 287, 3, 2, 2, 2, 288, 289, 3, 2, 2, 2, 289, 291, 3, 2, 2, 2, 290, 286, 3, 2, 2, 2, 290, 291, 3, 2, 2, 2, 291, 15, 3, 2, 2, 2, 292, 297, 9, 3, 2, 2, 293, 295, 7, 137, 2, 2, 294, 296, 5, 164, 83, 2, 295, 294, 3, 2, 2, 2, 295, 296, 3, 2, 2, 2, 296, 298, 3, 2, 2, 2, 297, 293, 3, 2, 2, 2, 297, 298, 3, 2, 2, 2, 298, 17, 3, 2, 2, 2, 299, 301, 5, 88, 45, 2, 300, 299, 3, 2, 2, 2, 300, 301, 3, 2, 2, 2, 301, 302, 3, 2, 2, 2, 302, 312, 5, 108, 55, 2, 303, 305, 7, 139, 2, 2, 304, 306, 7, 31, 2, 2, 305, 304, 3, 2, 2, 2, 305, 306, 3, 2, 2, 2, 306, 310, 3, 2, 2, 2, 307, 310, 7, 92, 2, 2, 308, 310, 7, 70, 2, 2, 309, 303, 3, 2, 2, 2, 309, 307, 3, 2, 2, 2, 309, 308, 3, 2, 2, 2, 310, 311, 3, 2, 2, 2, 311, 313, 5, 108, 55, 2, 312, 309, 3, 2, 2, 2, 313, 314, 3, 2, 2, 2, 314, 312, 3, 2, 2, 2, 314, 315, 3, 2, 2, 2, 315, 326, 3, 2, 2, 2, 316, 317, 7, 111, 2, 2, 317, 318, 7, 42, 2, 2, 318, 323, 5, 92, 47, 2, 319, 320, 7, 7, 2, 2, 320, 322, 5, 92, 47, 2, 321, 319, 3, 2, 2, 2, 322, 325, 3, 2, 2, 2, 323, 321, 3, 2, 2, 2, 323, 324, 3, 2, 2, 2, 324, 327, 3, 2, 2, 2, 325, 323, 3, 2, 2, 2, 326, 316, 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 334, 3, 2, 2, 2, 328, 329, 7, 100, 2, 2, 329, 332, 5, 78, 40, 2, 330, 331, 9, 4, 2, 2, 331, 333, 5, 78, 40, 2, 332, 330, 3, 2, 2, 2, 332, 333, 3, 2, 2, 2, 333, 335, 3, 2, 2, 2, 334, 328, 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 19, 3, 2, 2, 2, 336, 338, 7, 52, 2, 2, 337, 339, 7, 140, 2, 2, 338, 337, 3, 2, 2, 2, 338, 339, 3, 2, 2, 2, 339, 340, 3, 2, 2, 2, 340, 344, 7, 86, 2, 2, 341, 342, 7, 82, 2, 2, 342, 343, 7, 104, 2, 2, 343, 345, 7, 72, 2, 2, 344, 341, 3, 2, 2, 2, 344, 345, 3, 2, 2, 2, 345, 349, 3, 2, 2, 2, 346, 347, 5, 130, 66, 2, 347, 348, 7, 4, 2, 2, 348, 350, 3, 2, 2, 2, 349, 346, 3, 2, 2, 2, 349, 350, 3, 2, 2, 2, 350, 351, 3, 2, 2, 2, 351, 352, 5, 150, 76, 2, 352, 353, 7, 109, 2, 2, 353, 354, 5, 136, 69, 2, 354, 355, 7, 5, 2, 2, 355, 360, 5, 84, 43, 2, 356, 357, 7, 7, 2, 2, 357, 359, 5, 84, 43, 2, 358, 356, 3, 2, 2, 2, 359, 362, 3, 2, 2, 2, 360, 358, 3, 2, 2, 2, 360, 361, 3, 2, 2, 2, 361, 363, 3, 2, 2, 2, 362, 360, 3, 2, 2, 2, 363, 366, 7, 6, 2, 2, 364, 365, 7, 148, 2, 2, 365, 367, 5, 78, 40, 2, 366, 364, 3, 2, 2, 2, 366, 367, 3, 2, 2, 2, 367, 21, 3, 2, 2, 2, 368, 370, 7, 52, 2, 2, 369, 371, 9, 5, 2, 2, 370, 369, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, 372, 3, 2, 2, 2, 372, 376, 7, 132, 2, 2, 373, 374, 7, 82, 2, 2, 374, 375, 7, 104, 2, 2, 375, 377, 7, 72, 2, 2, 376, 373, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, 377, 381, 3, 2, 2, 2, 378, 379, 5, 130, 66, 2, 379, 380, 7, 4, 2, 2, 380, 382, 3, 2, 2, 2, 381, 378, 3, 2, 2, 2, 381, 382, 3, 2, 2, 2, 382, 383, 3, 2, 2, 2, 383, 407, 5, 136, 69, 2, 384, 385, 7, 5, 2, 2, 385, 390, 5, 70, 36, 2, 386, 387, 7, 7, 2, 2, 387, 389, 5, 70, 36, 2, 388, 386, 3, 2, 2, 2, 389, 392, 3, 2, 2, 2, 390, 391, 3, 2, 2, 2, 390, 388, 3, 2, 2, 2, 391, 397, 3, 2, 2, 2, 392, 390, 3, 2, 2, 2, 393, 394, 7, 7, 2, 2, 394, 396, 5, 86, 44, 2, 395, 393, 3, 2, 2, 2, 396, 399, 3, 2, 2, 2, 397, 395, 3, 2, 2, 2, 397, 398, 3, 2, 2, 2, 398, 400, 3, 2, 2, 2, 399, 397, 3, 2, 2, 2, 400, 403, 7, 6, 2, 2, 401, 402, 7, 150, 2, 2, 402, 404, 7, 151, 2, 2, 403, 401, 3, 2, 2, 2, 403, 404, 3, 2, 2, 2, 404, 408, 3, 2, 2, 2, 405, 406, 7, 35, 2, 2, 406, 408, 5, 60, 31, 2, 407, 384, 3, 2, 2, 2, 407, 405, 3, 2, 2, 2, 408, 23, 3, 2, 2, 2, 409, 411, 7, 52, 2, 2, 410, 412, 9, 5, 2, 2, 411, 410, 3, 2, 2, 2, 411, 412, 3, 2, 2, 2, 412, 413, 3, 2, 2, 2, 413, 417, 7, 138, 2, 2, 414, 415, 7, 82, 2, 2, 415, 416, 7, 104, 2, 2, 416, 418, 7, 72, 2, 2, 417, 414, 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, 422, 3, 2, 2, 2, 419, 420, 5, 130, 66, 2, 420, 421, 7, 4, 2, 2, 421, 423, 3, 2, 2, 2, 422, 419, 3, 2, 2, 2, 422, 423, 3, 2, 2, 2, 423, 424, 3, 2, 2, 2, 424, 429, 5, 152, 77, 2, 425, 430, 7, 39, 2, 2, 426, 430, 7, 30, 2, 2, 427, 428, 7, 91, 2, 2, 428, 430, 7, 107, 2, 2, 429, 425, 3, 2, 2, 2, 429, 426, 3, 2, 2, 2, 429, 427, 3, 2, 2, 2, 429, 430, 3, 2, 2, 2, 430, 445, 3, 2, 2, 2, 431, 446, 7, 61, 2, 2, 432, 446, 7, 90, 2, 2, 433, 443, 7, 141, 2, 2, 434, 435, 7, 107, 2, 2, 435, 440, 5, 142, 72, 2, 436, 437, 7, 7, 2, 2, 437, 439, 5, 142, 72, 2, 438, 436, 3, 2, 2, 2, 439, 442, 3, 2, 2, 2, 440, 438, 3, 2, 2, 2, 440, 441, 3, 2, 2, 2, 441, 444, 3, 2, 2, 2, 442, 440, 3, 2, 2, 2, 443, 434, 3, 2, 2, 2, 443, 444, 3, 2, 2, 2, 444, 446, 3, 2, 2, 2, 445, 431, 3, 2, 2, 2, 445, 432, 3, 2, 2, 2, 445, 433, 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 451, 7, 109, 2, 2, 448, 449, 5, 130, 66, 2, 449, 450, 7, 4, 2, 2, 450, 452, 3, 2, 2, 2, 451, 448, 3, 2, 2, 2, 451, 452, 3, 2, 2, 2, 452, 453, 3, 2, 2, 2, 453, 457, 5, 136, 69, 2, 454, 455, 7, 75, 2, 2, 455, 456, 7, 66, 2, 2, 456, 458, 7, 128, 2, 2, 457, 454, 3, 2, 2, 2, 457, 458, 3, 2, 2, 2, 458, 461, 3, 2, 2, 2, 459, 460, 7, 147, 2, 2, 460, 462, 5, 78, 40, 2, 461, 459, 3, 2, 2, 2, 461, 462, 3, 2, 2, 2, 462, 463, 3, 2, 2, 2, 463, 472, 7, 40, 2, 2, 464, 469, 5, 64, 33, 2, 465, 469, 5, 46, 24, 2, 466, 469, 5, 30, 16, 2, 467, 469, 5, 60, 31, 2, 468, 464, 3, 2, 2, 2, 468, 465, 3, 2, 2, 2, 468, 466, 3, 2, 2, 2, 468, 467, 3, 2, 2, 2, 469, 470, 3, 2, 2, 2, 470, 471, 7, 3, 2, 2, 471, 473, 3, 2, 2, 2, 472, 468, 3, 2, 2, 2, 473, 474, 3, 2, 2, 2, 474, 472, 3, 2, 2, 2, 474, 475, 3, 2, 2, 2, 475, 476, 3, 2, 2, 2, 476, 477, 7, 68, 2, 2, 477, 25, 3, 2, 2, 2, 478, 480, 7, 52, 2, 2, 479, 481, 9, 5, 2, 2, 480, 479, 3, 2, 2, 2, 480, 481, 3, 2, 2, 2, 481, 482, 3, 2, 2, 2, 482, 486, 7, 145, 2, 2, 483, 484, 7, 82, 2, 2, 484, 485, 7, 104, 2, 2, 485, 487, 7, 72, 2, 2, 486, 483, 3, 2, 2, 2, 486, 487, 3, 2, 2, 2, 487, 491, 3, 2, 2, 2, 488, 489, 5, 130, 66, 2, 489, 490, 7, 4, 2, 2, 490, 492, 3, 2, 2, 2, 491, 488, 3, 2, 2, 2, 491, 492, 3, 2, 2, 2, 492, 493, 3, 2, 2, 2, 493, 494, 5, 154, 78, 2, 494, 495, 7, 35, 2, 2, 495, 496, 5, 60, 31, 2, 496, 27, 3, 2, 2, 2, 497, 498, 7, 52, 2, 2, 498, 499, 7, 146, 2, 2, 499, 503, 7, 132, 2, 2, 500, 501, 7, 82, 2, 2, 501, 502, 7, 104, 2, 2, 502, 504, 7, 72, 2, 2, 503, 500, 3, 2, 2, 2, 503, 504, 3, 2, 2, 2, 504, 508, 3, 2, 2, 2, 505, 506, 5, 130, 66, 2, 506, 507, 7, 4, 2, 2, 507, 509, 3, 2, 2, 2, 508, 505, 3, 2, 2, 2, 508, 509, 3, 2, 2, 2, 509, 510, 3, 2, 2, 2, 510, 511, 5, 136, 69, 2, 511, 512, 7, 142, 2, 2, 512, 524, 5, 156, 79, 2, 513, 514, 7, 5, 2, 2, 514, 519, 5, 120, 61, 2, 515, 516, 7, 7, 2, 2, 516, 518, 5, 120, 61, 2, 517, 515, 3, 2, 2, 2, 518, 521, 3, 2, 2, 2, 519, 517, 3, 2, 2, 2, 519, 520, 3, 2, 2, 2, 520, 522, 3, 2, 2, 2, 521, 519, 3, 2, 2, 2, 522, 523, 7, 6, 2, 2, 523, 525, 3, 2, 2, 2, 524, 513, 3, 2, 2, 2, 524, 525, 3, 2, 2, 2, 525, 29, 3, 2, 2, 2, 526, 528, 5, 88, 45, 2, 527, 526, 3, 2, 2, 2, 527, 528, 3, 2, 2, 2, 528, 529, 3, 2, 2, 2, 529, 530, 7, 61, 2, 2, 530, 531, 7, 77, 2, 2, 531, 534, 5, 90, 46, 2, 532, 533, 7, 148, 2, 2, 533, 535, 5, 78, 40, 2, 534, 532, 3, 2, 2, 2, 534, 535, 3, 2, 2, 2, 535, 31, 3, 2, 2, 2, 536, 538, 5, 88, 45, 2, 537, 536, 3, 2, 2, 2, 537, 538, 3, 2, 2, 2, 538, 539, 3, 2, 2, 2, 539, 540, 7, 61, 2, 2, 540, 541, 7, 77, 2, 2, 541, 544, 5, 90, 46, 2, 542, 543, 7, 148, 2, 2, 543, 545, 5, 78, 40, 2, 544, 542, 3, 2, 2, 2, 544, 545, 3, 2, 2, 2, 545, 564, 3, 2, 2, 2, 546, 547, 7, 111, 2, 2, 547, 548, 7, 42, 2, 2, 548, 553, 5, 92, 47, 2, 549, 550, 7, 7, 2, 2, 550, 552, 5, 92, 47, 2, 551, 549, 3, 2, 2, 2, 552, 555, 3, 2, 2, 2, 553, 551, 3, 2, 2, 2, 553, 554, 3, 2, 2, 2, 554, 557, 3, 2, 2, 2, 555, 553, 3, 2, 2, 2, 556, 546, 3, 2, 2, 2, 556, 557, 3, 2, 2, 2, 557, 558, 3, 2, 2, 2, 558, 559, 7, 100, 2, 2, 559, 562, 5, 78, 40, 2, 560, 561, 9, 4, 2, 2, 561, 563, 5, 78, 40, 2, 562, 560, 3, 2, 2, 2, 562, 563, 3, 2, 2, 2, 563, 565, 3, 2, 2, 2, 564, 556, 3, 2, 2, 2, 564, 565, 3, 2, 2, 2, 565, 33, 3, 2, 2, 2, 566, 568, 7, 63, 2, 2, 567, 569, 7, 57, 2, 2, 568, 567, 3, 2, 2, 2, 568, 569, 3, 2, 2, 2, 569, 570, 3, 2, 2, 2, 570, 571, 5, 130, 66, 2, 571, 35, 3, 2, 2, 2, 572, 573, 7, 65, 2, 2, 573, 576, 7, 86, 2, 2, 574, 575, 7, 82, 2, 2, 575, 577, 7, 72, 2, 2, 576, 574, 3, 2, 2, 2, 576, 577, 3, 2, 2, 2, 577, 581, 3, 2, 2, 2, 578, 579, 5, 130, 66, 2, 579, 580, 7, 4, 2, 2, 580, 582, 3, 2, 2, 2, 581, 578, 3, 2, 2, 2, 581, 582, 3, 2, 2, 2, 582, 583, 3, 2, 2, 2, 583, 584, 5, 150, 76, 2, 584, 37, 3, 2, 2, 2, 585, 586, 7, 65, 2, 2, 586, 589, 7, 132, 2, 2, 587, 588, 7, 82, 2, 2, 588, 590, 7, 72, 2, 2, 589, 587, 3, 2, 2, 2, 589, 590, 3, 2, 2, 2, 590, 594, 3, 2, 2, 2, 591, 592, 5, 130, 66, 2, 592, 593, 7, 4, 2, 2, 593, 595, 3, 2, 2, 2, 594, 591, 3, 2, 2, 2, 594, 595, 3, 2, 2, 2, 595, 596, 3, 2, 2, 2, 596, 597, 5, 136, 69, 2, 597, 39, 3, 2, 2, 2, 598, 599, 7, 65, 2, 2, 599, 602, 7, 138, 2, 2, 600, 601, 7, 82, 2, 2, 601, 603, 7, 72, 2, 2, 602, 600, 3, 2, 2, 2, 602, 603, 3, 2, 2, 2, 603, 607, 3, 2, 2, 2, 604, 605, 5, 130, 66, 2, 605, 606, 7, 4, 2, 2, 606, 608, 3, 2, 2, 2, 607, 604, 3, 2, 2, 2, 607, 608, 3, 2, 2, 2, 608, 609, 3, 2, 2, 2, 609, 610, 5, 152, 77, 2, 610, 41, 3, 2, 2, 2, 611, 612, 7, 65, 2, 2, 612, 615, 7, 145, 2, 2, 613, 614, 7, 82, 2, 2, 614, 616, 7, 72, 2, 2, 615, 613, 3, 2, 2, 2, 615, 616, 3, 2, 2, 2, 616, 620, 3, 2, 2, 2, 617, 618, 5, 130, 66, 2, 618, 619, 7, 4, 2, 2, 619, 621, 3, 2, 2, 2, 620, 617, 3, 2, 2, 2, 620, 621, 3, 2, 2, 2, 621, 622, 3, 2, 2, 2, 622, 623, 5, 154, 78, 2, 623, 43, 3, 2, 2, 2, 624, 626, 5, 88, 45, 2, 625, 624, 3, 2, 2, 2, 625, 626, 3, 2, 2, 2, 626, 627, 3, 2, 2, 2, 627, 633, 5, 108, 55, 2, 628, 629, 5, 110, 56, 2, 629, 630, 5, 108, 55, 2, 630, 632, 3, 2, 2, 2, 631, 628, 3, 2, 2, 2, 632, 635, 3, 2, 2, 2, 633, 631, 3, 2, 2, 2, 633, 634, 3, 2, 2, 2, 634, 646, 3, 2, 2, 2, 635, 633, 3, 2, 2, 2, 636, 637, 7, 111, 2, 2, 637, 638, 7, 42, 2, 2, 638, 643, 5, 92, 47, 2, 639, 640, 7, 7, 2, 2, 640, 642, 5, 92, 47, 2, 641, 639, 3, 2, 2, 2, 642, 645, 3, 2, 2, 2, 643, 641, 3, 2, 2, 2, 643, 644, 3, 2, 2, 2, 644, 647, 3, 2, 2, 2, 645, 643, 3, 2, 2, 2, 646, 636, 3, 2, 2, 2, 646, 647, 3, 2, 2, 2, 647, 654, 3, 2, 2, 2, 648, 649, 7, 100, 2, 2, 649, 652, 5, 78, 40, 2, 650, 651, 9, 4, 2, 2, 651, 653, 5, 78, 40, 2, 652, 650, 3, 2, 2, 2, 652, 653, 3, 2, 2, 2, 653, 655, 3, 2, 2, 2, 654, 648, 3, 2, 2, 2, 654, 655, 3, 2, 2, 2, 655, 45, 3, 2, 2, 2, 656, 658, 5, 88, 45, 2, 657, 656, 3, 2, 2, 2, 657, 658, 3, 2, 2, 2, 658, 676, 3, 2, 2, 2, 659, 677, 7, 90, 2, 2, 660, 677, 7, 124, 2, 2, 661, 662, 7, 90, 2, 2, 662, 663, 7, 110, 2, 2, 663, 677, 7, 124, 2, 2, 664, 665, 7, 90, 2, 2, 665, 666, 7, 110, 2, 2, 666, 677, 7, 127, 2, 2, 667, 668, 7, 90, 2, 2, 668, 669, 7, 110, 2, 2, 669, 677, 7, 27, 2, 2, 670, 671, 7, 90, 2, 2, 671, 672, 7, 110, 2, 2, 672, 677, 7, 74, 2, 2, 673, 674, 7, 90, 2, 2, 674, 675, 7, 110, 2, 2, 675, 677, 7, 83, 2, 2, 676, 659, 3, 2, 2, 2, 676, 660, 3, 2, 2, 2, 676, 661, 3, 2, 2, 2, 676, 664, 3, 2, 2, 2, 676, 667, 3, 2, 2, 2, 676, 670, 3, 2, 2, 2, 676, 673, 3, 2, 2, 2, 677, 678, 3, 2, 2, 2, 678, 682, 7, 93, 2, 2, 679, 680, 5, 130, 66, 2, 680, 681, 7, 4, 2, 2, 681, 683, 3, 2, 2, 2, 682, 679, 3, 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, 684, 3, 2, 2, 2, 684, 696, 5, 136, 69, 2, 685, 686, 7, 5, 2, 2, 686, 691, 5, 142, 72, 2, 687, 688, 7, 7, 2, 2, 688, 690, 5, 142, 72, 2, 689, 687, 3, 2, 2, 2, 690, 693, 3, 2, 2, 2, 691, 689, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 694, 3, 2, 2, 2, 693, 691, 3, 2, 2, 2, 694, 695, 7, 6, 2, 2, 695, 697, 3, 2, 2, 2, 696, 685, 3, 2, 2, 2, 696, 697, 3, 2, 2, 2, 697, 729, 3, 2, 2, 2, 698, 699, 7, 144, 2, 2, 699, 700, 7, 5, 2, 2, 700, 705, 5, 78, 40, 2, 701, 702, 7, 7, 2, 2, 702, 704, 5, 78, 40, 2, 703, 701, 3, 2, 2, 2, 704, 707, 3, 2, 2, 2, 705, 703, 3, 2, 2, 2, 705, 706, 3, 2, 2, 2, 706, 708, 3, 2, 2, 2, 707, 705, 3, 2, 2, 2, 708, 723, 7, 6, 2, 2, 709, 710, 7, 7, 2, 2, 710, 711, 7, 5, 2, 2, 711, 716, 5, 78, 40, 2, 712, 713, 7, 7, 2, 2, 713, 715, 5, 78, 40, 2, 714, 712, 3, 2, 2, 2, 715, 718, 3, 2, 2, 2, 716, 714, 3, 2, 2, 2, 716, 717, 3, 2, 2, 2, 717, 719, 3, 2, 2, 2, 718, 716, 3, 2, 2, 2, 719, 720, 7, 6, 2, 2, 720, 722, 3, 2, 2, 2, 721, 709, 3, 2, 2, 2, 722, 725, 3, 2, 2, 2, 723, 721, 3, 2, 2, 2, 723, 724, 3, 2, 2, 2, 724, 730, 3, 2, 2, 2, 725, 723, 3, 2, 2, 2, 726, 730, 5, 60, 31, 2, 727, 728, 7, 58, 2, 2, 728, 730, 7, 144, 2, 2, 729, 698, 3, 2, 2, 2, 729, 726, 3, 2, 2, 2, 729, 727, 3, 2, 2, 2, 730, 47, 3, 2, 2, 2, 731, 735, 7, 114, 2, 2, 732, 733, 5, 130, 66, 2, 733, 734, 7, 4, 2, 2, 734, 736, 3, 2, 2, 2, 735, 732, 3, 2, 2, 2, 735, 736, 3, 2, 2, 2, 736, 737, 3, 2, 2, 2, 737, 744, 5, 158, 80, 2, 738, 739, 7, 8, 2, 2, 739, 745, 5, 94, 48, 2, 740, 741, 7, 5, 2, 2, 741, 742, 5, 94, 48, 2, 742, 743, 7, 6, 2, 2, 743, 745, 3, 2, 2, 2, 744, 738, 3, 2, 2, 2, 744, 740, 3, 2, 2, 2, 744, 745, 3, 2, 2, 2, 745, 49, 3, 2, 2, 2, 746, 757, 7, 121, 2, 2, 747, 758, 5, 146, 74, 2, 748, 749, 5, 130, 66, 2, 749, 750, 7, 4, 2, 2, 750, 752, 3, 2, 2, 2, 751, 748, 3, 2, 2, 2, 751, 752, 3, 2, 2, 2, 752, 755, 3, 2, 2, 2, 753, 756, 5, 136, 69, 2, 754, 756, 5, 150, 76, 2, 755, 753, 3, 2, 2, 2, 755, 754, 3, 2, 2, 2, 756, 758, 3, 2, 2, 2, 757, 747, 3, 2, 2, 2, 757, 751, 3, 2, 2, 2, 757, 758, 3, 2, 2, 2, 758, 51, 3, 2, 2, 2, 759, 761, 7, 122, 2, 2, 760, 762, 7, 129, 2, 2, 761, 760, 3, 2, 2, 2, 761, 762, 3, 2, 2, 2, 762, 763, 3, 2, 2, 2, 763, 764, 5, 160, 81, 2, 764, 53, 3, 2, 2, 2, 765, 770, 7, 127, 2, 2, 766, 768, 7, 137, 2, 2, 767, 769, 5, 164, 83, 2, 768, 767, 3, 2, 2, 2, 768, 769, 3, 2, 2, 2, 769, 771, 3, 2, 2, 2, 770, 766, 3, 2, 2, 2, 770, 771, 3, 2, 2, 2, 771, 777, 3, 2, 2, 2, 772, 774, 7, 136, 2, 2, 773, 775, 7, 129, 2, 2, 774, 773, 3, 2, 2, 2, 774, 775, 3, 2, 2, 2, 775, 776, 3, 2, 2, 2, 776, 778, 5, 160, 81, 2, 777, 772, 3, 2, 2, 2, 777, 778, 3, 2, 2, 2, 778, 55, 3, 2, 2, 2, 779, 780, 7, 129, 2, 2, 780, 781, 5, 160, 81, 2, 781, 57, 3, 2, 2, 2, 782, 784, 5, 88, 45, 2, 783, 782, 3, 2, 2, 2, 783, 784, 3, 2, 2, 2, 784, 785, 3, 2, 2, 2, 785, 796, 5, 108, 55, 2, 786, 787, 7, 111, 2, 2, 787, 788, 7, 42, 2, 2, 788, 793, 5, 92, 47, 2, 789, 790, 7, 7, 2, 2, 790, 792, 5, 92, 47, 2, 791, 789, 3, 2, 2, 2, 792, 795, 3, 2, 2, 2, 793, 791, 3, 2, 2, 2, 793, 794, 3, 2, 2, 2, 794, 797, 3, 2, 2, 2, 795, 793, 3, 2, 2, 2, 796, 786, 3, 2, 2, 2, 796, 797, 3, 2, 2, 2, 797, 804, 3, 2, 2, 2, 798, 799, 7, 100, 2, 2, 799, 802, 5, 78, 40, 2, 800, 801, 9, 4, 2, 2, 801, 803, 5, 78, 40, 2, 802, 800, 3, 2, 2, 2, 802, 803, 3, 2, 2, 2, 803, 805, 3, 2, 2, 2, 804, 798, 3, 2, 2, 2, 804, 805, 3, 2, 2, 2, 805, 59, 3, 2, 2, 2, 806, 808, 5, 88, 45, 2, 807, 806, 3, 2, 2, 2, 807, 808, 3, 2, 2, 2, 808, 809, 3, 2, 2, 2, 809, 815, 5, 62, 32, 2, 810, 811, 5, 110, 56, 2, 811, 812, 5, 62, 32, 2, 812, 814, 3, 2, 2, 2, 813, 810, 3, 2, 2, 2, 814, 817, 3, 2, 2, 2, 815, 813, 3, 2, 2, 2, 815, 816, 3, 2, 2, 2, 816, 828, 3, 2, 2, 2, 817, 815, 3, 2, 2, 2, 818, 819, 7, 111, 2, 2, 819, 820, 7, 42, 2, 2, 820, 825, 5, 92, 47, 2, 821, 822, 7, 7, 2, 2, 822, 824, 5, 92, 47, 2, 823, 821, 3, 2, 2, 2, 824, 827, 3, 2, 2, 2, 825, 823, 3, 2, 2, 2, 825, 826, 3, 2, 2, 2, 826, 829, 3, 2, 2, 2, 827, 825, 3, 2, 2, 2, 828, 818, 3, 2, 2, 2, 828, 829, 3, 2, 2, 2, 829, 836, 3, 2, 2, 2, 830, 831, 7, 100, 2, 2, 831, 834, 5, 78, 40, 2, 832, 833, 9, 4, 2, 2, 833, 835, 5, 78, 40, 2, 834, 832, 3, 2, 2, 2, 834, 835, 3, 2, 2, 2, 835, 837, 3, 2, 2, 2, 836, 830, 3, 2, 2, 2, 836, 837, 3, 2, 2, 2, 837, 61, 3, 2, 2, 2, 838, 840, 7, 130, 2, 2, 839, 841, 9, 6, 2, 2, 840, 839, 3, 2, 2, 2, 840, 841, 3, 2, 2, 2, 841, 842, 3, 2, 2, 2, 842, 847, 5, 98, 50, 2, 843, 844, 7, 7, 2, 2, 844, 846, 5, 98, 50, 2, 845, 843, 3, 2, 2, 2, 846, 849, 3, 2, 2, 2, 847, 845, 3, 2, 2, 2, 847, 848, 3, 2, 2, 2, 848, 862, 3, 2, 2, 2, 849, 847, 3, 2, 2, 2, 850, 860, 7, 77, 2, 2, 851, 856, 5, 100, 51, 2, 852, 853, 7, 7, 2, 2, 853, 855, 5, 100, 51, 2, 854, 852, 3, 2, 2, 2, 855, 858, 3, 2, 2, 2, 856, 854, 3, 2, 2, 2, 856, 857, 3, 2, 2, 2, 857, 861, 3, 2, 2, 2, 858, 856, 3, 2, 2, 2, 859, 861, 5, 102, 52, 2, 860, 851, 3, 2, 2, 2, 860, 859, 3, 2, 2, 2, 861, 863, 3, 2, 2, 2, 862, 850, 3, 2, 2, 2, 862, 863, 3, 2, 2, 2, 863, 866, 3, 2, 2, 2, 864, 865, 7, 148, 2, 2, 865, 867, 5, 78, 40, 2, 866, 864, 3, 2, 2, 2, 866, 867, 3, 2, 2, 2, 867, 882, 3, 2, 2, 2, 868, 869, 7, 80, 2, 2, 869, 870, 7, 42, 2, 2, 870, 875, 5, 78, 40, 2, 871, 872, 7, 7, 2, 2, 872, 874, 5, 78, 40, 2, 873, 871, 3, 2, 2, 2, 874, 877, 3, 2, 2, 2, 875, 873, 3, 2, 2, 2, 875, 876, 3, 2, 2, 2, 876, 880, 3, 2, 2, 2, 877, 875, 3, 2, 2, 2, 878, 879, 7, 81, 2, 2, 879, 881, 5, 78, 40, 2, 880, 878, 3, 2, 2, 2, 880, 881, 3, 2, 2, 2, 881, 883, 3, 2, 2, 2, 882, 868, 3, 2, 2, 2, 882, 883, 3, 2, 2, 2, 883, 913, 3, 2, 2, 2, 884, 885, 7, 144, 2, 2, 885, 886, 7, 5, 2, 2, 886, 891, 5, 78, 40, 2, 887, 888, 7, 7, 2, 2, 888, 890, 5, 78, 40, 2, 889, 887, 3, 2, 2, 2, 890, 893, 3, 2, 2, 2, 891, 889, 3, 2, 2, 2, 891, 892, 3, 2, 2, 2, 892, 894, 3, 2, 2, 2, 893, 891, 3, 2, 2, 2, 894, 909, 7, 6, 2, 2, 895, 896, 7, 7, 2, 2, 896, 897, 7, 5, 2, 2, 897, 902, 5, 78, 40, 2, 898, 899, 7, 7, 2, 2, 899, 901, 5, 78, 40, 2, 900, 898, 3, 2, 2, 2, 901, 904, 3, 2, 2, 2, 902, 900, 3, 2, 2, 2, 902, 903, 3, 2, 2, 2, 903, 905, 3, 2, 2, 2, 904, 902, 3, 2, 2, 2, 905, 906, 7, 6, 2, 2, 906, 908, 3, 2, 2, 2, 907, 895, 3, 2, 2, 2, 908, 911, 3, 2, 2, 2, 909, 907, 3, 2, 2, 2, 909, 910, 3, 2, 2, 2, 910, 913, 3, 2, 2, 2, 911, 909, 3, 2, 2, 2, 912, 838, 3, 2, 2, 2, 912, 884, 3, 2, 2, 2, 913, 63, 3, 2, 2, 2, 914, 916, 5, 88, 45, 2, 915, 914, 3, 2, 2, 2, 915, 916, 3, 2, 2, 2, 916, 917, 3, 2, 2, 2, 917, 928, 7, 141, 2, 2, 918, 919, 7, 110, 2, 2, 919, 929, 7, 127, 2, 2, 920, 921, 7, 110, 2, 2, 921, 929, 7, 27, 2, 2, 922, 923, 7, 110, 2, 2, 923, 929, 7, 124, 2, 2, 924, 925, 7, 110, 2, 2, 925, 929, 7, 74, 2, 2, 926, 927, 7, 110, 2, 2, 927, 929, 7, 83, 2, 2, 928, 918, 3, 2, 2, 2, 928, 920, 3, 2, 2, 2, 928, 922, 3, 2, 2, 2, 928, 924, 3, 2, 2, 2, 928, 926, 3, 2, 2, 2, 928, 929, 3, 2, 2, 2, 929, 930, 3, 2, 2, 2, 930, 931, 5, 90, 46, 2, 931, 932, 7, 131, 2, 2, 932, 933, 5, 142, 72, 2, 933, 934, 7, 8, 2, 2, 934, 942, 5, 78, 40, 2, 935, 936, 7, 7, 2, 2, 936, 937, 5, 142, 72, 2, 937, 938, 7, 8, 2, 2, 938, 939, 5, 78, 40, 2, 939, 941, 3, 2, 2, 2, 940, 935, 3, 2, 2, 2, 941, 944, 3, 2, 2, 2, 942, 940, 3, 2, 2, 2, 942, 943, 3, 2, 2, 2, 943, 947, 3, 2, 2, 2, 944, 942, 3, 2, 2, 2, 945, 946, 7, 148, 2, 2, 946, 948, 5, 78, 40, 2, 947, 945, 3, 2, 2, 2, 947, 948, 3, 2, 2, 2, 948, 65, 3, 2, 2, 2, 949, 951, 5, 88, 45, 2, 950, 949, 3, 2, 2, 2, 950, 951, 3, 2, 2, 2, 951, 952, 3, 2, 2, 2, 952, 963, 7, 141, 2, 2, 953, 954, 7, 110, 2, 2, 954, 964, 7, 127, 2, 2, 955, 956, 7, 110, 2, 2, 956, 964, 7, 27, 2, 2, 957, 958, 7, 110, 2, 2, 958, 964, 7, 124, 2, 2, 959, 960, 7, 110, 2, 2, 960, 964, 7, 74, 2, 2, 961, 962, 7, 110, 2, 2, 962, 964, 7, 83, 2, 2, 963, 953, 3, 2, 2, 2, 963, 955, 3, 2, 2, 2, 963, 957, 3, 2, 2, 2, 963, 959, 3, 2, 2, 2, 963, 961, 3, 2, 2, 2, 963, 964, 3, 2, 2, 2, 964, 965, 3, 2, 2, 2, 965, 966, 5, 90, 46, 2, 966, 967, 7, 131, 2, 2, 967, 968, 5, 142, 72, 2, 968, 969, 7, 8, 2, 2, 969, 977, 5, 78, 40, 2, 970, 971, 7, 7, 2, 2, 971, 972, 5, 142, 72, 2, 972, 973, 7, 8, 2, 2, 973, 974, 5, 78, 40, 2, 974, 976, 3, 2, 2, 2, 975, 970, 3, 2, 2, 2, 976, 979, 3, 2, 2, 2, 977, 975, 3, 2, 2, 2, 977, 978, 3, 2, 2, 2, 978, 982, 3, 2, 2, 2, 979, 977, 3, 2, 2, 2, 980, 981, 7, 148, 2, 2, 981, 983, 5, 78, 40, 2, 982, 980, 3, 2, 2, 2, 982, 983, 3, 2, 2, 2, 983, 1002, 3, 2, 2, 2, 984, 985, 7, 111, 2, 2, 985, 986, 7, 42, 2, 2, 986, 991, 5, 92, 47, 2, 987, 988, 7, 7, 2, 2, 988, 990, 5, 92, 47, 2, 989, 987, 3, 2, 2, 2, 990, 993, 3, 2, 2, 2, 991, 989, 3, 2, 2, 2, 991, 992, 3, 2, 2, 2, 992, 995, 3, 2, 2, 2, 993, 991, 3, 2, 2, 2, 994, 984, 3, 2, 2, 2, 994, 995, 3, 2, 2, 2, 995, 996, 3, 2, 2, 2, 996, 997, 7, 100, 2, 2, 997, 1000, 5, 78, 40, 2, 998, 999, 9, 4, 2, 2, 999, 1001, 5, 78, 40, 2, 1000, 998, 3, 2, 2, 2, 1000, 1001, 3, 2, 2, 2, 1001, 1003, 3, 2, 2, 2, 1002, 994, 3, 2, 2, 2, 1002, 1003, 3, 2, 2, 2, 1003, 67, 3, 2, 2, 2, 1004, 1005, 7, 143, 2, 2, 1005, 69, 3, 2, 2, 2, 1006, 1008, 5, 142, 72, 2, 1007, 1009, 5, 72, 37, 2, 1008, 1007, 3, 2, 2, 2, 1008, 1009, 3, 2, 2, 2, 1009, 1013, 3, 2, 2, 2, 1010, 1012, 5, 74, 38, 2, 1011, 1010, 3, 2, 2, 2, 1012, 1015, 3, 2, 2, 2, 1013, 1011, 3, 2, 2, 2, 1013, 1014, 3, 2, 2, 2, 1014, 71, 3, 2, 2, 2, 1015, 1013, 3, 2, 2, 2, 1016, 1018, 5, 126, 64, 2, 1017, 1016, 3, 2, 2, 2, 1018, 1019, 3, 2, 2, 2, 1019, 1020, 3, 2, 2, 2, 1019, 1017, 3, 2, 2, 2, 1020, 1031, 3, 2, 2, 2, 1021, 1022, 7, 5, 2, 2, 1022, 1023, 5, 112, 57, 2, 1023, 1024, 7, 6, 2, 2, 1024, 1032, 3, 2, 2, 2, 1025, 1026, 7, 5, 2, 2, 1026, 1027, 5, 112, 57, 2, 1027, 1028, 7, 7, 2, 2, 1028, 1029, 5, 112, 57, 2, 1029, 1030, 7, 6, 2, 2, 1030, 1032, 3, 2, 2, 2, 1031, 1021, 3, 2, 2, 2, 1031, 1025, 3, 2, 2, 2, 1031, 1032, 3, 2, 2, 2, 1032, 73, 3, 2, 2, 2, 1033, 1034, 7, 51, 2, 2, 1034, 1036, 5, 126, 64, 2, 1035, 1033, 3, 2, 2, 2, 1035, 1036, 3, 2, 2, 2, 1036, 1070, 3, 2, 2, 2, 1037, 1038, 7, 115, 2, 2, 1038, 1040, 7, 97, 2, 2, 1039, 1041, 9, 7, 2, 2, 1040, 1039, 3, 2, 2, 2, 1040, 1041, 3, 2, 2, 2, 1041, 1042, 3, 2, 2, 2, 1042, 1044, 5, 76, 39, 2, 1043, 1045, 7, 38, 2, 2, 1044, 1043, 3, 2, 2, 2, 1044, 1045, 3, 2, 2, 2, 1045, 1071, 3, 2, 2, 2, 1046, 1048, 7, 104, 2, 2, 1047, 1046, 3, 2, 2, 2, 1047, 1048, 3, 2, 2, 2, 1048, 1049, 3, 2, 2, 2, 1049, 1050, 7, 106, 2, 2, 1050, 1071, 5, 76, 39, 2, 1051, 1052, 7, 140, 2, 2, 1052, 1071, 5, 76, 39, 2, 1053, 1054, 7, 46, 2, 2, 1054, 1055, 7, 5, 2, 2, 1055, 1056, 5, 78, 40, 2, 1056, 1057, 7, 6, 2, 2, 1057, 1071, 3, 2, 2, 2, 1058, 1065, 7, 58, 2, 2, 1059, 1066, 5, 112, 57, 2, 1060, 1066, 5, 114, 58, 2, 1061, 1062, 7, 5, 2, 2, 1062, 1063, 5, 78, 40, 2, 1063, 1064, 7, 6, 2, 2, 1064, 1066, 3, 2, 2, 2, 1065, 1059, 3, 2, 2, 2, 1065, 1060, 3, 2, 2, 2, 1065, 1061, 3, 2, 2, 2, 1066, 1071, 3, 2, 2, 2, 1067, 1068, 7, 47, 2, 2, 1068, 1071, 5, 146, 74, 2, 1069, 1071, 5, 80, 41, 2, 1070, 1037, 3, 2, 2, 2, 1070, 1047, 3, 2, 2, 2, 1070, 1051, 3, 2, 2, 2, 1070, 1053, 3, 2, 2, 2, 1070, 1058, 3, 2, 2, 2, 1070, 1067, 3, 2, 2, 2, 1070, 1069, 3, 2, 2, 2, 1071, 75, 3, 2, 2, 2, 1072, 1073, 7, 109, 2, 2, 1073, 1074, 7, 50, 2, 2, 1074, 1076, 9, 8, 2, 2, 1075, 1072, 3, 2, 2, 2, 1075, 1076, 3, 2, 2, 2, 1076, 77, 3, 2, 2, 2, 1077, 1078, 8, 40, 1, 2, 1078, 1154, 5, 114, 58, 2, 1079, 1154, 7, 153, 2, 2, 1080, 1081, 5, 130, 66, 2, 1081, 1082, 7, 4, 2, 2, 1082, 1084, 3, 2, 2, 2, 1083, 1080, 3, 2, 2, 2, 1083, 1084, 3, 2, 2, 2, 1084, 1085, 3, 2, 2, 2, 1085, 1086, 5, 136, 69, 2, 1086, 1087, 7, 4, 2, 2, 1087, 1089, 3, 2, 2, 2, 1088, 1083, 3, 2, 2, 2, 1088, 1089, 3, 2, 2, 2, 1089, 1090, 3, 2, 2, 2, 1090, 1154, 5, 142, 72, 2, 1091, 1092, 5, 116, 59, 2, 1092, 1093, 5, 78, 40, 23, 1093, 1154, 3, 2, 2, 2, 1094, 1095, 5, 128, 65, 2, 1095, 1108, 7, 5, 2, 2, 1096, 1098, 7, 64, 2, 2, 1097, 1096, 3, 2, 2, 2, 1097, 1098, 3, 2, 2, 2, 1098, 1099, 3, 2, 2, 2, 1099, 1104, 5, 78, 40, 2, 1100, 1101, 7, 7, 2, 2, 1101, 1103, 5, 78, 40, 2, 1102, 1100, 3, 2, 2, 2, 1103, 1106, 3, 2, 2, 2, 1104, 1102, 3, 2, 2, 2, 1104, 1105, 3, 2, 2, 2, 1105, 1109, 3, 2, 2, 2, 1106, 1104, 3, 2, 2, 2, 1107, 1109, 7, 9, 2, 2, 1108, 1097, 3, 2, 2, 2, 1108, 1107, 3, 2, 2, 2, 1108, 1109, 3, 2, 2, 2, 1109, 1110, 3, 2, 2, 2, 1110, 1111, 7, 6, 2, 2, 1111, 1154, 3, 2, 2, 2, 1112, 1113, 7, 5, 2, 2, 1113, 1114, 5, 78, 40, 2, 1114, 1115, 7, 6, 2, 2, 1115, 1154, 3, 2, 2, 2, 1116, 1117, 7, 45, 2, 2, 1117, 1118, 7, 5, 2, 2, 1118, 1119, 5, 78, 40, 2, 1119, 1120, 7, 35, 2, 2, 1120, 1121, 5, 72, 37, 2, 1121, 1122, 7, 6, 2, 2, 1122, 1154, 3, 2, 2, 2, 1123, 1125, 7, 104, 2, 2, 1124, 1123, 3, 2, 2, 2, 1124, 1125, 3, 2, 2, 2, 1125, 1126, 3, 2, 2, 2, 1126, 1128, 7, 72, 2, 2, 1127, 1124, 3, 2, 2, 2, 1127, 1128, 3, 2, 2, 2, 1128, 1129, 3, 2, 2, 2, 1129, 1130, 7, 5, 2, 2, 1130, 1131, 5, 60, 31, 2, 1131, 1132, 7, 6, 2, 2, 1132, 1154, 3, 2, 2, 2, 1133, 1135, 7, 44, 2, 2, 1134, 1136, 5, 78, 40, 2, 1135, 1134, 3, 2, 2, 2, 1135, 1136, 3, 2, 2, 2, 1136, 1142, 3, 2, 2, 2, 1137, 1138, 7, 147, 2, 2, 1138, 1139, 5, 78, 40, 2, 1139, 1140, 7, 135, 2, 2, 1140, 1141, 5, 78, 40, 2, 1141, 1143, 3, 2, 2, 2, 1142, 1137, 3, 2, 2, 2, 1143, 1144, 3, 2, 2, 2, 1144, 1142, 3, 2, 2, 2, 1144, 1145, 3, 2, 2, 2, 1145, 1148, 3, 2, 2, 2, 1146, 1147, 7, 67, 2, 2, 1147, 1149, 5, 78, 40, 2, 1148, 1146, 3, 2, 2, 2, 1148, 1149, 3, 2, 2, 2, 1149, 1150, 3, 2, 2, 2, 1150, 1151, 7, 68, 2, 2, 1151, 1154, 3, 2, 2, 2, 1152, 1154, 5, 82, 42, 2, 1153, 1077, 3, 2, 2, 2, 1153, 1079, 3, 2, 2, 2, 1153, 1088, 3, 2, 2, 2, 1153, 1091, 3, 2, 2, 2, 1153, 1094, 3, 2, 2, 2, 1153, 1112, 3, 2, 2, 2, 1153, 1116, 3, 2, 2, 2, 1153, 1127, 3, 2, 2, 2, 1153, 1133, 3, 2, 2, 2, 1153, 1152, 3, 2, 2, 2, 1154, 1242, 3, 2, 2, 2, 1155, 1156, 12, 22, 2, 2, 1156, 1157, 7, 13, 2, 2, 1157, 1241, 5, 78, 40, 23, 1158, 1159, 12, 21, 2, 2, 1159, 1160, 9, 9, 2, 2, 1160, 1241, 5, 78, 40, 22, 1161, 1162, 12, 20, 2, 2, 1162, 1163, 9, 10, 2, 2, 1163, 1241, 5, 78, 40, 21, 1164, 1165, 12, 19, 2, 2, 1165, 1166, 9, 11, 2, 2, 1166, 1241, 5, 78, 40, 20, 1167, 1168, 12, 18, 2, 2, 1168, 1169, 9, 12, 2, 2, 1169, 1241, 5, 78, 40, 19, 1170, 1171, 12, 17, 2, 2, 1171, 1172, 9, 13, 2, 2, 1172, 1241, 5, 78, 40, 18, 1173, 1174, 12, 15, 2, 2, 1174, 1175, 7, 34, 2, 2, 1175, 1241, 5, 78, 40, 16, 1176, 1177, 12, 14, 2, 2, 1177, 1178, 7, 110, 2, 2, 1178, 1241, 5, 78, 40, 15, 1179, 1180, 12, 7, 2, 2, 1180, 1182, 7, 94, 2, 2, 1181, 1183, 7, 104, 2, 2, 1182, 1181, 3, 2, 2, 2, 1182, 1183, 3, 2, 2, 2, 1183, 1184, 3, 2, 2, 2, 1184, 1241, 5, 78, 40, 8, 1185, 1187, 12, 6, 2, 2, 1186, 1188, 7, 104, 2, 2, 1187, 1186, 3, 2, 2, 2, 1187, 1188, 3, 2, 2, 2, 1188, 1189, 3, 2, 2, 2, 1189, 1190, 7, 41, 2, 2, 1190, 1191, 5, 78, 40, 2, 1191, 1192, 7, 34, 2, 2, 1192, 1193, 5, 78, 40, 7, 1193, 1241, 3, 2, 2, 2, 1194, 1196, 12, 16, 2, 2, 1195, 1197, 7, 104, 2, 2, 1196, 1195, 3, 2, 2, 2, 1196, 1197, 3, 2, 2, 2, 1197, 1198, 3, 2, 2, 2, 1198, 1218, 7, 85, 2, 2, 1199, 1209, 7, 5, 2, 2, 1200, 1210, 5, 60, 31, 2, 1201, 1206, 5, 78, 40, 2, 1202, 1203, 7, 7, 2, 2, 1203, 1205, 5, 78, 40, 2, 1204, 1202, 3, 2, 2, 2, 1205, 1208, 3, 2, 2, 2, 1206, 1204, 3, 2, 2, 2, 1206, 1207, 3, 2, 2, 2, 1207, 1210, 3, 2, 2, 2, 1208, 1206, 3, 2, 2, 2, 1209, 1200, 3, 2, 2, 2, 1209, 1201, 3, 2, 2, 2, 1209, 1210, 3, 2, 2, 2, 1210, 1211, 3, 2, 2, 2, 1211, 1219, 7, 6, 2, 2, 1212, 1213, 5, 130, 66, 2, 1213, 1214, 7, 4, 2, 2, 1214, 1216, 3, 2, 2, 2, 1215, 1212, 3, 2, 2, 2, 1215, 1216, 3, 2, 2, 2, 1216, 1217, 3, 2, 2, 2, 1217, 1219, 5, 136, 69, 2, 1218, 1199, 3, 2, 2, 2, 1218, 1215, 3, 2, 2, 2, 1219, 1241, 3, 2, 2, 2, 1220, 1221, 12, 10, 2, 2, 1221, 1222, 7, 47, 2, 2, 1222, 1241, 5, 146, 74, 2, 1223, 1225, 12, 9, 2, 2, 1224, 1226, 7, 104, 2, 2, 1225, 1224, 3, 2, 2, 2, 1225, 1226, 3, 2, 2, 2, 1226, 1227, 3, 2, 2, 2, 1227, 1228, 9, 14, 2, 2, 1228, 1231, 5, 78, 40, 2, 1229, 1230, 7, 69, 2, 2, 1230, 1232, 5, 78, 40, 2, 1231, 1229, 3, 2, 2, 2, 1231, 1232, 3, 2, 2, 2, 1232, 1241, 3, 2, 2, 2, 1233, 1238, 12, 8, 2, 2, 1234, 1239, 7, 95, 2, 2, 1235, 1239, 7, 105, 2, 2, 1236, 1237, 7, 104, 2, 2, 1237, 1239, 7, 106, 2, 2, 1238, 1234, 3, 2, 2, 2, 1238, 1235, 3, 2, 2, 2, 1238, 1236, 3, 2, 2, 2, 1239, 1241, 3, 2, 2, 2, 1240, 1155, 3, 2, 2, 2, 1240, 1158, 3, 2, 2, 2, 1240, 1161, 3, 2, 2, 2, 1240, 1164, 3, 2, 2, 2, 1240, 1167, 3, 2, 2, 2, 1240, 1170, 3, 2, 2, 2, 1240, 1173, 3, 2, 2, 2, 1240, 1176, 3, 2, 2, 2, 1240, 1179, 3, 2, 2, 2, 1240, 1185, 3, 2, 2, 2, 1240, 1194, 3, 2, 2, 2, 1240, 1220, 3, 2, 2, 2, 1240, 1223, 3, 2, 2, 2, 1240, 1233, 3, 2, 2, 2, 1241, 1244, 3, 2, 2, 2, 1242, 1240, 3, 2, 2, 2, 1242, 1243, 3, 2, 2, 2, 1243, 79, 3, 2, 2, 2, 1244, 1242, 3, 2, 2, 2, 1245, 1246, 7, 119, 2, 2, 1246, 1258, 5, 148, 75, 2, 1247, 1248, 7, 5, 2, 2, 1248, 1253, 5, 142, 72, 2, 1249, 1250, 7, 7, 2, 2, 1250, 1252, 5, 142, 72, 2, 1251, 1249, 3, 2, 2, 2, 1252, 1255, 3, 2, 2, 2, 1253, 1251, 3, 2, 2, 2, 1253, 1254, 3, 2, 2, 2, 1254, 1256, 3, 2, 2, 2, 1255, 1253, 3, 2, 2, 2, 1256, 1257, 7, 6, 2, 2, 1257, 1259, 3, 2, 2, 2, 1258, 1247, 3, 2, 2, 2, 1258, 1259, 3, 2, 2, 2, 1259, 1278, 3, 2, 2, 2, 1260, 1261, 7, 109, 2, 2, 1261, 1270, 9, 15, 2, 2, 1262, 1263, 7, 131, 2, 2, 1263, 1271, 7, 106, 2, 2, 1264, 1265, 7, 131, 2, 2, 1265, 1271, 7, 58, 2, 2, 1266, 1271, 7, 43, 2, 2, 1267, 1271, 7, 125, 2, 2, 1268, 1269, 7, 103, 2, 2, 1269, 1271, 7, 28, 2, 2, 1270, 1262, 3, 2, 2, 2, 1270, 1264, 3, 2, 2, 2, 1270, 1266, 3, 2, 2, 2, 1270, 1267, 3, 2, 2, 2, 1270, 1268, 3, 2, 2, 2, 1271, 1275, 3, 2, 2, 2, 1272, 1273, 7, 101, 2, 2, 1273, 1275, 5, 126, 64, 2, 1274, 1260, 3, 2, 2, 2, 1274, 1272, 3, 2, 2, 2, 1275, 1277, 3, 2, 2, 2, 1276, 1274, 3, 2, 2, 2, 1277, 1280, 3, 2, 2, 2, 1278, 1276, 3, 2, 2, 2, 1278, 1279, 3, 2, 2, 2, 1279, 1291, 3, 2, 2, 2, 1280, 1278, 3, 2, 2, 2, 1281, 1283, 7, 104, 2, 2, 1282, 1281, 3, 2, 2, 2, 1282, 1283, 3, 2, 2, 2, 1283, 1284, 3, 2, 2, 2, 1284, 1289, 7, 59, 2, 2, 1285, 1286, 7, 88, 2, 2, 1286, 1290, 7, 60, 2, 2, 1287, 1288, 7, 88, 2, 2, 1288, 1290, 7, 84, 2, 2, 1289, 1285, 3, 2, 2, 2, 1289, 1287, 3, 2, 2, 2, 1289, 1290, 3, 2, 2, 2, 1290, 1292, 3, 2, 2, 2, 1291, 1282, 3, 2, 2, 2, 1291, 1292, 3, 2, 2, 2, 1292, 81, 3, 2, 2, 2, 1293, 1294, 7, 117, 2, 2, 1294, 1299, 7, 5, 2, 2, 1295, 1300, 7, 83, 2, 2, 1296, 1297, 9, 16, 2, 2, 1297, 1298, 7, 7, 2, 2, 1298, 1300, 5, 118, 60, 2, 1299, 1295, 3, 2, 2, 2, 1299, 1296, 3, 2, 2, 2, 1300, 1301, 3, 2, 2, 2, 1301, 1302, 7, 6, 2, 2, 1302, 83, 3, 2, 2, 2, 1303, 1306, 5, 142, 72, 2, 1304, 1305, 7, 47, 2, 2, 1305, 1307, 5, 146, 74, 2, 1306, 1304, 3, 2, 2, 2, 1306, 1307, 3, 2, 2, 2, 1307, 1309, 3, 2, 2, 2, 1308, 1310, 9, 7, 2, 2, 1309, 1308, 3, 2, 2, 2, 1309, 1310, 3, 2, 2, 2, 1310, 85, 3, 2, 2, 2, 1311, 1312, 7, 51, 2, 2, 1312, 1314, 5, 126, 64, 2, 1313, 1311, 3, 2, 2, 2, 1313, 1314, 3, 2, 2, 2, 1314, 1351, 3, 2, 2, 2, 1315, 1316, 7, 115, 2, 2, 1316, 1319, 7, 97, 2, 2, 1317, 1319, 7, 140, 2, 2, 1318, 1315, 3, 2, 2, 2, 1318, 1317, 3, 2, 2, 2, 1319, 1320, 3, 2, 2, 2, 1320, 1321, 7, 5, 2, 2, 1321, 1326, 5, 84, 43, 2, 1322, 1323, 7, 7, 2, 2, 1323, 1325, 5, 84, 43, 2, 1324, 1322, 3, 2, 2, 2, 1325, 1328, 3, 2, 2, 2, 1326, 1324, 3, 2, 2, 2, 1326, 1327, 3, 2, 2, 2, 1327, 1329, 3, 2, 2, 2, 1328, 1326, 3, 2, 2, 2, 1329, 1330, 7, 6, 2, 2, 1330, 1331, 5, 76, 39, 2, 1331, 1352, 3, 2, 2, 2, 1332, 1333, 7, 46, 2, 2, 1333, 1334, 7, 5, 2, 2, 1334, 1335, 5, 78, 40, 2, 1335, 1336, 7, 6, 2, 2, 1336, 1352, 3, 2, 2, 2, 1337, 1338, 7, 76, 2, 2, 1338, 1339, 7, 97, 2, 2, 1339, 1340, 7, 5, 2, 2, 1340, 1345, 5, 142, 72, 2, 1341, 1342, 7, 7, 2, 2, 1342, 1344, 5, 142, 72, 2, 1343, 1341, 3, 2, 2, 2, 1344, 1347, 3, 2, 2, 2, 1345, 1343, 3, 2, 2, 2, 1345, 1346, 3, 2, 2, 2, 1346, 1348, 3, 2, 2, 2, 1347, 1345, 3, 2, 2, 2, 1348, 1349, 7, 6, 2, 2, 1349, 1350, 5, 80, 41, 2, 1350, 1352, 3, 2, 2, 2, 1351, 1318, 3, 2, 2, 2, 1351, 1332, 3, 2, 2, 2, 1351, 1337, 3, 2, 2, 2, 1352, 87, 3, 2, 2, 2, 1353, 1355, 7, 149, 2, 2, 1354, 1356, 7, 118, 2, 2, 1355, 1354, 3, 2, 2, 2, 1355, 1356, 3, 2, 2, 2, 1356, 1357, 3, 2, 2, 2, 1357, 1362, 5, 96, 49, 2, 1358, 1359, 7, 7, 2, 2, 1359, 1361, 5, 96, 49, 2, 1360, 1358, 3, 2, 2, 2, 1361, 1364, 3, 2, 2, 2, 1362, 1360, 3, 2, 2, 2, 1362, 1363, 3, 2, 2, 2, 1363, 89, 3, 2, 2, 2, 1364, 1362, 3, 2, 2, 2, 1365, 1366, 5, 130, 66, 2, 1366, 1367, 7, 4, 2, 2, 1367, 1369, 3, 2, 2, 2, 1368, 1365, 3, 2, 2, 2, 1368, 1369, 3, 2, 2, 2, 1369, 1370, 3, 2, 2, 2, 1370, 1376, 5, 136, 69, 2, 1371, 1372, 7, 87, 2, 2, 1372, 1373, 7, 42, 2, 2, 1373, 1377, 5, 150, 76, 2, 1374, 1375, 7, 104, 2, 2, 1375, 1377, 7, 87, 2, 2, 1376, 1371, 3, 2, 2, 2, 1376, 1374, 3, 2, 2, 2, 1376, 1377, 3, 2, 2, 2, 1377, 91, 3, 2, 2, 2, 1378, 1381, 5, 78, 40, 2, 1379, 1380, 7, 47, 2, 2, 1380, 1382, 5, 146, 74, 2, 1381, 1379, 3, 2, 2, 2, 1381, 1382, 3, 2, 2, 2, 1382, 1384, 3, 2, 2, 2, 1383, 1385, 9, 7, 2, 2, 1384, 1383, 3, 2, 2, 2, 1384, 1385, 3, 2, 2, 2, 1385, 93, 3, 2, 2, 2, 1386, 1390, 5, 112, 57, 2, 1387, 1390, 5, 126, 64, 2, 1388, 1390, 7, 154, 2, 2, 1389, 1386, 3, 2, 2, 2, 1389, 1387, 3, 2, 2, 2, 1389, 1388, 3, 2, 2, 2, 1390, 95, 3, 2, 2, 2, 1391, 1403, 5, 136, 69, 2, 1392, 1393, 7, 5, 2, 2, 1393, 1398, 5, 142, 72, 2, 1394, 1395, 7, 7, 2, 2, 1395, 1397, 5, 142, 72, 2, 1396, 1394, 3, 2, 2, 2, 1397, 1400, 3, 2, 2, 2, 1398, 1396, 3, 2, 2, 2, 1398, 1399, 3, 2, 2, 2, 1399, 1401, 3, 2, 2, 2, 1400, 1398, 3, 2, 2, 2, 1401, 1402, 7, 6, 2, 2, 1402, 1404, 3, 2, 2, 2, 1403, 1392, 3, 2, 2, 2, 1403, 1404, 3, 2, 2, 2, 1404, 1405, 3, 2, 2, 2, 1405, 1406, 7, 35, 2, 2, 1406, 1407, 7, 5, 2, 2, 1407, 1408, 5, 60, 31, 2, 1408, 1409, 7, 6, 2, 2, 1409, 97, 3, 2, 2, 2, 1410, 1423, 7, 9, 2, 2, 1411, 1412, 5, 136, 69, 2, 1412, 1413, 7, 4, 2, 2, 1413, 1414, 7, 9, 2, 2, 1414, 1423, 3, 2, 2, 2, 1415, 1420, 5, 78, 40, 2, 1416, 1418, 7, 35, 2, 2, 1417, 1416, 3, 2, 2, 2, 1417, 1418, 3, 2, 2, 2, 1418, 1419, 3, 2, 2, 2, 1419, 1421, 5, 122, 62, 2, 1420, 1417, 3, 2, 2, 2, 1420, 1421, 3, 2, 2, 2, 1421, 1423, 3, 2, 2, 2, 1422, 1410, 3, 2, 2, 2, 1422, 1411, 3, 2, 2, 2, 1422, 1415, 3, 2, 2, 2, 1423, 99, 3, 2, 2, 2, 1424, 1425, 5, 132, 67, 2, 1425, 1426, 7, 4, 2, 2, 1426, 1428, 3, 2, 2, 2, 1427, 1424, 3, 2, 2, 2, 1427, 1428, 3, 2, 2, 2, 1428, 1429, 3, 2, 2, 2, 1429, 1434, 5, 136, 69, 2, 1430, 1432, 7, 35, 2, 2, 1431, 1430, 3, 2, 2, 2, 1431, 1432, 3, 2, 2, 2, 1432, 1433, 3, 2, 2, 2, 1433, 1435, 5, 162, 82, 2, 1434, 1431, 3, 2, 2, 2, 1434, 1435, 3, 2, 2, 2, 1435, 1441, 3, 2, 2, 2, 1436, 1437, 7, 87, 2, 2, 1437, 1438, 7, 42, 2, 2, 1438, 1442, 5, 150, 76, 2, 1439, 1440, 7, 104, 2, 2, 1440, 1442, 7, 87, 2, 2, 1441, 1436, 3, 2, 2, 2, 1441, 1439, 3, 2, 2, 2, 1441, 1442, 3, 2, 2, 2, 1442, 1491, 3, 2, 2, 2, 1443, 1444, 5, 132, 67, 2, 1444, 1445, 7, 4, 2, 2, 1445, 1447, 3, 2, 2, 2, 1446, 1443, 3, 2, 2, 2, 1446, 1447, 3, 2, 2, 2, 1447, 1448, 3, 2, 2, 2, 1448, 1449, 5, 134, 68, 2, 1449, 1458, 7, 5, 2, 2, 1450, 1455, 5, 78, 40, 2, 1451, 1452, 7, 7, 2, 2, 1452, 1454, 5, 78, 40, 2, 1453, 1451, 3, 2, 2, 2, 1454, 1457, 3, 2, 2, 2, 1455, 1453, 3, 2, 2, 2, 1455, 1456, 3, 2, 2, 2, 1456, 1459, 3, 2, 2, 2, 1457, 1455, 3, 2, 2, 2, 1458, 1450, 3, 2, 2, 2, 1458, 1459, 3, 2, 2, 2, 1459, 1460, 3, 2, 2, 2, 1460, 1465, 7, 6, 2, 2, 1461, 1463, 7, 35, 2, 2, 1462, 1461, 3, 2, 2, 2, 1462, 1463, 3, 2, 2, 2, 1463, 1464, 3, 2, 2, 2, 1464, 1466, 5, 162, 82, 2, 1465, 1462, 3, 2, 2, 2, 1465, 1466, 3, 2, 2, 2, 1466, 1491, 3, 2, 2, 2, 1467, 1477, 7, 5, 2, 2, 1468, 1473, 5, 100, 51, 2, 1469, 1470, 7, 7, 2, 2, 1470, 1472, 5, 100, 51, 2, 1471, 1469, 3, 2, 2, 2, 1472, 1475, 3, 2, 2, 2, 1473, 1471, 3, 2, 2, 2, 1473, 1474, 3, 2, 2, 2, 1474, 1478, 3, 2, 2, 2, 1475, 1473, 3, 2, 2, 2, 1476, 1478, 5, 102, 52, 2, 1477, 1468, 3, 2, 2, 2, 1477, 1476, 3, 2, 2, 2, 1478, 1479, 3, 2, 2, 2, 1479, 1480, 7, 6, 2, 2, 1480, 1491, 3, 2, 2, 2, 1481, 1482, 7, 5, 2, 2, 1482, 1483, 5, 60, 31, 2, 1483, 1488, 7, 6, 2, 2, 1484, 1486, 7, 35, 2, 2, 1485, 1484, 3, 2, 2, 2, 1485, 1486, 3, 2, 2, 2, 1486, 1487, 3, 2, 2, 2, 1487, 1489, 5, 162, 82, 2, 1488, 1485, 3, 2, 2, 2, 1488, 1489, 3, 2, 2, 2, 1489, 1491, 3, 2, 2, 2, 1490, 1427, 3, 2, 2, 2, 1490, 1446, 3, 2, 2, 2, 1490, 1467, 3, 2, 2, 2, 1490, 1481, 3, 2, 2, 2, 1491, 101, 3, 2, 2, 2, 1492, 1499, 5, 100, 51, 2, 1493, 1494, 5, 104, 53, 2, 1494, 1495, 5, 100, 51, 2, 1495, 1496, 5, 106, 54, 2, 1496, 1498, 3, 2, 2, 2, 1497, 1493, 3, 2, 2, 2, 1498, 1501, 3, 2, 2, 2, 1499, 1497, 3, 2, 2, 2, 1499, 1500, 3, 2, 2, 2, 1500, 103, 3, 2, 2, 2, 1501, 1499, 3, 2, 2, 2, 1502, 1516, 7, 7, 2, 2, 1503, 1505, 7, 102, 2, 2, 1504, 1503, 3, 2, 2, 2, 1504, 1505, 3, 2, 2, 2, 1505, 1512, 3, 2, 2, 2, 1506, 1508, 7, 98, 2, 2, 1507, 1509, 7, 112, 2, 2, 1508, 1507, 3, 2, 2, 2, 1508, 1509, 3, 2, 2, 2, 1509, 1513, 3, 2, 2, 2, 1510, 1513, 7, 89, 2, 2, 1511, 1513, 7, 53, 2, 2, 1512, 1506, 3, 2, 2, 2, 1512, 1510, 3, 2, 2, 2, 1512, 1511, 3, 2, 2, 2, 1512, 1513, 3, 2, 2, 2, 1513, 1514, 3, 2, 2, 2, 1514, 1516, 7, 96, 2, 2, 1515, 1502, 3, 2, 2, 2, 1515, 1504, 3, 2, 2, 2, 1516, 105, 3, 2, 2, 2, 1517, 1518, 7, 109, 2, 2, 1518, 1532, 5, 78, 40, 2, 1519, 1520, 7, 142, 2, 2, 1520, 1521, 7, 5, 2, 2, 1521, 1526, 5, 142, 72, 2, 1522, 1523, 7, 7, 2, 2, 1523, 1525, 5, 142, 72, 2, 1524, 1522, 3, 2, 2, 2, 1525, 1528, 3, 2, 2, 2, 1526, 1524, 3, 2, 2, 2, 1526, 1527, 3, 2, 2, 2, 1527, 1529, 3, 2, 2, 2, 1528, 1526, 3, 2, 2, 2, 1529, 1530, 7, 6, 2, 2, 1530, 1532, 3, 2, 2, 2, 1531, 1517, 3, 2, 2, 2, 1531, 1519, 3, 2, 2, 2, 1531, 1532, 3, 2, 2, 2, 1532, 107, 3, 2, 2, 2, 1533, 1535, 7, 130, 2, 2, 1534, 1536, 9, 6, 2, 2, 1535, 1534, 3, 2, 2, 2, 1535, 1536, 3, 2, 2, 2, 1536, 1537, 3, 2, 2, 2, 1537, 1542, 5, 98, 50, 2, 1538, 1539, 7, 7, 2, 2, 1539, 1541, 5, 98, 50, 2, 1540, 1538, 3, 2, 2, 2, 1541, 1544, 3, 2, 2, 2, 1542, 1540, 3, 2, 2, 2, 1542, 1543, 3, 2, 2, 2, 1543, 1557, 3, 2, 2, 2, 1544, 1542, 3, 2, 2, 2, 1545, 1555, 7, 77, 2, 2, 1546, 1551, 5, 100, 51, 2, 1547, 1548, 7, 7, 2, 2, 1548, 1550, 5, 100, 51, 2, 1549, 1547, 3, 2, 2, 2, 1550, 1553, 3, 2, 2, 2, 1551, 1549, 3, 2, 2, 2, 1551, 1552, 3, 2, 2, 2, 1552, 1556, 3, 2, 2, 2, 1553, 1551, 3, 2, 2, 2, 1554, 1556, 5, 102, 52, 2, 1555, 1546, 3, 2, 2, 2, 1555, 1554, 3, 2, 2, 2, 1556, 1558, 3, 2, 2, 2, 1557, 1545, 3, 2, 2, 2, 1557, 1558, 3, 2, 2, 2, 1558, 1561, 3, 2, 2, 2, 1559, 1560, 7, 148, 2, 2, 1560, 1562, 5, 78, 40, 2, 1561, 1559, 3, 2, 2, 2, 1561, 1562, 3, 2, 2, 2, 1562, 1577, 3, 2, 2, 2, 1563, 1564, 7, 80, 2, 2, 1564, 1565, 7, 42, 2, 2, 1565, 1570, 5, 78, 40, 2, 1566, 1567, 7, 7, 2, 2, 1567, 1569, 5, 78, 40, 2, 1568, 1566, 3, 2, 2, 2, 1569, 1572, 3, 2, 2, 2, 1570, 1568, 3, 2, 2, 2, 1570, 1571, 3, 2, 2, 2, 1571, 1575, 3, 2, 2, 2, 1572, 1570, 3, 2, 2, 2, 1573, 1574, 7, 81, 2, 2, 1574, 1576, 5, 78, 40, 2, 1575, 1573, 3, 2, 2, 2, 1575, 1576, 3, 2, 2, 2, 1576, 1578, 3, 2, 2, 2, 1577, 1563, 3, 2, 2, 2, 1577, 1578, 3, 2, 2, 2, 1578, 1608, 3, 2, 2, 2, 1579, 1580, 7, 144, 2, 2, 1580, 1581, 7, 5, 2, 2, 1581, 1586, 5, 78, 40, 2, 1582, 1583, 7, 7, 2, 2, 1583, 1585, 5, 78, 40, 2, 1584, 1582, 3, 2, 2, 2, 1585, 1588, 3, 2, 2, 2, 1586, 1584, 3, 2, 2, 2, 1586, 1587, 3, 2, 2, 2, 1587, 1589, 3, 2, 2, 2, 1588, 1586, 3, 2, 2, 2, 1589, 1604, 7, 6, 2, 2, 1590, 1591, 7, 7, 2, 2, 1591, 1592, 7, 5, 2, 2, 1592, 1597, 5, 78, 40, 2, 1593, 1594, 7, 7, 2, 2, 1594, 1596, 5, 78, 40, 2, 1595, 1593, 3, 2, 2, 2, 1596, 1599, 3, 2, 2, 2, 1597, 1595, 3, 2, 2, 2, 1597, 1598, 3, 2, 2, 2, 1598, 1600, 3, 2, 2, 2, 1599, 1597, 3, 2, 2, 2, 1600, 1601, 7, 6, 2, 2, 1601, 1603, 3, 2, 2, 2, 1602, 1590, 3, 2, 2, 2, 1603, 1606, 3, 2, 2, 2, 1604, 1602, 3, 2, 2, 2, 1604, 1605, 3, 2, 2, 2, 1605, 1608, 3, 2, 2, 2, 1606, 1604, 3, 2, 2, 2, 1607, 1533, 3, 2, 2, 2, 1607, 1579, 3, 2, 2, 2, 1608, 109, 3, 2, 2, 2, 1609, 1615, 7, 139, 2, 2, 1610, 1611, 7, 139, 2, 2, 1611, 1615, 7, 31, 2, 2, 1612, 1615, 7, 92, 2, 2, 1613, 1615, 7, 70, 2, 2, 1614, 1609, 3, 2, 2, 2, 1614, 1610, 3, 2, 2, 2, 1614, 1612, 3, 2, 2, 2, 1614, 1613, 3, 2, 2, 2, 1615, 111, 3, 2, 2, 2, 1616, 1618, 9, 10, 2, 2, 1617, 1616, 3, 2, 2, 2, 1617, 1618, 3, 2, 2, 2, 1618, 1619, 3, 2, 2, 2, 1619, 1620, 7, 152, 2, 2, 1620, 113, 3, 2, 2, 2, 1621, 1622, 9, 17, 2, 2, 1622, 115, 3, 2, 2, 2, 1623, 1624, 9, 18, 2, 2, 1624, 117, 3, 2, 2, 2, 1625, 1626, 7, 154, 2, 2, 1626, 119, 3, 2, 2, 2, 1627, 1630, 5, 78, 40, 2, 1628, 1630, 5, 70, 36, 2, 1629, 1627, 3, 2, 2, 2, 1629, 1628, 3, 2, 2, 2, 1630, 121, 3, 2, 2, 2, 1631, 1632, 9, 19, 2, 2, 1632, 123, 3, 2, 2, 2, 1633, 1634, 9, 20, 2, 2, 1634, 125, 3, 2, 2, 2, 1635, 1636, 5, 166, 84, 2, 1636, 127, 3, 2, 2, 2, 1637, 1638, 5, 166, 84, 2, 1638, 129, 3, 2, 2, 2, 1639, 1640, 5, 166, 84, 2, 1640, 131, 3, 2, 2, 2, 1641, 1642, 5, 166, 84, 2, 1642, 133, 3, 2, 2, 2, 1643, 1644, 5, 166, 84, 2, 1644, 135, 3, 2, 2, 2, 1645, 1646, 5, 166, 84, 2, 1646, 137, 3, 2, 2, 2, 1647, 1648, 5, 166, 84, 2, 1648, 139, 3, 2, 2, 2, 1649, 1650, 5, 166, 84, 2, 1650, 141, 3, 2, 2, 2, 1651, 1652, 5, 166, 84, 2, 1652, 143, 3, 2, 2, 2, 1653, 1654, 5, 166, 84, 2, 1654, 145, 3, 2, 2, 2, 1655, 1656, 5, 166, 84, 2, 1656, 147, 3, 2, 2, 2, 1657, 1658, 5, 166, 84, 2, 1658, 149, 3, 2, 2, 2, 1659, 1660, 5, 166, 84, 2, 1660, 151, 3, 2, 2, 2, 1661, 1662, 5, 166, 84, 2, 1662, 153, 3, 2, 2, 2, 1663, 1664, 5, 166, 84, 2, 1664, 155, 3, 2, 2, 2, 1665, 1666, 5, 166, 84, 2, 1666, 157, 3, 2, 2, 2, 1667, 1668, 5, 166, 84, 2, 1668, 159, 3, 2, 2, 2, 1669, 1670, 5, 166, 84, 2, 1670, 161, 3, 2, 2, 2, 1671, 1678, 7, 151, 2, 2, 1672, 1678, 7, 154, 2, 2, 1673, 1674, 7, 5, 2, 2, 1674, 1675, 5, 162, 82, 2, 1675, 1676, 7, 6, 2, 2, 1676, 1678, 3, 2, 2, 2, 1677, 1671, 3, 2, 2, 2, 1677, 1672, 3, 2, 2, 2, 1677, 1673, 3, 2, 2, 2, 1678, 163, 3, 2, 2, 2, 1679, 1680, 5, 166, 84, 2, 1680, 165, 3, 2, 2, 2, 1681, 1689, 7, 151, 2, 2, 1682, 1689, 5, 124, 63, 2, 1683, 1689, 7, 154, 2, 2, 1684, 1685, 7, 5, 2, 2, 1685, 1686, 5, 166, 84, 2, 1686, 1687, 7, 6, 2, 2, 1687, 1689, 3, 2, 2, 2, 1688, 1681, 3, 2, 2, 2, 1688, 1682, 3, 2, 2, 2, 1688, 1683, 3, 2, 2, 2, 1688, 1684, 3, 2, 2, 2, 1689, 167, 3, 2, 2, 2, 239, 171, 179, 186, 191, 197, 203, 205, 237, 244, 252, 260, 263, 272, 276, 284, 288, 290, 295, 297, 300, 305, 309, 314, 323, 326, 332, 334, 338, 344, 349, 360, 366, 370, 376, 381, 390, 397, 403, 407, 411, 417, 422, 429, 440, 443, 445, 451, 457, 461, 468, 474, 480, 486, 491, 503, 508, 519, 524, 527, 534, 537, 544, 553, 556, 562, 564, 568, 576, 581, 589, 594, 602, 607, 615, 620, 625, 633, 643, 646, 652, 654, 657, 676, 682, 691, 696, 705, 716, 723, 729, 735, 744, 751, 755, 757, 761, 768, 770, 774, 777, 783, 793, 796, 802, 804, 807, 815, 825, 828, 834, 836, 840, 847, 856, 860, 862, 866, 875, 880, 882, 891, 902, 909, 912, 915, 928, 942, 947, 950, 963, 977, 982, 991, 994, 1000, 1002, 1008, 1013, 1019, 1031, 1035, 1040, 1044, 1047, 1065, 1070, 1075, 1083, 1088, 1097, 1104, 1108, 1124, 1127, 1135, 1144, 1148, 1153, 1182, 1187, 1196, 1206, 1209, 1215, 1218, 1225, 1231, 1238, 1240, 1242, 1253, 1258, 1270, 1274, 1278, 1282, 1289, 1291, 1299, 1306, 1309, 1313, 1318, 1326, 1345, 1351, 1355, 1362, 1368, 1376, 1381, 1384, 1389, 1398, 1403, 1417, 1420, 1422, 1427, 1431, 1434, 1441, 1446, 1455, 1458, 1462, 1465, 1473, 1477, 1485, 1488, 1490, 1499, 1504, 1508, 1512, 1515, 1526, 1531, 1535, 1542, 1551, 1555, 1557, 1561, 1570, 1575, 1577, 1586, 1597, 1604, 1607, 1614, 1617, 1629, 1677, 1688] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLite.tokens b/internal/engine/sqlite/parser/SQLite.tokens deleted file mode 100644 index c57b62b5ad..0000000000 --- a/internal/engine/sqlite/parser/SQLite.tokens +++ /dev/null @@ -1,181 +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 -K_ABORT=25 -K_ACTION=26 -K_ADD=27 -K_AFTER=28 -K_ALL=29 -K_ALTER=30 -K_ANALYZE=31 -K_AND=32 -K_AS=33 -K_ASC=34 -K_ATTACH=35 -K_AUTOINCREMENT=36 -K_BEFORE=37 -K_BEGIN=38 -K_BETWEEN=39 -K_BY=40 -K_CASCADE=41 -K_CASE=42 -K_CAST=43 -K_CHECK=44 -K_COLLATE=45 -K_COLUMN=46 -K_COMMIT=47 -K_CONFLICT=48 -K_CONSTRAINT=49 -K_CREATE=50 -K_CROSS=51 -K_CURRENT_DATE=52 -K_CURRENT_TIME=53 -K_CURRENT_TIMESTAMP=54 -K_DATABASE=55 -K_DEFAULT=56 -K_DEFERRABLE=57 -K_DEFERRED=58 -K_DELETE=59 -K_DESC=60 -K_DETACH=61 -K_DISTINCT=62 -K_DROP=63 -K_EACH=64 -K_ELSE=65 -K_END=66 -K_ESCAPE=67 -K_EXCEPT=68 -K_EXCLUSIVE=69 -K_EXISTS=70 -K_EXPLAIN=71 -K_FAIL=72 -K_FOR=73 -K_FOREIGN=74 -K_FROM=75 -K_FULL=76 -K_GLOB=77 -K_GROUP=78 -K_HAVING=79 -K_IF=80 -K_IGNORE=81 -K_IMMEDIATE=82 -K_IN=83 -K_INDEX=84 -K_INDEXED=85 -K_INITIALLY=86 -K_INNER=87 -K_INSERT=88 -K_INSTEAD=89 -K_INTERSECT=90 -K_INTO=91 -K_IS=92 -K_ISNULL=93 -K_JOIN=94 -K_KEY=95 -K_LEFT=96 -K_LIKE=97 -K_LIMIT=98 -K_MATCH=99 -K_NATURAL=100 -K_NO=101 -K_NOT=102 -K_NOTNULL=103 -K_NULL=104 -K_OF=105 -K_OFFSET=106 -K_ON=107 -K_OR=108 -K_ORDER=109 -K_OUTER=110 -K_PLAN=111 -K_PRAGMA=112 -K_PRIMARY=113 -K_QUERY=114 -K_RAISE=115 -K_RECURSIVE=116 -K_REFERENCES=117 -K_REGEXP=118 -K_REINDEX=119 -K_RELEASE=120 -K_RENAME=121 -K_REPLACE=122 -K_RESTRICT=123 -K_RIGHT=124 -K_ROLLBACK=125 -K_ROW=126 -K_SAVEPOINT=127 -K_SELECT=128 -K_SET=129 -K_TABLE=130 -K_TEMP=131 -K_TEMPORARY=132 -K_THEN=133 -K_TO=134 -K_TRANSACTION=135 -K_TRIGGER=136 -K_UNION=137 -K_UNIQUE=138 -K_UPDATE=139 -K_USING=140 -K_VACUUM=141 -K_VALUES=142 -K_VIEW=143 -K_VIRTUAL=144 -K_WHEN=145 -K_WHERE=146 -K_WITH=147 -K_WITHOUT=148 -IDENTIFIER=149 -NUMERIC_LITERAL=150 -BIND_PARAMETER=151 -STRING_LITERAL=152 -BLOB_LITERAL=153 -SINGLE_LINE_COMMENT=154 -MULTILINE_COMMENT=155 -SPACES=156 -UNEXPECTED_CHAR=157 -';'=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/SQLiteLexer.g4 b/internal/engine/sqlite/parser/SQLiteLexer.g4 new file mode 100644 index 0000000000..5110ed44c7 --- /dev/null +++ b/internal/engine/sqlite/parser/SQLiteLexer.g4 @@ -0,0 +1,273 @@ +/* + * 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: '+'; +PTR2: '->>'; +PTR: '->'; +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 index 05582eafb5..329996c296 100644 --- a/internal/engine/sqlite/parser/SQLiteLexer.interp +++ b/internal/engine/sqlite/parser/SQLiteLexer.interp @@ -8,6 +8,8 @@ null '=' '*' '+' +'->>' +'->' '-' '~' '||' @@ -157,6 +159,44 @@ null null null null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +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 @@ -168,6 +208,8 @@ COMMA ASSIGN STAR PLUS +PTR2 +PTR MINUS TILDE PIPE2 @@ -184,133 +226,171 @@ GT_EQ EQ NOT_EQ1 NOT_EQ2 -K_ABORT -K_ACTION -K_ADD -K_AFTER -K_ALL -K_ALTER -K_ANALYZE -K_AND -K_AS -K_ASC -K_ATTACH -K_AUTOINCREMENT -K_BEFORE -K_BEGIN -K_BETWEEN -K_BY -K_CASCADE -K_CASE -K_CAST -K_CHECK -K_COLLATE -K_COLUMN -K_COMMIT -K_CONFLICT -K_CONSTRAINT -K_CREATE -K_CROSS -K_CURRENT_DATE -K_CURRENT_TIME -K_CURRENT_TIMESTAMP -K_DATABASE -K_DEFAULT -K_DEFERRABLE -K_DEFERRED -K_DELETE -K_DESC -K_DETACH -K_DISTINCT -K_DROP -K_EACH -K_ELSE -K_END -K_ESCAPE -K_EXCEPT -K_EXCLUSIVE -K_EXISTS -K_EXPLAIN -K_FAIL -K_FOR -K_FOREIGN -K_FROM -K_FULL -K_GLOB -K_GROUP -K_HAVING -K_IF -K_IGNORE -K_IMMEDIATE -K_IN -K_INDEX -K_INDEXED -K_INITIALLY -K_INNER -K_INSERT -K_INSTEAD -K_INTERSECT -K_INTO -K_IS -K_ISNULL -K_JOIN -K_KEY -K_LEFT -K_LIKE -K_LIMIT -K_MATCH -K_NATURAL -K_NO -K_NOT -K_NOTNULL -K_NULL -K_OF -K_OFFSET -K_ON -K_OR -K_ORDER -K_OUTER -K_PLAN -K_PRAGMA -K_PRIMARY -K_QUERY -K_RAISE -K_RECURSIVE -K_REFERENCES -K_REGEXP -K_REINDEX -K_RELEASE -K_RENAME -K_REPLACE -K_RESTRICT -K_RIGHT -K_ROLLBACK -K_ROW -K_SAVEPOINT -K_SELECT -K_SET -K_TABLE -K_TEMP -K_TEMPORARY -K_THEN -K_TO -K_TRANSACTION -K_TRIGGER -K_UNION -K_UNIQUE -K_UPDATE -K_USING -K_VACUUM -K_VALUES -K_VIEW -K_VIRTUAL -K_WHEN -K_WHERE -K_WITH -K_WITHOUT +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 -BIND_PARAMETER +NUMBERED_BIND_PARAMETER +NAMED_BIND_PARAMETER STRING_LITERAL BLOB_LITERAL SINGLE_LINE_COMMENT @@ -327,6 +407,8 @@ COMMA ASSIGN STAR PLUS +PTR2 +PTR MINUS TILDE PIPE2 @@ -343,139 +425,178 @@ GT_EQ EQ NOT_EQ1 NOT_EQ2 -K_ABORT -K_ACTION -K_ADD -K_AFTER -K_ALL -K_ALTER -K_ANALYZE -K_AND -K_AS -K_ASC -K_ATTACH -K_AUTOINCREMENT -K_BEFORE -K_BEGIN -K_BETWEEN -K_BY -K_CASCADE -K_CASE -K_CAST -K_CHECK -K_COLLATE -K_COLUMN -K_COMMIT -K_CONFLICT -K_CONSTRAINT -K_CREATE -K_CROSS -K_CURRENT_DATE -K_CURRENT_TIME -K_CURRENT_TIMESTAMP -K_DATABASE -K_DEFAULT -K_DEFERRABLE -K_DEFERRED -K_DELETE -K_DESC -K_DETACH -K_DISTINCT -K_DROP -K_EACH -K_ELSE -K_END -K_ESCAPE -K_EXCEPT -K_EXCLUSIVE -K_EXISTS -K_EXPLAIN -K_FAIL -K_FOR -K_FOREIGN -K_FROM -K_FULL -K_GLOB -K_GROUP -K_HAVING -K_IF -K_IGNORE -K_IMMEDIATE -K_IN -K_INDEX -K_INDEXED -K_INITIALLY -K_INNER -K_INSERT -K_INSTEAD -K_INTERSECT -K_INTO -K_IS -K_ISNULL -K_JOIN -K_KEY -K_LEFT -K_LIKE -K_LIMIT -K_MATCH -K_NATURAL -K_NO -K_NOT -K_NOTNULL -K_NULL -K_OF -K_OFFSET -K_ON -K_OR -K_ORDER -K_OUTER -K_PLAN -K_PRAGMA -K_PRIMARY -K_QUERY -K_RAISE -K_RECURSIVE -K_REFERENCES -K_REGEXP -K_REINDEX -K_RELEASE -K_RENAME -K_REPLACE -K_RESTRICT -K_RIGHT -K_ROLLBACK -K_ROW -K_SAVEPOINT -K_SELECT -K_SET -K_TABLE -K_TEMP -K_TEMPORARY -K_THEN -K_TO -K_TRANSACTION -K_TRIGGER -K_UNION -K_UNIQUE -K_UPDATE -K_USING -K_VACUUM -K_VALUES -K_VIEW -K_VIRTUAL -K_WHEN -K_WHERE -K_WITH -K_WITHOUT +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 -BIND_PARAMETER +NUMBERED_BIND_PARAMETER +NAMED_BIND_PARAMETER STRING_LITERAL BLOB_LITERAL SINGLE_LINE_COMMENT MULTILINE_COMMENT SPACES UNEXPECTED_CHAR +HEX_DIGIT DIGIT A B @@ -512,4 +633,4 @@ mode names: DEFAULT_MODE atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 159, 1454, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101, 4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106, 9, 106, 4, 107, 9, 107, 4, 108, 9, 108, 4, 109, 9, 109, 4, 110, 9, 110, 4, 111, 9, 111, 4, 112, 9, 112, 4, 113, 9, 113, 4, 114, 9, 114, 4, 115, 9, 115, 4, 116, 9, 116, 4, 117, 9, 117, 4, 118, 9, 118, 4, 119, 9, 119, 4, 120, 9, 120, 4, 121, 9, 121, 4, 122, 9, 122, 4, 123, 9, 123, 4, 124, 9, 124, 4, 125, 9, 125, 4, 126, 9, 126, 4, 127, 9, 127, 4, 128, 9, 128, 4, 129, 9, 129, 4, 130, 9, 130, 4, 131, 9, 131, 4, 132, 9, 132, 4, 133, 9, 133, 4, 134, 9, 134, 4, 135, 9, 135, 4, 136, 9, 136, 4, 137, 9, 137, 4, 138, 9, 138, 4, 139, 9, 139, 4, 140, 9, 140, 4, 141, 9, 141, 4, 142, 9, 142, 4, 143, 9, 143, 4, 144, 9, 144, 4, 145, 9, 145, 4, 146, 9, 146, 4, 147, 9, 147, 4, 148, 9, 148, 4, 149, 9, 149, 4, 150, 9, 150, 4, 151, 9, 151, 4, 152, 9, 152, 4, 153, 9, 153, 4, 154, 9, 154, 4, 155, 9, 155, 4, 156, 9, 156, 4, 157, 9, 157, 4, 158, 9, 158, 4, 159, 9, 159, 4, 160, 9, 160, 4, 161, 9, 161, 4, 162, 9, 162, 4, 163, 9, 163, 4, 164, 9, 164, 4, 165, 9, 165, 4, 166, 9, 166, 4, 167, 9, 167, 4, 168, 9, 168, 4, 169, 9, 169, 4, 170, 9, 170, 4, 171, 9, 171, 4, 172, 9, 172, 4, 173, 9, 173, 4, 174, 9, 174, 4, 175, 9, 175, 4, 176, 9, 176, 4, 177, 9, 177, 4, 178, 9, 178, 4, 179, 9, 179, 4, 180, 9, 180, 4, 181, 9, 181, 4, 182, 9, 182, 4, 183, 9, 183, 4, 184, 9, 184, 4, 185, 9, 185, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 74, 3, 74, 3, 74, 3, 74, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 81, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 93, 3, 93, 3, 93, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 95, 3, 95, 3, 95, 3, 95, 3, 95, 3, 96, 3, 96, 3, 96, 3, 96, 3, 97, 3, 97, 3, 97, 3, 97, 3, 97, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 102, 3, 102, 3, 102, 3, 103, 3, 103, 3, 103, 3, 103, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 106, 3, 106, 3, 106, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 108, 3, 108, 3, 108, 3, 109, 3, 109, 3, 109, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 127, 3, 127, 3, 127, 3, 127, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 130, 3, 130, 3, 130, 3, 130, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 3, 135, 3, 135, 3, 135, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 150, 3, 150, 3, 150, 3, 150, 7, 150, 1266, 10, 150, 12, 150, 14, 150, 1269, 11, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 7, 150, 1276, 10, 150, 12, 150, 14, 150, 1279, 11, 150, 3, 150, 3, 150, 3, 150, 7, 150, 1284, 10, 150, 12, 150, 14, 150, 1287, 11, 150, 3, 150, 3, 150, 3, 150, 7, 150, 1292, 10, 150, 12, 150, 14, 150, 1295, 11, 150, 5, 150, 1297, 10, 150, 3, 151, 6, 151, 1300, 10, 151, 13, 151, 14, 151, 1301, 3, 151, 3, 151, 7, 151, 1306, 10, 151, 12, 151, 14, 151, 1309, 11, 151, 5, 151, 1311, 10, 151, 3, 151, 3, 151, 5, 151, 1315, 10, 151, 3, 151, 6, 151, 1318, 10, 151, 13, 151, 14, 151, 1319, 5, 151, 1322, 10, 151, 3, 151, 3, 151, 6, 151, 1326, 10, 151, 13, 151, 14, 151, 1327, 3, 151, 3, 151, 5, 151, 1332, 10, 151, 3, 151, 6, 151, 1335, 10, 151, 13, 151, 14, 151, 1336, 5, 151, 1339, 10, 151, 5, 151, 1341, 10, 151, 3, 152, 3, 152, 7, 152, 1345, 10, 152, 12, 152, 14, 152, 1348, 11, 152, 3, 152, 3, 152, 5, 152, 1352, 10, 152, 3, 153, 3, 153, 3, 153, 3, 153, 7, 153, 1358, 10, 153, 12, 153, 14, 153, 1361, 11, 153, 3, 153, 3, 153, 3, 154, 3, 154, 3, 154, 3, 155, 3, 155, 3, 155, 3, 155, 7, 155, 1372, 10, 155, 12, 155, 14, 155, 1375, 11, 155, 3, 155, 3, 155, 3, 156, 3, 156, 3, 156, 3, 156, 7, 156, 1383, 10, 156, 12, 156, 14, 156, 1386, 11, 156, 3, 156, 3, 156, 3, 156, 5, 156, 1391, 10, 156, 3, 156, 3, 156, 3, 157, 3, 157, 3, 157, 3, 157, 3, 158, 3, 158, 3, 159, 3, 159, 3, 160, 3, 160, 3, 161, 3, 161, 3, 162, 3, 162, 3, 163, 3, 163, 3, 164, 3, 164, 3, 165, 3, 165, 3, 166, 3, 166, 3, 167, 3, 167, 3, 168, 3, 168, 3, 169, 3, 169, 3, 170, 3, 170, 3, 171, 3, 171, 3, 172, 3, 172, 3, 173, 3, 173, 3, 174, 3, 174, 3, 175, 3, 175, 3, 176, 3, 176, 3, 177, 3, 177, 3, 178, 3, 178, 3, 179, 3, 179, 3, 180, 3, 180, 3, 181, 3, 181, 3, 182, 3, 182, 3, 183, 3, 183, 3, 184, 3, 184, 3, 185, 3, 185, 3, 1384, 2, 186, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145, 74, 147, 75, 149, 76, 151, 77, 153, 78, 155, 79, 157, 80, 159, 81, 161, 82, 163, 83, 165, 84, 167, 85, 169, 86, 171, 87, 173, 88, 175, 89, 177, 90, 179, 91, 181, 92, 183, 93, 185, 94, 187, 95, 189, 96, 191, 97, 193, 98, 195, 99, 197, 100, 199, 101, 201, 102, 203, 103, 205, 104, 207, 105, 209, 106, 211, 107, 213, 108, 215, 109, 217, 110, 219, 111, 221, 112, 223, 113, 225, 114, 227, 115, 229, 116, 231, 117, 233, 118, 235, 119, 237, 120, 239, 121, 241, 122, 243, 123, 245, 124, 247, 125, 249, 126, 251, 127, 253, 128, 255, 129, 257, 130, 259, 131, 261, 132, 263, 133, 265, 134, 267, 135, 269, 136, 271, 137, 273, 138, 275, 139, 277, 140, 279, 141, 281, 142, 283, 143, 285, 144, 287, 145, 289, 146, 291, 147, 293, 148, 295, 149, 297, 150, 299, 151, 301, 152, 303, 153, 305, 154, 307, 155, 309, 156, 311, 157, 313, 158, 315, 159, 317, 2, 319, 2, 321, 2, 323, 2, 325, 2, 327, 2, 329, 2, 331, 2, 333, 2, 335, 2, 337, 2, 339, 2, 341, 2, 343, 2, 345, 2, 347, 2, 349, 2, 351, 2, 353, 2, 355, 2, 357, 2, 359, 2, 361, 2, 363, 2, 365, 2, 367, 2, 369, 2, 3, 2, 39, 3, 2, 36, 36, 3, 2, 98, 98, 3, 2, 95, 95, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 4, 2, 45, 45, 47, 47, 5, 2, 38, 38, 60, 60, 66, 66, 3, 2, 41, 41, 4, 2, 12, 12, 15, 15, 5, 2, 11, 13, 15, 15, 34, 34, 3, 2, 50, 59, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, 100, 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, 103, 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, 106, 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, 109, 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, 112, 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, 115, 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, 118, 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, 121, 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, 124, 124, 2, 1453, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, 151, 3, 2, 2, 2, 2, 153, 3, 2, 2, 2, 2, 155, 3, 2, 2, 2, 2, 157, 3, 2, 2, 2, 2, 159, 3, 2, 2, 2, 2, 161, 3, 2, 2, 2, 2, 163, 3, 2, 2, 2, 2, 165, 3, 2, 2, 2, 2, 167, 3, 2, 2, 2, 2, 169, 3, 2, 2, 2, 2, 171, 3, 2, 2, 2, 2, 173, 3, 2, 2, 2, 2, 175, 3, 2, 2, 2, 2, 177, 3, 2, 2, 2, 2, 179, 3, 2, 2, 2, 2, 181, 3, 2, 2, 2, 2, 183, 3, 2, 2, 2, 2, 185, 3, 2, 2, 2, 2, 187, 3, 2, 2, 2, 2, 189, 3, 2, 2, 2, 2, 191, 3, 2, 2, 2, 2, 193, 3, 2, 2, 2, 2, 195, 3, 2, 2, 2, 2, 197, 3, 2, 2, 2, 2, 199, 3, 2, 2, 2, 2, 201, 3, 2, 2, 2, 2, 203, 3, 2, 2, 2, 2, 205, 3, 2, 2, 2, 2, 207, 3, 2, 2, 2, 2, 209, 3, 2, 2, 2, 2, 211, 3, 2, 2, 2, 2, 213, 3, 2, 2, 2, 2, 215, 3, 2, 2, 2, 2, 217, 3, 2, 2, 2, 2, 219, 3, 2, 2, 2, 2, 221, 3, 2, 2, 2, 2, 223, 3, 2, 2, 2, 2, 225, 3, 2, 2, 2, 2, 227, 3, 2, 2, 2, 2, 229, 3, 2, 2, 2, 2, 231, 3, 2, 2, 2, 2, 233, 3, 2, 2, 2, 2, 235, 3, 2, 2, 2, 2, 237, 3, 2, 2, 2, 2, 239, 3, 2, 2, 2, 2, 241, 3, 2, 2, 2, 2, 243, 3, 2, 2, 2, 2, 245, 3, 2, 2, 2, 2, 247, 3, 2, 2, 2, 2, 249, 3, 2, 2, 2, 2, 251, 3, 2, 2, 2, 2, 253, 3, 2, 2, 2, 2, 255, 3, 2, 2, 2, 2, 257, 3, 2, 2, 2, 2, 259, 3, 2, 2, 2, 2, 261, 3, 2, 2, 2, 2, 263, 3, 2, 2, 2, 2, 265, 3, 2, 2, 2, 2, 267, 3, 2, 2, 2, 2, 269, 3, 2, 2, 2, 2, 271, 3, 2, 2, 2, 2, 273, 3, 2, 2, 2, 2, 275, 3, 2, 2, 2, 2, 277, 3, 2, 2, 2, 2, 279, 3, 2, 2, 2, 2, 281, 3, 2, 2, 2, 2, 283, 3, 2, 2, 2, 2, 285, 3, 2, 2, 2, 2, 287, 3, 2, 2, 2, 2, 289, 3, 2, 2, 2, 2, 291, 3, 2, 2, 2, 2, 293, 3, 2, 2, 2, 2, 295, 3, 2, 2, 2, 2, 297, 3, 2, 2, 2, 2, 299, 3, 2, 2, 2, 2, 301, 3, 2, 2, 2, 2, 303, 3, 2, 2, 2, 2, 305, 3, 2, 2, 2, 2, 307, 3, 2, 2, 2, 2, 309, 3, 2, 2, 2, 2, 311, 3, 2, 2, 2, 2, 313, 3, 2, 2, 2, 2, 315, 3, 2, 2, 2, 3, 371, 3, 2, 2, 2, 5, 373, 3, 2, 2, 2, 7, 375, 3, 2, 2, 2, 9, 377, 3, 2, 2, 2, 11, 379, 3, 2, 2, 2, 13, 381, 3, 2, 2, 2, 15, 383, 3, 2, 2, 2, 17, 385, 3, 2, 2, 2, 19, 387, 3, 2, 2, 2, 21, 389, 3, 2, 2, 2, 23, 391, 3, 2, 2, 2, 25, 394, 3, 2, 2, 2, 27, 396, 3, 2, 2, 2, 29, 398, 3, 2, 2, 2, 31, 401, 3, 2, 2, 2, 33, 404, 3, 2, 2, 2, 35, 406, 3, 2, 2, 2, 37, 408, 3, 2, 2, 2, 39, 410, 3, 2, 2, 2, 41, 413, 3, 2, 2, 2, 43, 415, 3, 2, 2, 2, 45, 418, 3, 2, 2, 2, 47, 421, 3, 2, 2, 2, 49, 424, 3, 2, 2, 2, 51, 427, 3, 2, 2, 2, 53, 433, 3, 2, 2, 2, 55, 440, 3, 2, 2, 2, 57, 444, 3, 2, 2, 2, 59, 450, 3, 2, 2, 2, 61, 454, 3, 2, 2, 2, 63, 460, 3, 2, 2, 2, 65, 468, 3, 2, 2, 2, 67, 472, 3, 2, 2, 2, 69, 475, 3, 2, 2, 2, 71, 479, 3, 2, 2, 2, 73, 486, 3, 2, 2, 2, 75, 500, 3, 2, 2, 2, 77, 507, 3, 2, 2, 2, 79, 513, 3, 2, 2, 2, 81, 521, 3, 2, 2, 2, 83, 524, 3, 2, 2, 2, 85, 532, 3, 2, 2, 2, 87, 537, 3, 2, 2, 2, 89, 542, 3, 2, 2, 2, 91, 548, 3, 2, 2, 2, 93, 556, 3, 2, 2, 2, 95, 563, 3, 2, 2, 2, 97, 570, 3, 2, 2, 2, 99, 579, 3, 2, 2, 2, 101, 590, 3, 2, 2, 2, 103, 597, 3, 2, 2, 2, 105, 603, 3, 2, 2, 2, 107, 616, 3, 2, 2, 2, 109, 629, 3, 2, 2, 2, 111, 647, 3, 2, 2, 2, 113, 656, 3, 2, 2, 2, 115, 664, 3, 2, 2, 2, 117, 675, 3, 2, 2, 2, 119, 684, 3, 2, 2, 2, 121, 691, 3, 2, 2, 2, 123, 696, 3, 2, 2, 2, 125, 703, 3, 2, 2, 2, 127, 712, 3, 2, 2, 2, 129, 717, 3, 2, 2, 2, 131, 722, 3, 2, 2, 2, 133, 727, 3, 2, 2, 2, 135, 731, 3, 2, 2, 2, 137, 738, 3, 2, 2, 2, 139, 745, 3, 2, 2, 2, 141, 755, 3, 2, 2, 2, 143, 762, 3, 2, 2, 2, 145, 770, 3, 2, 2, 2, 147, 775, 3, 2, 2, 2, 149, 779, 3, 2, 2, 2, 151, 787, 3, 2, 2, 2, 153, 792, 3, 2, 2, 2, 155, 797, 3, 2, 2, 2, 157, 802, 3, 2, 2, 2, 159, 808, 3, 2, 2, 2, 161, 815, 3, 2, 2, 2, 163, 818, 3, 2, 2, 2, 165, 825, 3, 2, 2, 2, 167, 835, 3, 2, 2, 2, 169, 838, 3, 2, 2, 2, 171, 844, 3, 2, 2, 2, 173, 852, 3, 2, 2, 2, 175, 862, 3, 2, 2, 2, 177, 868, 3, 2, 2, 2, 179, 875, 3, 2, 2, 2, 181, 883, 3, 2, 2, 2, 183, 893, 3, 2, 2, 2, 185, 898, 3, 2, 2, 2, 187, 901, 3, 2, 2, 2, 189, 908, 3, 2, 2, 2, 191, 913, 3, 2, 2, 2, 193, 917, 3, 2, 2, 2, 195, 922, 3, 2, 2, 2, 197, 927, 3, 2, 2, 2, 199, 933, 3, 2, 2, 2, 201, 939, 3, 2, 2, 2, 203, 947, 3, 2, 2, 2, 205, 950, 3, 2, 2, 2, 207, 954, 3, 2, 2, 2, 209, 962, 3, 2, 2, 2, 211, 967, 3, 2, 2, 2, 213, 970, 3, 2, 2, 2, 215, 977, 3, 2, 2, 2, 217, 980, 3, 2, 2, 2, 219, 983, 3, 2, 2, 2, 221, 989, 3, 2, 2, 2, 223, 995, 3, 2, 2, 2, 225, 1000, 3, 2, 2, 2, 227, 1007, 3, 2, 2, 2, 229, 1015, 3, 2, 2, 2, 231, 1021, 3, 2, 2, 2, 233, 1027, 3, 2, 2, 2, 235, 1037, 3, 2, 2, 2, 237, 1048, 3, 2, 2, 2, 239, 1055, 3, 2, 2, 2, 241, 1063, 3, 2, 2, 2, 243, 1071, 3, 2, 2, 2, 245, 1078, 3, 2, 2, 2, 247, 1086, 3, 2, 2, 2, 249, 1095, 3, 2, 2, 2, 251, 1101, 3, 2, 2, 2, 253, 1110, 3, 2, 2, 2, 255, 1114, 3, 2, 2, 2, 257, 1124, 3, 2, 2, 2, 259, 1131, 3, 2, 2, 2, 261, 1135, 3, 2, 2, 2, 263, 1141, 3, 2, 2, 2, 265, 1146, 3, 2, 2, 2, 267, 1156, 3, 2, 2, 2, 269, 1161, 3, 2, 2, 2, 271, 1164, 3, 2, 2, 2, 273, 1176, 3, 2, 2, 2, 275, 1184, 3, 2, 2, 2, 277, 1190, 3, 2, 2, 2, 279, 1197, 3, 2, 2, 2, 281, 1204, 3, 2, 2, 2, 283, 1210, 3, 2, 2, 2, 285, 1217, 3, 2, 2, 2, 287, 1224, 3, 2, 2, 2, 289, 1229, 3, 2, 2, 2, 291, 1237, 3, 2, 2, 2, 293, 1242, 3, 2, 2, 2, 295, 1248, 3, 2, 2, 2, 297, 1253, 3, 2, 2, 2, 299, 1296, 3, 2, 2, 2, 301, 1340, 3, 2, 2, 2, 303, 1351, 3, 2, 2, 2, 305, 1353, 3, 2, 2, 2, 307, 1364, 3, 2, 2, 2, 309, 1367, 3, 2, 2, 2, 311, 1378, 3, 2, 2, 2, 313, 1394, 3, 2, 2, 2, 315, 1398, 3, 2, 2, 2, 317, 1400, 3, 2, 2, 2, 319, 1402, 3, 2, 2, 2, 321, 1404, 3, 2, 2, 2, 323, 1406, 3, 2, 2, 2, 325, 1408, 3, 2, 2, 2, 327, 1410, 3, 2, 2, 2, 329, 1412, 3, 2, 2, 2, 331, 1414, 3, 2, 2, 2, 333, 1416, 3, 2, 2, 2, 335, 1418, 3, 2, 2, 2, 337, 1420, 3, 2, 2, 2, 339, 1422, 3, 2, 2, 2, 341, 1424, 3, 2, 2, 2, 343, 1426, 3, 2, 2, 2, 345, 1428, 3, 2, 2, 2, 347, 1430, 3, 2, 2, 2, 349, 1432, 3, 2, 2, 2, 351, 1434, 3, 2, 2, 2, 353, 1436, 3, 2, 2, 2, 355, 1438, 3, 2, 2, 2, 357, 1440, 3, 2, 2, 2, 359, 1442, 3, 2, 2, 2, 361, 1444, 3, 2, 2, 2, 363, 1446, 3, 2, 2, 2, 365, 1448, 3, 2, 2, 2, 367, 1450, 3, 2, 2, 2, 369, 1452, 3, 2, 2, 2, 371, 372, 7, 61, 2, 2, 372, 4, 3, 2, 2, 2, 373, 374, 7, 48, 2, 2, 374, 6, 3, 2, 2, 2, 375, 376, 7, 42, 2, 2, 376, 8, 3, 2, 2, 2, 377, 378, 7, 43, 2, 2, 378, 10, 3, 2, 2, 2, 379, 380, 7, 46, 2, 2, 380, 12, 3, 2, 2, 2, 381, 382, 7, 63, 2, 2, 382, 14, 3, 2, 2, 2, 383, 384, 7, 44, 2, 2, 384, 16, 3, 2, 2, 2, 385, 386, 7, 45, 2, 2, 386, 18, 3, 2, 2, 2, 387, 388, 7, 47, 2, 2, 388, 20, 3, 2, 2, 2, 389, 390, 7, 128, 2, 2, 390, 22, 3, 2, 2, 2, 391, 392, 7, 126, 2, 2, 392, 393, 7, 126, 2, 2, 393, 24, 3, 2, 2, 2, 394, 395, 7, 49, 2, 2, 395, 26, 3, 2, 2, 2, 396, 397, 7, 39, 2, 2, 397, 28, 3, 2, 2, 2, 398, 399, 7, 62, 2, 2, 399, 400, 7, 62, 2, 2, 400, 30, 3, 2, 2, 2, 401, 402, 7, 64, 2, 2, 402, 403, 7, 64, 2, 2, 403, 32, 3, 2, 2, 2, 404, 405, 7, 40, 2, 2, 405, 34, 3, 2, 2, 2, 406, 407, 7, 126, 2, 2, 407, 36, 3, 2, 2, 2, 408, 409, 7, 62, 2, 2, 409, 38, 3, 2, 2, 2, 410, 411, 7, 62, 2, 2, 411, 412, 7, 63, 2, 2, 412, 40, 3, 2, 2, 2, 413, 414, 7, 64, 2, 2, 414, 42, 3, 2, 2, 2, 415, 416, 7, 64, 2, 2, 416, 417, 7, 63, 2, 2, 417, 44, 3, 2, 2, 2, 418, 419, 7, 63, 2, 2, 419, 420, 7, 63, 2, 2, 420, 46, 3, 2, 2, 2, 421, 422, 7, 35, 2, 2, 422, 423, 7, 63, 2, 2, 423, 48, 3, 2, 2, 2, 424, 425, 7, 62, 2, 2, 425, 426, 7, 64, 2, 2, 426, 50, 3, 2, 2, 2, 427, 428, 5, 319, 160, 2, 428, 429, 5, 321, 161, 2, 429, 430, 5, 347, 174, 2, 430, 431, 5, 353, 177, 2, 431, 432, 5, 357, 179, 2, 432, 52, 3, 2, 2, 2, 433, 434, 5, 319, 160, 2, 434, 435, 5, 323, 162, 2, 435, 436, 5, 357, 179, 2, 436, 437, 5, 335, 168, 2, 437, 438, 5, 347, 174, 2, 438, 439, 5, 345, 173, 2, 439, 54, 3, 2, 2, 2, 440, 441, 5, 319, 160, 2, 441, 442, 5, 325, 163, 2, 442, 443, 5, 325, 163, 2, 443, 56, 3, 2, 2, 2, 444, 445, 5, 319, 160, 2, 445, 446, 5, 329, 165, 2, 446, 447, 5, 357, 179, 2, 447, 448, 5, 327, 164, 2, 448, 449, 5, 353, 177, 2, 449, 58, 3, 2, 2, 2, 450, 451, 5, 319, 160, 2, 451, 452, 5, 341, 171, 2, 452, 453, 5, 341, 171, 2, 453, 60, 3, 2, 2, 2, 454, 455, 5, 319, 160, 2, 455, 456, 5, 341, 171, 2, 456, 457, 5, 357, 179, 2, 457, 458, 5, 327, 164, 2, 458, 459, 5, 353, 177, 2, 459, 62, 3, 2, 2, 2, 460, 461, 5, 319, 160, 2, 461, 462, 5, 345, 173, 2, 462, 463, 5, 319, 160, 2, 463, 464, 5, 341, 171, 2, 464, 465, 5, 367, 184, 2, 465, 466, 5, 369, 185, 2, 466, 467, 5, 327, 164, 2, 467, 64, 3, 2, 2, 2, 468, 469, 5, 319, 160, 2, 469, 470, 5, 345, 173, 2, 470, 471, 5, 325, 163, 2, 471, 66, 3, 2, 2, 2, 472, 473, 5, 319, 160, 2, 473, 474, 5, 355, 178, 2, 474, 68, 3, 2, 2, 2, 475, 476, 5, 319, 160, 2, 476, 477, 5, 355, 178, 2, 477, 478, 5, 323, 162, 2, 478, 70, 3, 2, 2, 2, 479, 480, 5, 319, 160, 2, 480, 481, 5, 357, 179, 2, 481, 482, 5, 357, 179, 2, 482, 483, 5, 319, 160, 2, 483, 484, 5, 323, 162, 2, 484, 485, 5, 333, 167, 2, 485, 72, 3, 2, 2, 2, 486, 487, 5, 319, 160, 2, 487, 488, 5, 359, 180, 2, 488, 489, 5, 357, 179, 2, 489, 490, 5, 347, 174, 2, 490, 491, 5, 335, 168, 2, 491, 492, 5, 345, 173, 2, 492, 493, 5, 323, 162, 2, 493, 494, 5, 353, 177, 2, 494, 495, 5, 327, 164, 2, 495, 496, 5, 343, 172, 2, 496, 497, 5, 327, 164, 2, 497, 498, 5, 345, 173, 2, 498, 499, 5, 357, 179, 2, 499, 74, 3, 2, 2, 2, 500, 501, 5, 321, 161, 2, 501, 502, 5, 327, 164, 2, 502, 503, 5, 329, 165, 2, 503, 504, 5, 347, 174, 2, 504, 505, 5, 353, 177, 2, 505, 506, 5, 327, 164, 2, 506, 76, 3, 2, 2, 2, 507, 508, 5, 321, 161, 2, 508, 509, 5, 327, 164, 2, 509, 510, 5, 331, 166, 2, 510, 511, 5, 335, 168, 2, 511, 512, 5, 345, 173, 2, 512, 78, 3, 2, 2, 2, 513, 514, 5, 321, 161, 2, 514, 515, 5, 327, 164, 2, 515, 516, 5, 357, 179, 2, 516, 517, 5, 363, 182, 2, 517, 518, 5, 327, 164, 2, 518, 519, 5, 327, 164, 2, 519, 520, 5, 345, 173, 2, 520, 80, 3, 2, 2, 2, 521, 522, 5, 321, 161, 2, 522, 523, 5, 367, 184, 2, 523, 82, 3, 2, 2, 2, 524, 525, 5, 323, 162, 2, 525, 526, 5, 319, 160, 2, 526, 527, 5, 355, 178, 2, 527, 528, 5, 323, 162, 2, 528, 529, 5, 319, 160, 2, 529, 530, 5, 325, 163, 2, 530, 531, 5, 327, 164, 2, 531, 84, 3, 2, 2, 2, 532, 533, 5, 323, 162, 2, 533, 534, 5, 319, 160, 2, 534, 535, 5, 355, 178, 2, 535, 536, 5, 327, 164, 2, 536, 86, 3, 2, 2, 2, 537, 538, 5, 323, 162, 2, 538, 539, 5, 319, 160, 2, 539, 540, 5, 355, 178, 2, 540, 541, 5, 357, 179, 2, 541, 88, 3, 2, 2, 2, 542, 543, 5, 323, 162, 2, 543, 544, 5, 333, 167, 2, 544, 545, 5, 327, 164, 2, 545, 546, 5, 323, 162, 2, 546, 547, 5, 339, 170, 2, 547, 90, 3, 2, 2, 2, 548, 549, 5, 323, 162, 2, 549, 550, 5, 347, 174, 2, 550, 551, 5, 341, 171, 2, 551, 552, 5, 341, 171, 2, 552, 553, 5, 319, 160, 2, 553, 554, 5, 357, 179, 2, 554, 555, 5, 327, 164, 2, 555, 92, 3, 2, 2, 2, 556, 557, 5, 323, 162, 2, 557, 558, 5, 347, 174, 2, 558, 559, 5, 341, 171, 2, 559, 560, 5, 359, 180, 2, 560, 561, 5, 343, 172, 2, 561, 562, 5, 345, 173, 2, 562, 94, 3, 2, 2, 2, 563, 564, 5, 323, 162, 2, 564, 565, 5, 347, 174, 2, 565, 566, 5, 343, 172, 2, 566, 567, 5, 343, 172, 2, 567, 568, 5, 335, 168, 2, 568, 569, 5, 357, 179, 2, 569, 96, 3, 2, 2, 2, 570, 571, 5, 323, 162, 2, 571, 572, 5, 347, 174, 2, 572, 573, 5, 345, 173, 2, 573, 574, 5, 329, 165, 2, 574, 575, 5, 341, 171, 2, 575, 576, 5, 335, 168, 2, 576, 577, 5, 323, 162, 2, 577, 578, 5, 357, 179, 2, 578, 98, 3, 2, 2, 2, 579, 580, 5, 323, 162, 2, 580, 581, 5, 347, 174, 2, 581, 582, 5, 345, 173, 2, 582, 583, 5, 355, 178, 2, 583, 584, 5, 357, 179, 2, 584, 585, 5, 353, 177, 2, 585, 586, 5, 319, 160, 2, 586, 587, 5, 335, 168, 2, 587, 588, 5, 345, 173, 2, 588, 589, 5, 357, 179, 2, 589, 100, 3, 2, 2, 2, 590, 591, 5, 323, 162, 2, 591, 592, 5, 353, 177, 2, 592, 593, 5, 327, 164, 2, 593, 594, 5, 319, 160, 2, 594, 595, 5, 357, 179, 2, 595, 596, 5, 327, 164, 2, 596, 102, 3, 2, 2, 2, 597, 598, 5, 323, 162, 2, 598, 599, 5, 353, 177, 2, 599, 600, 5, 347, 174, 2, 600, 601, 5, 355, 178, 2, 601, 602, 5, 355, 178, 2, 602, 104, 3, 2, 2, 2, 603, 604, 5, 323, 162, 2, 604, 605, 5, 359, 180, 2, 605, 606, 5, 353, 177, 2, 606, 607, 5, 353, 177, 2, 607, 608, 5, 327, 164, 2, 608, 609, 5, 345, 173, 2, 609, 610, 5, 357, 179, 2, 610, 611, 7, 97, 2, 2, 611, 612, 5, 325, 163, 2, 612, 613, 5, 319, 160, 2, 613, 614, 5, 357, 179, 2, 614, 615, 5, 327, 164, 2, 615, 106, 3, 2, 2, 2, 616, 617, 5, 323, 162, 2, 617, 618, 5, 359, 180, 2, 618, 619, 5, 353, 177, 2, 619, 620, 5, 353, 177, 2, 620, 621, 5, 327, 164, 2, 621, 622, 5, 345, 173, 2, 622, 623, 5, 357, 179, 2, 623, 624, 7, 97, 2, 2, 624, 625, 5, 357, 179, 2, 625, 626, 5, 335, 168, 2, 626, 627, 5, 343, 172, 2, 627, 628, 5, 327, 164, 2, 628, 108, 3, 2, 2, 2, 629, 630, 5, 323, 162, 2, 630, 631, 5, 359, 180, 2, 631, 632, 5, 353, 177, 2, 632, 633, 5, 353, 177, 2, 633, 634, 5, 327, 164, 2, 634, 635, 5, 345, 173, 2, 635, 636, 5, 357, 179, 2, 636, 637, 7, 97, 2, 2, 637, 638, 5, 357, 179, 2, 638, 639, 5, 335, 168, 2, 639, 640, 5, 343, 172, 2, 640, 641, 5, 327, 164, 2, 641, 642, 5, 355, 178, 2, 642, 643, 5, 357, 179, 2, 643, 644, 5, 319, 160, 2, 644, 645, 5, 343, 172, 2, 645, 646, 5, 349, 175, 2, 646, 110, 3, 2, 2, 2, 647, 648, 5, 325, 163, 2, 648, 649, 5, 319, 160, 2, 649, 650, 5, 357, 179, 2, 650, 651, 5, 319, 160, 2, 651, 652, 5, 321, 161, 2, 652, 653, 5, 319, 160, 2, 653, 654, 5, 355, 178, 2, 654, 655, 5, 327, 164, 2, 655, 112, 3, 2, 2, 2, 656, 657, 5, 325, 163, 2, 657, 658, 5, 327, 164, 2, 658, 659, 5, 329, 165, 2, 659, 660, 5, 319, 160, 2, 660, 661, 5, 359, 180, 2, 661, 662, 5, 341, 171, 2, 662, 663, 5, 357, 179, 2, 663, 114, 3, 2, 2, 2, 664, 665, 5, 325, 163, 2, 665, 666, 5, 327, 164, 2, 666, 667, 5, 329, 165, 2, 667, 668, 5, 327, 164, 2, 668, 669, 5, 353, 177, 2, 669, 670, 5, 353, 177, 2, 670, 671, 5, 319, 160, 2, 671, 672, 5, 321, 161, 2, 672, 673, 5, 341, 171, 2, 673, 674, 5, 327, 164, 2, 674, 116, 3, 2, 2, 2, 675, 676, 5, 325, 163, 2, 676, 677, 5, 327, 164, 2, 677, 678, 5, 329, 165, 2, 678, 679, 5, 327, 164, 2, 679, 680, 5, 353, 177, 2, 680, 681, 5, 353, 177, 2, 681, 682, 5, 327, 164, 2, 682, 683, 5, 325, 163, 2, 683, 118, 3, 2, 2, 2, 684, 685, 5, 325, 163, 2, 685, 686, 5, 327, 164, 2, 686, 687, 5, 341, 171, 2, 687, 688, 5, 327, 164, 2, 688, 689, 5, 357, 179, 2, 689, 690, 5, 327, 164, 2, 690, 120, 3, 2, 2, 2, 691, 692, 5, 325, 163, 2, 692, 693, 5, 327, 164, 2, 693, 694, 5, 355, 178, 2, 694, 695, 5, 323, 162, 2, 695, 122, 3, 2, 2, 2, 696, 697, 5, 325, 163, 2, 697, 698, 5, 327, 164, 2, 698, 699, 5, 357, 179, 2, 699, 700, 5, 319, 160, 2, 700, 701, 5, 323, 162, 2, 701, 702, 5, 333, 167, 2, 702, 124, 3, 2, 2, 2, 703, 704, 5, 325, 163, 2, 704, 705, 5, 335, 168, 2, 705, 706, 5, 355, 178, 2, 706, 707, 5, 357, 179, 2, 707, 708, 5, 335, 168, 2, 708, 709, 5, 345, 173, 2, 709, 710, 5, 323, 162, 2, 710, 711, 5, 357, 179, 2, 711, 126, 3, 2, 2, 2, 712, 713, 5, 325, 163, 2, 713, 714, 5, 353, 177, 2, 714, 715, 5, 347, 174, 2, 715, 716, 5, 349, 175, 2, 716, 128, 3, 2, 2, 2, 717, 718, 5, 327, 164, 2, 718, 719, 5, 319, 160, 2, 719, 720, 5, 323, 162, 2, 720, 721, 5, 333, 167, 2, 721, 130, 3, 2, 2, 2, 722, 723, 5, 327, 164, 2, 723, 724, 5, 341, 171, 2, 724, 725, 5, 355, 178, 2, 725, 726, 5, 327, 164, 2, 726, 132, 3, 2, 2, 2, 727, 728, 5, 327, 164, 2, 728, 729, 5, 345, 173, 2, 729, 730, 5, 325, 163, 2, 730, 134, 3, 2, 2, 2, 731, 732, 5, 327, 164, 2, 732, 733, 5, 355, 178, 2, 733, 734, 5, 323, 162, 2, 734, 735, 5, 319, 160, 2, 735, 736, 5, 349, 175, 2, 736, 737, 5, 327, 164, 2, 737, 136, 3, 2, 2, 2, 738, 739, 5, 327, 164, 2, 739, 740, 5, 365, 183, 2, 740, 741, 5, 323, 162, 2, 741, 742, 5, 327, 164, 2, 742, 743, 5, 349, 175, 2, 743, 744, 5, 357, 179, 2, 744, 138, 3, 2, 2, 2, 745, 746, 5, 327, 164, 2, 746, 747, 5, 365, 183, 2, 747, 748, 5, 323, 162, 2, 748, 749, 5, 341, 171, 2, 749, 750, 5, 359, 180, 2, 750, 751, 5, 355, 178, 2, 751, 752, 5, 335, 168, 2, 752, 753, 5, 361, 181, 2, 753, 754, 5, 327, 164, 2, 754, 140, 3, 2, 2, 2, 755, 756, 5, 327, 164, 2, 756, 757, 5, 365, 183, 2, 757, 758, 5, 335, 168, 2, 758, 759, 5, 355, 178, 2, 759, 760, 5, 357, 179, 2, 760, 761, 5, 355, 178, 2, 761, 142, 3, 2, 2, 2, 762, 763, 5, 327, 164, 2, 763, 764, 5, 365, 183, 2, 764, 765, 5, 349, 175, 2, 765, 766, 5, 341, 171, 2, 766, 767, 5, 319, 160, 2, 767, 768, 5, 335, 168, 2, 768, 769, 5, 345, 173, 2, 769, 144, 3, 2, 2, 2, 770, 771, 5, 329, 165, 2, 771, 772, 5, 319, 160, 2, 772, 773, 5, 335, 168, 2, 773, 774, 5, 341, 171, 2, 774, 146, 3, 2, 2, 2, 775, 776, 5, 329, 165, 2, 776, 777, 5, 347, 174, 2, 777, 778, 5, 353, 177, 2, 778, 148, 3, 2, 2, 2, 779, 780, 5, 329, 165, 2, 780, 781, 5, 347, 174, 2, 781, 782, 5, 353, 177, 2, 782, 783, 5, 327, 164, 2, 783, 784, 5, 335, 168, 2, 784, 785, 5, 331, 166, 2, 785, 786, 5, 345, 173, 2, 786, 150, 3, 2, 2, 2, 787, 788, 5, 329, 165, 2, 788, 789, 5, 353, 177, 2, 789, 790, 5, 347, 174, 2, 790, 791, 5, 343, 172, 2, 791, 152, 3, 2, 2, 2, 792, 793, 5, 329, 165, 2, 793, 794, 5, 359, 180, 2, 794, 795, 5, 341, 171, 2, 795, 796, 5, 341, 171, 2, 796, 154, 3, 2, 2, 2, 797, 798, 5, 331, 166, 2, 798, 799, 5, 341, 171, 2, 799, 800, 5, 347, 174, 2, 800, 801, 5, 321, 161, 2, 801, 156, 3, 2, 2, 2, 802, 803, 5, 331, 166, 2, 803, 804, 5, 353, 177, 2, 804, 805, 5, 347, 174, 2, 805, 806, 5, 359, 180, 2, 806, 807, 5, 349, 175, 2, 807, 158, 3, 2, 2, 2, 808, 809, 5, 333, 167, 2, 809, 810, 5, 319, 160, 2, 810, 811, 5, 361, 181, 2, 811, 812, 5, 335, 168, 2, 812, 813, 5, 345, 173, 2, 813, 814, 5, 331, 166, 2, 814, 160, 3, 2, 2, 2, 815, 816, 5, 335, 168, 2, 816, 817, 5, 329, 165, 2, 817, 162, 3, 2, 2, 2, 818, 819, 5, 335, 168, 2, 819, 820, 5, 331, 166, 2, 820, 821, 5, 345, 173, 2, 821, 822, 5, 347, 174, 2, 822, 823, 5, 353, 177, 2, 823, 824, 5, 327, 164, 2, 824, 164, 3, 2, 2, 2, 825, 826, 5, 335, 168, 2, 826, 827, 5, 343, 172, 2, 827, 828, 5, 343, 172, 2, 828, 829, 5, 327, 164, 2, 829, 830, 5, 325, 163, 2, 830, 831, 5, 335, 168, 2, 831, 832, 5, 319, 160, 2, 832, 833, 5, 357, 179, 2, 833, 834, 5, 327, 164, 2, 834, 166, 3, 2, 2, 2, 835, 836, 5, 335, 168, 2, 836, 837, 5, 345, 173, 2, 837, 168, 3, 2, 2, 2, 838, 839, 5, 335, 168, 2, 839, 840, 5, 345, 173, 2, 840, 841, 5, 325, 163, 2, 841, 842, 5, 327, 164, 2, 842, 843, 5, 365, 183, 2, 843, 170, 3, 2, 2, 2, 844, 845, 5, 335, 168, 2, 845, 846, 5, 345, 173, 2, 846, 847, 5, 325, 163, 2, 847, 848, 5, 327, 164, 2, 848, 849, 5, 365, 183, 2, 849, 850, 5, 327, 164, 2, 850, 851, 5, 325, 163, 2, 851, 172, 3, 2, 2, 2, 852, 853, 5, 335, 168, 2, 853, 854, 5, 345, 173, 2, 854, 855, 5, 335, 168, 2, 855, 856, 5, 357, 179, 2, 856, 857, 5, 335, 168, 2, 857, 858, 5, 319, 160, 2, 858, 859, 5, 341, 171, 2, 859, 860, 5, 341, 171, 2, 860, 861, 5, 367, 184, 2, 861, 174, 3, 2, 2, 2, 862, 863, 5, 335, 168, 2, 863, 864, 5, 345, 173, 2, 864, 865, 5, 345, 173, 2, 865, 866, 5, 327, 164, 2, 866, 867, 5, 353, 177, 2, 867, 176, 3, 2, 2, 2, 868, 869, 5, 335, 168, 2, 869, 870, 5, 345, 173, 2, 870, 871, 5, 355, 178, 2, 871, 872, 5, 327, 164, 2, 872, 873, 5, 353, 177, 2, 873, 874, 5, 357, 179, 2, 874, 178, 3, 2, 2, 2, 875, 876, 5, 335, 168, 2, 876, 877, 5, 345, 173, 2, 877, 878, 5, 355, 178, 2, 878, 879, 5, 357, 179, 2, 879, 880, 5, 327, 164, 2, 880, 881, 5, 319, 160, 2, 881, 882, 5, 325, 163, 2, 882, 180, 3, 2, 2, 2, 883, 884, 5, 335, 168, 2, 884, 885, 5, 345, 173, 2, 885, 886, 5, 357, 179, 2, 886, 887, 5, 327, 164, 2, 887, 888, 5, 353, 177, 2, 888, 889, 5, 355, 178, 2, 889, 890, 5, 327, 164, 2, 890, 891, 5, 323, 162, 2, 891, 892, 5, 357, 179, 2, 892, 182, 3, 2, 2, 2, 893, 894, 5, 335, 168, 2, 894, 895, 5, 345, 173, 2, 895, 896, 5, 357, 179, 2, 896, 897, 5, 347, 174, 2, 897, 184, 3, 2, 2, 2, 898, 899, 5, 335, 168, 2, 899, 900, 5, 355, 178, 2, 900, 186, 3, 2, 2, 2, 901, 902, 5, 335, 168, 2, 902, 903, 5, 355, 178, 2, 903, 904, 5, 345, 173, 2, 904, 905, 5, 359, 180, 2, 905, 906, 5, 341, 171, 2, 906, 907, 5, 341, 171, 2, 907, 188, 3, 2, 2, 2, 908, 909, 5, 337, 169, 2, 909, 910, 5, 347, 174, 2, 910, 911, 5, 335, 168, 2, 911, 912, 5, 345, 173, 2, 912, 190, 3, 2, 2, 2, 913, 914, 5, 339, 170, 2, 914, 915, 5, 327, 164, 2, 915, 916, 5, 367, 184, 2, 916, 192, 3, 2, 2, 2, 917, 918, 5, 341, 171, 2, 918, 919, 5, 327, 164, 2, 919, 920, 5, 329, 165, 2, 920, 921, 5, 357, 179, 2, 921, 194, 3, 2, 2, 2, 922, 923, 5, 341, 171, 2, 923, 924, 5, 335, 168, 2, 924, 925, 5, 339, 170, 2, 925, 926, 5, 327, 164, 2, 926, 196, 3, 2, 2, 2, 927, 928, 5, 341, 171, 2, 928, 929, 5, 335, 168, 2, 929, 930, 5, 343, 172, 2, 930, 931, 5, 335, 168, 2, 931, 932, 5, 357, 179, 2, 932, 198, 3, 2, 2, 2, 933, 934, 5, 343, 172, 2, 934, 935, 5, 319, 160, 2, 935, 936, 5, 357, 179, 2, 936, 937, 5, 323, 162, 2, 937, 938, 5, 333, 167, 2, 938, 200, 3, 2, 2, 2, 939, 940, 5, 345, 173, 2, 940, 941, 5, 319, 160, 2, 941, 942, 5, 357, 179, 2, 942, 943, 5, 359, 180, 2, 943, 944, 5, 353, 177, 2, 944, 945, 5, 319, 160, 2, 945, 946, 5, 341, 171, 2, 946, 202, 3, 2, 2, 2, 947, 948, 5, 345, 173, 2, 948, 949, 5, 347, 174, 2, 949, 204, 3, 2, 2, 2, 950, 951, 5, 345, 173, 2, 951, 952, 5, 347, 174, 2, 952, 953, 5, 357, 179, 2, 953, 206, 3, 2, 2, 2, 954, 955, 5, 345, 173, 2, 955, 956, 5, 347, 174, 2, 956, 957, 5, 357, 179, 2, 957, 958, 5, 345, 173, 2, 958, 959, 5, 359, 180, 2, 959, 960, 5, 341, 171, 2, 960, 961, 5, 341, 171, 2, 961, 208, 3, 2, 2, 2, 962, 963, 5, 345, 173, 2, 963, 964, 5, 359, 180, 2, 964, 965, 5, 341, 171, 2, 965, 966, 5, 341, 171, 2, 966, 210, 3, 2, 2, 2, 967, 968, 5, 347, 174, 2, 968, 969, 5, 329, 165, 2, 969, 212, 3, 2, 2, 2, 970, 971, 5, 347, 174, 2, 971, 972, 5, 329, 165, 2, 972, 973, 5, 329, 165, 2, 973, 974, 5, 355, 178, 2, 974, 975, 5, 327, 164, 2, 975, 976, 5, 357, 179, 2, 976, 214, 3, 2, 2, 2, 977, 978, 5, 347, 174, 2, 978, 979, 5, 345, 173, 2, 979, 216, 3, 2, 2, 2, 980, 981, 5, 347, 174, 2, 981, 982, 5, 353, 177, 2, 982, 218, 3, 2, 2, 2, 983, 984, 5, 347, 174, 2, 984, 985, 5, 353, 177, 2, 985, 986, 5, 325, 163, 2, 986, 987, 5, 327, 164, 2, 987, 988, 5, 353, 177, 2, 988, 220, 3, 2, 2, 2, 989, 990, 5, 347, 174, 2, 990, 991, 5, 359, 180, 2, 991, 992, 5, 357, 179, 2, 992, 993, 5, 327, 164, 2, 993, 994, 5, 353, 177, 2, 994, 222, 3, 2, 2, 2, 995, 996, 5, 349, 175, 2, 996, 997, 5, 341, 171, 2, 997, 998, 5, 319, 160, 2, 998, 999, 5, 345, 173, 2, 999, 224, 3, 2, 2, 2, 1000, 1001, 5, 349, 175, 2, 1001, 1002, 5, 353, 177, 2, 1002, 1003, 5, 319, 160, 2, 1003, 1004, 5, 331, 166, 2, 1004, 1005, 5, 343, 172, 2, 1005, 1006, 5, 319, 160, 2, 1006, 226, 3, 2, 2, 2, 1007, 1008, 5, 349, 175, 2, 1008, 1009, 5, 353, 177, 2, 1009, 1010, 5, 335, 168, 2, 1010, 1011, 5, 343, 172, 2, 1011, 1012, 5, 319, 160, 2, 1012, 1013, 5, 353, 177, 2, 1013, 1014, 5, 367, 184, 2, 1014, 228, 3, 2, 2, 2, 1015, 1016, 5, 351, 176, 2, 1016, 1017, 5, 359, 180, 2, 1017, 1018, 5, 327, 164, 2, 1018, 1019, 5, 353, 177, 2, 1019, 1020, 5, 367, 184, 2, 1020, 230, 3, 2, 2, 2, 1021, 1022, 5, 353, 177, 2, 1022, 1023, 5, 319, 160, 2, 1023, 1024, 5, 335, 168, 2, 1024, 1025, 5, 355, 178, 2, 1025, 1026, 5, 327, 164, 2, 1026, 232, 3, 2, 2, 2, 1027, 1028, 5, 353, 177, 2, 1028, 1029, 5, 327, 164, 2, 1029, 1030, 5, 323, 162, 2, 1030, 1031, 5, 359, 180, 2, 1031, 1032, 5, 353, 177, 2, 1032, 1033, 5, 355, 178, 2, 1033, 1034, 5, 335, 168, 2, 1034, 1035, 5, 361, 181, 2, 1035, 1036, 5, 327, 164, 2, 1036, 234, 3, 2, 2, 2, 1037, 1038, 5, 353, 177, 2, 1038, 1039, 5, 327, 164, 2, 1039, 1040, 5, 329, 165, 2, 1040, 1041, 5, 327, 164, 2, 1041, 1042, 5, 353, 177, 2, 1042, 1043, 5, 327, 164, 2, 1043, 1044, 5, 345, 173, 2, 1044, 1045, 5, 323, 162, 2, 1045, 1046, 5, 327, 164, 2, 1046, 1047, 5, 355, 178, 2, 1047, 236, 3, 2, 2, 2, 1048, 1049, 5, 353, 177, 2, 1049, 1050, 5, 327, 164, 2, 1050, 1051, 5, 331, 166, 2, 1051, 1052, 5, 327, 164, 2, 1052, 1053, 5, 365, 183, 2, 1053, 1054, 5, 349, 175, 2, 1054, 238, 3, 2, 2, 2, 1055, 1056, 5, 353, 177, 2, 1056, 1057, 5, 327, 164, 2, 1057, 1058, 5, 335, 168, 2, 1058, 1059, 5, 345, 173, 2, 1059, 1060, 5, 325, 163, 2, 1060, 1061, 5, 327, 164, 2, 1061, 1062, 5, 365, 183, 2, 1062, 240, 3, 2, 2, 2, 1063, 1064, 5, 353, 177, 2, 1064, 1065, 5, 327, 164, 2, 1065, 1066, 5, 341, 171, 2, 1066, 1067, 5, 327, 164, 2, 1067, 1068, 5, 319, 160, 2, 1068, 1069, 5, 355, 178, 2, 1069, 1070, 5, 327, 164, 2, 1070, 242, 3, 2, 2, 2, 1071, 1072, 5, 353, 177, 2, 1072, 1073, 5, 327, 164, 2, 1073, 1074, 5, 345, 173, 2, 1074, 1075, 5, 319, 160, 2, 1075, 1076, 5, 343, 172, 2, 1076, 1077, 5, 327, 164, 2, 1077, 244, 3, 2, 2, 2, 1078, 1079, 5, 353, 177, 2, 1079, 1080, 5, 327, 164, 2, 1080, 1081, 5, 349, 175, 2, 1081, 1082, 5, 341, 171, 2, 1082, 1083, 5, 319, 160, 2, 1083, 1084, 5, 323, 162, 2, 1084, 1085, 5, 327, 164, 2, 1085, 246, 3, 2, 2, 2, 1086, 1087, 5, 353, 177, 2, 1087, 1088, 5, 327, 164, 2, 1088, 1089, 5, 355, 178, 2, 1089, 1090, 5, 357, 179, 2, 1090, 1091, 5, 353, 177, 2, 1091, 1092, 5, 335, 168, 2, 1092, 1093, 5, 323, 162, 2, 1093, 1094, 5, 357, 179, 2, 1094, 248, 3, 2, 2, 2, 1095, 1096, 5, 353, 177, 2, 1096, 1097, 5, 335, 168, 2, 1097, 1098, 5, 331, 166, 2, 1098, 1099, 5, 333, 167, 2, 1099, 1100, 5, 357, 179, 2, 1100, 250, 3, 2, 2, 2, 1101, 1102, 5, 353, 177, 2, 1102, 1103, 5, 347, 174, 2, 1103, 1104, 5, 341, 171, 2, 1104, 1105, 5, 341, 171, 2, 1105, 1106, 5, 321, 161, 2, 1106, 1107, 5, 319, 160, 2, 1107, 1108, 5, 323, 162, 2, 1108, 1109, 5, 339, 170, 2, 1109, 252, 3, 2, 2, 2, 1110, 1111, 5, 353, 177, 2, 1111, 1112, 5, 347, 174, 2, 1112, 1113, 5, 363, 182, 2, 1113, 254, 3, 2, 2, 2, 1114, 1115, 5, 355, 178, 2, 1115, 1116, 5, 319, 160, 2, 1116, 1117, 5, 361, 181, 2, 1117, 1118, 5, 327, 164, 2, 1118, 1119, 5, 349, 175, 2, 1119, 1120, 5, 347, 174, 2, 1120, 1121, 5, 335, 168, 2, 1121, 1122, 5, 345, 173, 2, 1122, 1123, 5, 357, 179, 2, 1123, 256, 3, 2, 2, 2, 1124, 1125, 5, 355, 178, 2, 1125, 1126, 5, 327, 164, 2, 1126, 1127, 5, 341, 171, 2, 1127, 1128, 5, 327, 164, 2, 1128, 1129, 5, 323, 162, 2, 1129, 1130, 5, 357, 179, 2, 1130, 258, 3, 2, 2, 2, 1131, 1132, 5, 355, 178, 2, 1132, 1133, 5, 327, 164, 2, 1133, 1134, 5, 357, 179, 2, 1134, 260, 3, 2, 2, 2, 1135, 1136, 5, 357, 179, 2, 1136, 1137, 5, 319, 160, 2, 1137, 1138, 5, 321, 161, 2, 1138, 1139, 5, 341, 171, 2, 1139, 1140, 5, 327, 164, 2, 1140, 262, 3, 2, 2, 2, 1141, 1142, 5, 357, 179, 2, 1142, 1143, 5, 327, 164, 2, 1143, 1144, 5, 343, 172, 2, 1144, 1145, 5, 349, 175, 2, 1145, 264, 3, 2, 2, 2, 1146, 1147, 5, 357, 179, 2, 1147, 1148, 5, 327, 164, 2, 1148, 1149, 5, 343, 172, 2, 1149, 1150, 5, 349, 175, 2, 1150, 1151, 5, 347, 174, 2, 1151, 1152, 5, 353, 177, 2, 1152, 1153, 5, 319, 160, 2, 1153, 1154, 5, 353, 177, 2, 1154, 1155, 5, 367, 184, 2, 1155, 266, 3, 2, 2, 2, 1156, 1157, 5, 357, 179, 2, 1157, 1158, 5, 333, 167, 2, 1158, 1159, 5, 327, 164, 2, 1159, 1160, 5, 345, 173, 2, 1160, 268, 3, 2, 2, 2, 1161, 1162, 5, 357, 179, 2, 1162, 1163, 5, 347, 174, 2, 1163, 270, 3, 2, 2, 2, 1164, 1165, 5, 357, 179, 2, 1165, 1166, 5, 353, 177, 2, 1166, 1167, 5, 319, 160, 2, 1167, 1168, 5, 345, 173, 2, 1168, 1169, 5, 355, 178, 2, 1169, 1170, 5, 319, 160, 2, 1170, 1171, 5, 323, 162, 2, 1171, 1172, 5, 357, 179, 2, 1172, 1173, 5, 335, 168, 2, 1173, 1174, 5, 347, 174, 2, 1174, 1175, 5, 345, 173, 2, 1175, 272, 3, 2, 2, 2, 1176, 1177, 5, 357, 179, 2, 1177, 1178, 5, 353, 177, 2, 1178, 1179, 5, 335, 168, 2, 1179, 1180, 5, 331, 166, 2, 1180, 1181, 5, 331, 166, 2, 1181, 1182, 5, 327, 164, 2, 1182, 1183, 5, 353, 177, 2, 1183, 274, 3, 2, 2, 2, 1184, 1185, 5, 359, 180, 2, 1185, 1186, 5, 345, 173, 2, 1186, 1187, 5, 335, 168, 2, 1187, 1188, 5, 347, 174, 2, 1188, 1189, 5, 345, 173, 2, 1189, 276, 3, 2, 2, 2, 1190, 1191, 5, 359, 180, 2, 1191, 1192, 5, 345, 173, 2, 1192, 1193, 5, 335, 168, 2, 1193, 1194, 5, 351, 176, 2, 1194, 1195, 5, 359, 180, 2, 1195, 1196, 5, 327, 164, 2, 1196, 278, 3, 2, 2, 2, 1197, 1198, 5, 359, 180, 2, 1198, 1199, 5, 349, 175, 2, 1199, 1200, 5, 325, 163, 2, 1200, 1201, 5, 319, 160, 2, 1201, 1202, 5, 357, 179, 2, 1202, 1203, 5, 327, 164, 2, 1203, 280, 3, 2, 2, 2, 1204, 1205, 5, 359, 180, 2, 1205, 1206, 5, 355, 178, 2, 1206, 1207, 5, 335, 168, 2, 1207, 1208, 5, 345, 173, 2, 1208, 1209, 5, 331, 166, 2, 1209, 282, 3, 2, 2, 2, 1210, 1211, 5, 361, 181, 2, 1211, 1212, 5, 319, 160, 2, 1212, 1213, 5, 323, 162, 2, 1213, 1214, 5, 359, 180, 2, 1214, 1215, 5, 359, 180, 2, 1215, 1216, 5, 343, 172, 2, 1216, 284, 3, 2, 2, 2, 1217, 1218, 5, 361, 181, 2, 1218, 1219, 5, 319, 160, 2, 1219, 1220, 5, 341, 171, 2, 1220, 1221, 5, 359, 180, 2, 1221, 1222, 5, 327, 164, 2, 1222, 1223, 5, 355, 178, 2, 1223, 286, 3, 2, 2, 2, 1224, 1225, 5, 361, 181, 2, 1225, 1226, 5, 335, 168, 2, 1226, 1227, 5, 327, 164, 2, 1227, 1228, 5, 363, 182, 2, 1228, 288, 3, 2, 2, 2, 1229, 1230, 5, 361, 181, 2, 1230, 1231, 5, 335, 168, 2, 1231, 1232, 5, 353, 177, 2, 1232, 1233, 5, 357, 179, 2, 1233, 1234, 5, 359, 180, 2, 1234, 1235, 5, 319, 160, 2, 1235, 1236, 5, 341, 171, 2, 1236, 290, 3, 2, 2, 2, 1237, 1238, 5, 363, 182, 2, 1238, 1239, 5, 333, 167, 2, 1239, 1240, 5, 327, 164, 2, 1240, 1241, 5, 345, 173, 2, 1241, 292, 3, 2, 2, 2, 1242, 1243, 5, 363, 182, 2, 1243, 1244, 5, 333, 167, 2, 1244, 1245, 5, 327, 164, 2, 1245, 1246, 5, 353, 177, 2, 1246, 1247, 5, 327, 164, 2, 1247, 294, 3, 2, 2, 2, 1248, 1249, 5, 363, 182, 2, 1249, 1250, 5, 335, 168, 2, 1250, 1251, 5, 357, 179, 2, 1251, 1252, 5, 333, 167, 2, 1252, 296, 3, 2, 2, 2, 1253, 1254, 5, 363, 182, 2, 1254, 1255, 5, 335, 168, 2, 1255, 1256, 5, 357, 179, 2, 1256, 1257, 5, 333, 167, 2, 1257, 1258, 5, 347, 174, 2, 1258, 1259, 5, 359, 180, 2, 1259, 1260, 5, 357, 179, 2, 1260, 298, 3, 2, 2, 2, 1261, 1267, 7, 36, 2, 2, 1262, 1266, 10, 2, 2, 2, 1263, 1264, 7, 36, 2, 2, 1264, 1266, 7, 36, 2, 2, 1265, 1262, 3, 2, 2, 2, 1265, 1263, 3, 2, 2, 2, 1266, 1269, 3, 2, 2, 2, 1267, 1265, 3, 2, 2, 2, 1267, 1268, 3, 2, 2, 2, 1268, 1270, 3, 2, 2, 2, 1269, 1267, 3, 2, 2, 2, 1270, 1297, 7, 36, 2, 2, 1271, 1277, 7, 98, 2, 2, 1272, 1276, 10, 3, 2, 2, 1273, 1274, 7, 98, 2, 2, 1274, 1276, 7, 98, 2, 2, 1275, 1272, 3, 2, 2, 2, 1275, 1273, 3, 2, 2, 2, 1276, 1279, 3, 2, 2, 2, 1277, 1275, 3, 2, 2, 2, 1277, 1278, 3, 2, 2, 2, 1278, 1280, 3, 2, 2, 2, 1279, 1277, 3, 2, 2, 2, 1280, 1297, 7, 98, 2, 2, 1281, 1285, 7, 93, 2, 2, 1282, 1284, 10, 4, 2, 2, 1283, 1282, 3, 2, 2, 2, 1284, 1287, 3, 2, 2, 2, 1285, 1283, 3, 2, 2, 2, 1285, 1286, 3, 2, 2, 2, 1286, 1288, 3, 2, 2, 2, 1287, 1285, 3, 2, 2, 2, 1288, 1297, 7, 95, 2, 2, 1289, 1293, 9, 5, 2, 2, 1290, 1292, 9, 6, 2, 2, 1291, 1290, 3, 2, 2, 2, 1292, 1295, 3, 2, 2, 2, 1293, 1291, 3, 2, 2, 2, 1293, 1294, 3, 2, 2, 2, 1294, 1297, 3, 2, 2, 2, 1295, 1293, 3, 2, 2, 2, 1296, 1261, 3, 2, 2, 2, 1296, 1271, 3, 2, 2, 2, 1296, 1281, 3, 2, 2, 2, 1296, 1289, 3, 2, 2, 2, 1297, 300, 3, 2, 2, 2, 1298, 1300, 5, 317, 159, 2, 1299, 1298, 3, 2, 2, 2, 1300, 1301, 3, 2, 2, 2, 1301, 1299, 3, 2, 2, 2, 1301, 1302, 3, 2, 2, 2, 1302, 1310, 3, 2, 2, 2, 1303, 1307, 7, 48, 2, 2, 1304, 1306, 5, 317, 159, 2, 1305, 1304, 3, 2, 2, 2, 1306, 1309, 3, 2, 2, 2, 1307, 1305, 3, 2, 2, 2, 1307, 1308, 3, 2, 2, 2, 1308, 1311, 3, 2, 2, 2, 1309, 1307, 3, 2, 2, 2, 1310, 1303, 3, 2, 2, 2, 1310, 1311, 3, 2, 2, 2, 1311, 1321, 3, 2, 2, 2, 1312, 1314, 5, 327, 164, 2, 1313, 1315, 9, 7, 2, 2, 1314, 1313, 3, 2, 2, 2, 1314, 1315, 3, 2, 2, 2, 1315, 1317, 3, 2, 2, 2, 1316, 1318, 5, 317, 159, 2, 1317, 1316, 3, 2, 2, 2, 1318, 1319, 3, 2, 2, 2, 1319, 1317, 3, 2, 2, 2, 1319, 1320, 3, 2, 2, 2, 1320, 1322, 3, 2, 2, 2, 1321, 1312, 3, 2, 2, 2, 1321, 1322, 3, 2, 2, 2, 1322, 1341, 3, 2, 2, 2, 1323, 1325, 7, 48, 2, 2, 1324, 1326, 5, 317, 159, 2, 1325, 1324, 3, 2, 2, 2, 1326, 1327, 3, 2, 2, 2, 1327, 1325, 3, 2, 2, 2, 1327, 1328, 3, 2, 2, 2, 1328, 1338, 3, 2, 2, 2, 1329, 1331, 5, 327, 164, 2, 1330, 1332, 9, 7, 2, 2, 1331, 1330, 3, 2, 2, 2, 1331, 1332, 3, 2, 2, 2, 1332, 1334, 3, 2, 2, 2, 1333, 1335, 5, 317, 159, 2, 1334, 1333, 3, 2, 2, 2, 1335, 1336, 3, 2, 2, 2, 1336, 1334, 3, 2, 2, 2, 1336, 1337, 3, 2, 2, 2, 1337, 1339, 3, 2, 2, 2, 1338, 1329, 3, 2, 2, 2, 1338, 1339, 3, 2, 2, 2, 1339, 1341, 3, 2, 2, 2, 1340, 1299, 3, 2, 2, 2, 1340, 1323, 3, 2, 2, 2, 1341, 302, 3, 2, 2, 2, 1342, 1346, 7, 65, 2, 2, 1343, 1345, 5, 317, 159, 2, 1344, 1343, 3, 2, 2, 2, 1345, 1348, 3, 2, 2, 2, 1346, 1344, 3, 2, 2, 2, 1346, 1347, 3, 2, 2, 2, 1347, 1352, 3, 2, 2, 2, 1348, 1346, 3, 2, 2, 2, 1349, 1350, 9, 8, 2, 2, 1350, 1352, 5, 299, 150, 2, 1351, 1342, 3, 2, 2, 2, 1351, 1349, 3, 2, 2, 2, 1352, 304, 3, 2, 2, 2, 1353, 1359, 7, 41, 2, 2, 1354, 1358, 10, 9, 2, 2, 1355, 1356, 7, 41, 2, 2, 1356, 1358, 7, 41, 2, 2, 1357, 1354, 3, 2, 2, 2, 1357, 1355, 3, 2, 2, 2, 1358, 1361, 3, 2, 2, 2, 1359, 1357, 3, 2, 2, 2, 1359, 1360, 3, 2, 2, 2, 1360, 1362, 3, 2, 2, 2, 1361, 1359, 3, 2, 2, 2, 1362, 1363, 7, 41, 2, 2, 1363, 306, 3, 2, 2, 2, 1364, 1365, 5, 365, 183, 2, 1365, 1366, 5, 305, 153, 2, 1366, 308, 3, 2, 2, 2, 1367, 1368, 7, 47, 2, 2, 1368, 1369, 7, 47, 2, 2, 1369, 1373, 3, 2, 2, 2, 1370, 1372, 10, 10, 2, 2, 1371, 1370, 3, 2, 2, 2, 1372, 1375, 3, 2, 2, 2, 1373, 1371, 3, 2, 2, 2, 1373, 1374, 3, 2, 2, 2, 1374, 1376, 3, 2, 2, 2, 1375, 1373, 3, 2, 2, 2, 1376, 1377, 8, 155, 2, 2, 1377, 310, 3, 2, 2, 2, 1378, 1379, 7, 49, 2, 2, 1379, 1380, 7, 44, 2, 2, 1380, 1384, 3, 2, 2, 2, 1381, 1383, 11, 2, 2, 2, 1382, 1381, 3, 2, 2, 2, 1383, 1386, 3, 2, 2, 2, 1384, 1385, 3, 2, 2, 2, 1384, 1382, 3, 2, 2, 2, 1385, 1390, 3, 2, 2, 2, 1386, 1384, 3, 2, 2, 2, 1387, 1388, 7, 44, 2, 2, 1388, 1391, 7, 49, 2, 2, 1389, 1391, 7, 2, 2, 3, 1390, 1387, 3, 2, 2, 2, 1390, 1389, 3, 2, 2, 2, 1391, 1392, 3, 2, 2, 2, 1392, 1393, 8, 156, 2, 2, 1393, 312, 3, 2, 2, 2, 1394, 1395, 9, 11, 2, 2, 1395, 1396, 3, 2, 2, 2, 1396, 1397, 8, 157, 2, 2, 1397, 314, 3, 2, 2, 2, 1398, 1399, 11, 2, 2, 2, 1399, 316, 3, 2, 2, 2, 1400, 1401, 9, 12, 2, 2, 1401, 318, 3, 2, 2, 2, 1402, 1403, 9, 13, 2, 2, 1403, 320, 3, 2, 2, 2, 1404, 1405, 9, 14, 2, 2, 1405, 322, 3, 2, 2, 2, 1406, 1407, 9, 15, 2, 2, 1407, 324, 3, 2, 2, 2, 1408, 1409, 9, 16, 2, 2, 1409, 326, 3, 2, 2, 2, 1410, 1411, 9, 17, 2, 2, 1411, 328, 3, 2, 2, 2, 1412, 1413, 9, 18, 2, 2, 1413, 330, 3, 2, 2, 2, 1414, 1415, 9, 19, 2, 2, 1415, 332, 3, 2, 2, 2, 1416, 1417, 9, 20, 2, 2, 1417, 334, 3, 2, 2, 2, 1418, 1419, 9, 21, 2, 2, 1419, 336, 3, 2, 2, 2, 1420, 1421, 9, 22, 2, 2, 1421, 338, 3, 2, 2, 2, 1422, 1423, 9, 23, 2, 2, 1423, 340, 3, 2, 2, 2, 1424, 1425, 9, 24, 2, 2, 1425, 342, 3, 2, 2, 2, 1426, 1427, 9, 25, 2, 2, 1427, 344, 3, 2, 2, 2, 1428, 1429, 9, 26, 2, 2, 1429, 346, 3, 2, 2, 2, 1430, 1431, 9, 27, 2, 2, 1431, 348, 3, 2, 2, 2, 1432, 1433, 9, 28, 2, 2, 1433, 350, 3, 2, 2, 2, 1434, 1435, 9, 29, 2, 2, 1435, 352, 3, 2, 2, 2, 1436, 1437, 9, 30, 2, 2, 1437, 354, 3, 2, 2, 2, 1438, 1439, 9, 31, 2, 2, 1439, 356, 3, 2, 2, 2, 1440, 1441, 9, 32, 2, 2, 1441, 358, 3, 2, 2, 2, 1442, 1443, 9, 33, 2, 2, 1443, 360, 3, 2, 2, 2, 1444, 1445, 9, 34, 2, 2, 1445, 362, 3, 2, 2, 2, 1446, 1447, 9, 35, 2, 2, 1447, 364, 3, 2, 2, 2, 1448, 1449, 9, 36, 2, 2, 1449, 366, 3, 2, 2, 2, 1450, 1451, 9, 37, 2, 2, 1451, 368, 3, 2, 2, 2, 1452, 1453, 9, 38, 2, 2, 1453, 370, 3, 2, 2, 2, 28, 2, 1265, 1267, 1275, 1277, 1285, 1293, 1296, 1301, 1307, 1310, 1314, 1319, 1321, 1327, 1331, 1336, 1338, 1340, 1346, 1351, 1357, 1359, 1373, 1384, 1390, 3, 2, 3, 2] \ No newline at end of file +[4, 0, 197, 1829, 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, 2, 223, 7, 223, 2, 224, 7, 224, 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, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 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, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 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, 37, 1, 37, 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, 39, 1, 39, 1, 39, 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, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 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, 46, 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, 49, 1, 49, 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, 50, 1, 50, 1, 50, 1, 50, 1, 50, 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, 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, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 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, 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, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 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, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 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, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 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, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 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, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 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, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 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, 86, 1, 86, 1, 87, 1, 87, 1, 87, 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, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 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, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 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, 114, 1, 114, 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, 117, 1, 117, 1, 117, 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, 118, 1, 118, 1, 118, 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, 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, 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, 124, 1, 124, 1, 124, 1, 125, 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, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 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, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 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, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 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, 140, 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, 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, 145, 1, 145, 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, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 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, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 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, 153, 1, 153, 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, 157, 1, 157, 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, 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, 161, 1, 161, 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, 164, 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, 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, 167, 1, 168, 1, 168, 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, 170, 1, 170, 1, 170, 1, 170, 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, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 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, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 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, 181, 1, 181, 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, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1636, 8, 187, 10, 187, 12, 187, 1639, 9, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1646, 8, 187, 10, 187, 12, 187, 1649, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1654, 8, 187, 10, 187, 12, 187, 1657, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1662, 8, 187, 10, 187, 12, 187, 1665, 9, 187, 3, 187, 1667, 8, 187, 1, 188, 4, 188, 1670, 8, 188, 11, 188, 12, 188, 1671, 1, 188, 1, 188, 5, 188, 1676, 8, 188, 10, 188, 12, 188, 1679, 9, 188, 3, 188, 1681, 8, 188, 1, 188, 1, 188, 4, 188, 1685, 8, 188, 11, 188, 12, 188, 1686, 3, 188, 1689, 8, 188, 1, 188, 1, 188, 3, 188, 1693, 8, 188, 1, 188, 4, 188, 1696, 8, 188, 11, 188, 12, 188, 1697, 3, 188, 1700, 8, 188, 1, 188, 1, 188, 1, 188, 1, 188, 4, 188, 1706, 8, 188, 11, 188, 12, 188, 1707, 3, 188, 1710, 8, 188, 1, 189, 1, 189, 5, 189, 1714, 8, 189, 10, 189, 12, 189, 1717, 9, 189, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1726, 8, 191, 10, 191, 12, 191, 1729, 9, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 1740, 8, 193, 10, 193, 12, 193, 1743, 9, 193, 1, 193, 3, 193, 1746, 8, 193, 1, 193, 1, 193, 3, 193, 1750, 8, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 194, 1, 194, 5, 194, 1758, 8, 194, 10, 194, 12, 194, 1761, 9, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 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, 223, 1, 223, 1, 224, 1, 224, 1, 1759, 0, 225, 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, 196, 393, 197, 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, 447, 0, 449, 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, 1826, 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, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 1, 451, 1, 0, 0, 0, 3, 453, 1, 0, 0, 0, 5, 455, 1, 0, 0, 0, 7, 457, 1, 0, 0, 0, 9, 459, 1, 0, 0, 0, 11, 461, 1, 0, 0, 0, 13, 463, 1, 0, 0, 0, 15, 465, 1, 0, 0, 0, 17, 467, 1, 0, 0, 0, 19, 471, 1, 0, 0, 0, 21, 474, 1, 0, 0, 0, 23, 476, 1, 0, 0, 0, 25, 478, 1, 0, 0, 0, 27, 481, 1, 0, 0, 0, 29, 483, 1, 0, 0, 0, 31, 485, 1, 0, 0, 0, 33, 488, 1, 0, 0, 0, 35, 491, 1, 0, 0, 0, 37, 493, 1, 0, 0, 0, 39, 495, 1, 0, 0, 0, 41, 497, 1, 0, 0, 0, 43, 500, 1, 0, 0, 0, 45, 502, 1, 0, 0, 0, 47, 505, 1, 0, 0, 0, 49, 508, 1, 0, 0, 0, 51, 511, 1, 0, 0, 0, 53, 514, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 527, 1, 0, 0, 0, 59, 531, 1, 0, 0, 0, 61, 537, 1, 0, 0, 0, 63, 541, 1, 0, 0, 0, 65, 547, 1, 0, 0, 0, 67, 555, 1, 0, 0, 0, 69, 559, 1, 0, 0, 0, 71, 562, 1, 0, 0, 0, 73, 566, 1, 0, 0, 0, 75, 573, 1, 0, 0, 0, 77, 587, 1, 0, 0, 0, 79, 594, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 611, 1, 0, 0, 0, 87, 619, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 629, 1, 0, 0, 0, 93, 635, 1, 0, 0, 0, 95, 643, 1, 0, 0, 0, 97, 650, 1, 0, 0, 0, 99, 657, 1, 0, 0, 0, 101, 666, 1, 0, 0, 0, 103, 677, 1, 0, 0, 0, 105, 684, 1, 0, 0, 0, 107, 690, 1, 0, 0, 0, 109, 703, 1, 0, 0, 0, 111, 716, 1, 0, 0, 0, 113, 734, 1, 0, 0, 0, 115, 743, 1, 0, 0, 0, 117, 751, 1, 0, 0, 0, 119, 762, 1, 0, 0, 0, 121, 771, 1, 0, 0, 0, 123, 778, 1, 0, 0, 0, 125, 783, 1, 0, 0, 0, 127, 790, 1, 0, 0, 0, 129, 799, 1, 0, 0, 0, 131, 804, 1, 0, 0, 0, 133, 809, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 818, 1, 0, 0, 0, 139, 825, 1, 0, 0, 0, 141, 832, 1, 0, 0, 0, 143, 842, 1, 0, 0, 0, 145, 849, 1, 0, 0, 0, 147, 857, 1, 0, 0, 0, 149, 862, 1, 0, 0, 0, 151, 866, 1, 0, 0, 0, 153, 874, 1, 0, 0, 0, 155, 879, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, 889, 1, 0, 0, 0, 161, 895, 1, 0, 0, 0, 163, 902, 1, 0, 0, 0, 165, 905, 1, 0, 0, 0, 167, 912, 1, 0, 0, 0, 169, 922, 1, 0, 0, 0, 171, 925, 1, 0, 0, 0, 173, 931, 1, 0, 0, 0, 175, 939, 1, 0, 0, 0, 177, 949, 1, 0, 0, 0, 179, 955, 1, 0, 0, 0, 181, 962, 1, 0, 0, 0, 183, 970, 1, 0, 0, 0, 185, 980, 1, 0, 0, 0, 187, 985, 1, 0, 0, 0, 189, 988, 1, 0, 0, 0, 191, 995, 1, 0, 0, 0, 193, 1000, 1, 0, 0, 0, 195, 1004, 1, 0, 0, 0, 197, 1009, 1, 0, 0, 0, 199, 1014, 1, 0, 0, 0, 201, 1020, 1, 0, 0, 0, 203, 1026, 1, 0, 0, 0, 205, 1034, 1, 0, 0, 0, 207, 1037, 1, 0, 0, 0, 209, 1041, 1, 0, 0, 0, 211, 1049, 1, 0, 0, 0, 213, 1054, 1, 0, 0, 0, 215, 1057, 1, 0, 0, 0, 217, 1064, 1, 0, 0, 0, 219, 1067, 1, 0, 0, 0, 221, 1070, 1, 0, 0, 0, 223, 1076, 1, 0, 0, 0, 225, 1082, 1, 0, 0, 0, 227, 1087, 1, 0, 0, 0, 229, 1094, 1, 0, 0, 0, 231, 1102, 1, 0, 0, 0, 233, 1108, 1, 0, 0, 0, 235, 1114, 1, 0, 0, 0, 237, 1124, 1, 0, 0, 0, 239, 1135, 1, 0, 0, 0, 241, 1142, 1, 0, 0, 0, 243, 1150, 1, 0, 0, 0, 245, 1158, 1, 0, 0, 0, 247, 1165, 1, 0, 0, 0, 249, 1173, 1, 0, 0, 0, 251, 1182, 1, 0, 0, 0, 253, 1192, 1, 0, 0, 0, 255, 1198, 1, 0, 0, 0, 257, 1207, 1, 0, 0, 0, 259, 1211, 1, 0, 0, 0, 261, 1216, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1237, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1250, 1, 0, 0, 0, 273, 1255, 1, 0, 0, 0, 275, 1265, 1, 0, 0, 0, 277, 1270, 1, 0, 0, 0, 279, 1273, 1, 0, 0, 0, 281, 1285, 1, 0, 0, 0, 283, 1293, 1, 0, 0, 0, 285, 1299, 1, 0, 0, 0, 287, 1306, 1, 0, 0, 0, 289, 1313, 1, 0, 0, 0, 291, 1319, 1, 0, 0, 0, 293, 1326, 1, 0, 0, 0, 295, 1333, 1, 0, 0, 0, 297, 1338, 1, 0, 0, 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1357, 1, 0, 0, 0, 305, 1362, 1, 0, 0, 0, 307, 1370, 1, 0, 0, 0, 309, 1382, 1, 0, 0, 0, 311, 1387, 1, 0, 0, 0, 313, 1397, 1, 0, 0, 0, 315, 1403, 1, 0, 0, 0, 317, 1413, 1, 0, 0, 0, 319, 1423, 1, 0, 0, 0, 321, 1431, 1, 0, 0, 0, 323, 1441, 1, 0, 0, 0, 325, 1451, 1, 0, 0, 0, 327, 1462, 1, 0, 0, 0, 329, 1466, 1, 0, 0, 0, 331, 1477, 1, 0, 0, 0, 333, 1482, 1, 0, 0, 0, 335, 1492, 1, 0, 0, 0, 337, 1498, 1, 0, 0, 0, 339, 1511, 1, 0, 0, 0, 341, 1516, 1, 0, 0, 0, 343, 1527, 1, 0, 0, 0, 345, 1537, 1, 0, 0, 0, 347, 1544, 1, 0, 0, 0, 349, 1551, 1, 0, 0, 0, 351, 1556, 1, 0, 0, 0, 353, 1562, 1, 0, 0, 0, 355, 1569, 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1581, 1, 0, 0, 0, 361, 1586, 1, 0, 0, 0, 363, 1593, 1, 0, 0, 0, 365, 1600, 1, 0, 0, 0, 367, 1608, 1, 0, 0, 0, 369, 1613, 1, 0, 0, 0, 371, 1620, 1, 0, 0, 0, 373, 1623, 1, 0, 0, 0, 375, 1666, 1, 0, 0, 0, 377, 1709, 1, 0, 0, 0, 379, 1711, 1, 0, 0, 0, 381, 1718, 1, 0, 0, 0, 383, 1721, 1, 0, 0, 0, 385, 1732, 1, 0, 0, 0, 387, 1735, 1, 0, 0, 0, 389, 1753, 1, 0, 0, 0, 391, 1767, 1, 0, 0, 0, 393, 1771, 1, 0, 0, 0, 395, 1773, 1, 0, 0, 0, 397, 1775, 1, 0, 0, 0, 399, 1777, 1, 0, 0, 0, 401, 1779, 1, 0, 0, 0, 403, 1781, 1, 0, 0, 0, 405, 1783, 1, 0, 0, 0, 407, 1785, 1, 0, 0, 0, 409, 1787, 1, 0, 0, 0, 411, 1789, 1, 0, 0, 0, 413, 1791, 1, 0, 0, 0, 415, 1793, 1, 0, 0, 0, 417, 1795, 1, 0, 0, 0, 419, 1797, 1, 0, 0, 0, 421, 1799, 1, 0, 0, 0, 423, 1801, 1, 0, 0, 0, 425, 1803, 1, 0, 0, 0, 427, 1805, 1, 0, 0, 0, 429, 1807, 1, 0, 0, 0, 431, 1809, 1, 0, 0, 0, 433, 1811, 1, 0, 0, 0, 435, 1813, 1, 0, 0, 0, 437, 1815, 1, 0, 0, 0, 439, 1817, 1, 0, 0, 0, 441, 1819, 1, 0, 0, 0, 443, 1821, 1, 0, 0, 0, 445, 1823, 1, 0, 0, 0, 447, 1825, 1, 0, 0, 0, 449, 1827, 1, 0, 0, 0, 451, 452, 5, 59, 0, 0, 452, 2, 1, 0, 0, 0, 453, 454, 5, 46, 0, 0, 454, 4, 1, 0, 0, 0, 455, 456, 5, 40, 0, 0, 456, 6, 1, 0, 0, 0, 457, 458, 5, 41, 0, 0, 458, 8, 1, 0, 0, 0, 459, 460, 5, 44, 0, 0, 460, 10, 1, 0, 0, 0, 461, 462, 5, 61, 0, 0, 462, 12, 1, 0, 0, 0, 463, 464, 5, 42, 0, 0, 464, 14, 1, 0, 0, 0, 465, 466, 5, 43, 0, 0, 466, 16, 1, 0, 0, 0, 467, 468, 5, 45, 0, 0, 468, 469, 5, 62, 0, 0, 469, 470, 5, 62, 0, 0, 470, 18, 1, 0, 0, 0, 471, 472, 5, 45, 0, 0, 472, 473, 5, 62, 0, 0, 473, 20, 1, 0, 0, 0, 474, 475, 5, 45, 0, 0, 475, 22, 1, 0, 0, 0, 476, 477, 5, 126, 0, 0, 477, 24, 1, 0, 0, 0, 478, 479, 5, 124, 0, 0, 479, 480, 5, 124, 0, 0, 480, 26, 1, 0, 0, 0, 481, 482, 5, 47, 0, 0, 482, 28, 1, 0, 0, 0, 483, 484, 5, 37, 0, 0, 484, 30, 1, 0, 0, 0, 485, 486, 5, 60, 0, 0, 486, 487, 5, 60, 0, 0, 487, 32, 1, 0, 0, 0, 488, 489, 5, 62, 0, 0, 489, 490, 5, 62, 0, 0, 490, 34, 1, 0, 0, 0, 491, 492, 5, 38, 0, 0, 492, 36, 1, 0, 0, 0, 493, 494, 5, 124, 0, 0, 494, 38, 1, 0, 0, 0, 495, 496, 5, 60, 0, 0, 496, 40, 1, 0, 0, 0, 497, 498, 5, 60, 0, 0, 498, 499, 5, 61, 0, 0, 499, 42, 1, 0, 0, 0, 500, 501, 5, 62, 0, 0, 501, 44, 1, 0, 0, 0, 502, 503, 5, 62, 0, 0, 503, 504, 5, 61, 0, 0, 504, 46, 1, 0, 0, 0, 505, 506, 5, 61, 0, 0, 506, 507, 5, 61, 0, 0, 507, 48, 1, 0, 0, 0, 508, 509, 5, 33, 0, 0, 509, 510, 5, 61, 0, 0, 510, 50, 1, 0, 0, 0, 511, 512, 5, 60, 0, 0, 512, 513, 5, 62, 0, 0, 513, 52, 1, 0, 0, 0, 514, 515, 3, 399, 199, 0, 515, 516, 3, 401, 200, 0, 516, 517, 3, 427, 213, 0, 517, 518, 3, 433, 216, 0, 518, 519, 3, 437, 218, 0, 519, 54, 1, 0, 0, 0, 520, 521, 3, 399, 199, 0, 521, 522, 3, 403, 201, 0, 522, 523, 3, 437, 218, 0, 523, 524, 3, 415, 207, 0, 524, 525, 3, 427, 213, 0, 525, 526, 3, 425, 212, 0, 526, 56, 1, 0, 0, 0, 527, 528, 3, 399, 199, 0, 528, 529, 3, 405, 202, 0, 529, 530, 3, 405, 202, 0, 530, 58, 1, 0, 0, 0, 531, 532, 3, 399, 199, 0, 532, 533, 3, 409, 204, 0, 533, 534, 3, 437, 218, 0, 534, 535, 3, 407, 203, 0, 535, 536, 3, 433, 216, 0, 536, 60, 1, 0, 0, 0, 537, 538, 3, 399, 199, 0, 538, 539, 3, 421, 210, 0, 539, 540, 3, 421, 210, 0, 540, 62, 1, 0, 0, 0, 541, 542, 3, 399, 199, 0, 542, 543, 3, 421, 210, 0, 543, 544, 3, 437, 218, 0, 544, 545, 3, 407, 203, 0, 545, 546, 3, 433, 216, 0, 546, 64, 1, 0, 0, 0, 547, 548, 3, 399, 199, 0, 548, 549, 3, 425, 212, 0, 549, 550, 3, 399, 199, 0, 550, 551, 3, 421, 210, 0, 551, 552, 3, 447, 223, 0, 552, 553, 3, 449, 224, 0, 553, 554, 3, 407, 203, 0, 554, 66, 1, 0, 0, 0, 555, 556, 3, 399, 199, 0, 556, 557, 3, 425, 212, 0, 557, 558, 3, 405, 202, 0, 558, 68, 1, 0, 0, 0, 559, 560, 3, 399, 199, 0, 560, 561, 3, 435, 217, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 399, 199, 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 403, 201, 0, 565, 72, 1, 0, 0, 0, 566, 567, 3, 399, 199, 0, 567, 568, 3, 437, 218, 0, 568, 569, 3, 437, 218, 0, 569, 570, 3, 399, 199, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, 413, 206, 0, 572, 74, 1, 0, 0, 0, 573, 574, 3, 399, 199, 0, 574, 575, 3, 439, 219, 0, 575, 576, 3, 437, 218, 0, 576, 577, 3, 427, 213, 0, 577, 578, 3, 415, 207, 0, 578, 579, 3, 425, 212, 0, 579, 580, 3, 403, 201, 0, 580, 581, 3, 433, 216, 0, 581, 582, 3, 407, 203, 0, 582, 583, 3, 423, 211, 0, 583, 584, 3, 407, 203, 0, 584, 585, 3, 425, 212, 0, 585, 586, 3, 437, 218, 0, 586, 76, 1, 0, 0, 0, 587, 588, 3, 401, 200, 0, 588, 589, 3, 407, 203, 0, 589, 590, 3, 409, 204, 0, 590, 591, 3, 427, 213, 0, 591, 592, 3, 433, 216, 0, 592, 593, 3, 407, 203, 0, 593, 78, 1, 0, 0, 0, 594, 595, 3, 401, 200, 0, 595, 596, 3, 407, 203, 0, 596, 597, 3, 411, 205, 0, 597, 598, 3, 415, 207, 0, 598, 599, 3, 425, 212, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 401, 200, 0, 601, 602, 3, 407, 203, 0, 602, 603, 3, 437, 218, 0, 603, 604, 3, 443, 221, 0, 604, 605, 3, 407, 203, 0, 605, 606, 3, 407, 203, 0, 606, 607, 3, 425, 212, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 401, 200, 0, 609, 610, 3, 447, 223, 0, 610, 84, 1, 0, 0, 0, 611, 612, 3, 403, 201, 0, 612, 613, 3, 399, 199, 0, 613, 614, 3, 435, 217, 0, 614, 615, 3, 403, 201, 0, 615, 616, 3, 399, 199, 0, 616, 617, 3, 405, 202, 0, 617, 618, 3, 407, 203, 0, 618, 86, 1, 0, 0, 0, 619, 620, 3, 403, 201, 0, 620, 621, 3, 399, 199, 0, 621, 622, 3, 435, 217, 0, 622, 623, 3, 407, 203, 0, 623, 88, 1, 0, 0, 0, 624, 625, 3, 403, 201, 0, 625, 626, 3, 399, 199, 0, 626, 627, 3, 435, 217, 0, 627, 628, 3, 437, 218, 0, 628, 90, 1, 0, 0, 0, 629, 630, 3, 403, 201, 0, 630, 631, 3, 413, 206, 0, 631, 632, 3, 407, 203, 0, 632, 633, 3, 403, 201, 0, 633, 634, 3, 419, 209, 0, 634, 92, 1, 0, 0, 0, 635, 636, 3, 403, 201, 0, 636, 637, 3, 427, 213, 0, 637, 638, 3, 421, 210, 0, 638, 639, 3, 421, 210, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 437, 218, 0, 641, 642, 3, 407, 203, 0, 642, 94, 1, 0, 0, 0, 643, 644, 3, 403, 201, 0, 644, 645, 3, 427, 213, 0, 645, 646, 3, 421, 210, 0, 646, 647, 3, 439, 219, 0, 647, 648, 3, 423, 211, 0, 648, 649, 3, 425, 212, 0, 649, 96, 1, 0, 0, 0, 650, 651, 3, 403, 201, 0, 651, 652, 3, 427, 213, 0, 652, 653, 3, 423, 211, 0, 653, 654, 3, 423, 211, 0, 654, 655, 3, 415, 207, 0, 655, 656, 3, 437, 218, 0, 656, 98, 1, 0, 0, 0, 657, 658, 3, 403, 201, 0, 658, 659, 3, 427, 213, 0, 659, 660, 3, 425, 212, 0, 660, 661, 3, 409, 204, 0, 661, 662, 3, 421, 210, 0, 662, 663, 3, 415, 207, 0, 663, 664, 3, 403, 201, 0, 664, 665, 3, 437, 218, 0, 665, 100, 1, 0, 0, 0, 666, 667, 3, 403, 201, 0, 667, 668, 3, 427, 213, 0, 668, 669, 3, 425, 212, 0, 669, 670, 3, 435, 217, 0, 670, 671, 3, 437, 218, 0, 671, 672, 3, 433, 216, 0, 672, 673, 3, 399, 199, 0, 673, 674, 3, 415, 207, 0, 674, 675, 3, 425, 212, 0, 675, 676, 3, 437, 218, 0, 676, 102, 1, 0, 0, 0, 677, 678, 3, 403, 201, 0, 678, 679, 3, 433, 216, 0, 679, 680, 3, 407, 203, 0, 680, 681, 3, 399, 199, 0, 681, 682, 3, 437, 218, 0, 682, 683, 3, 407, 203, 0, 683, 104, 1, 0, 0, 0, 684, 685, 3, 403, 201, 0, 685, 686, 3, 433, 216, 0, 686, 687, 3, 427, 213, 0, 687, 688, 3, 435, 217, 0, 688, 689, 3, 435, 217, 0, 689, 106, 1, 0, 0, 0, 690, 691, 3, 403, 201, 0, 691, 692, 3, 439, 219, 0, 692, 693, 3, 433, 216, 0, 693, 694, 3, 433, 216, 0, 694, 695, 3, 407, 203, 0, 695, 696, 3, 425, 212, 0, 696, 697, 3, 437, 218, 0, 697, 698, 5, 95, 0, 0, 698, 699, 3, 405, 202, 0, 699, 700, 3, 399, 199, 0, 700, 701, 3, 437, 218, 0, 701, 702, 3, 407, 203, 0, 702, 108, 1, 0, 0, 0, 703, 704, 3, 403, 201, 0, 704, 705, 3, 439, 219, 0, 705, 706, 3, 433, 216, 0, 706, 707, 3, 433, 216, 0, 707, 708, 3, 407, 203, 0, 708, 709, 3, 425, 212, 0, 709, 710, 3, 437, 218, 0, 710, 711, 5, 95, 0, 0, 711, 712, 3, 437, 218, 0, 712, 713, 3, 415, 207, 0, 713, 714, 3, 423, 211, 0, 714, 715, 3, 407, 203, 0, 715, 110, 1, 0, 0, 0, 716, 717, 3, 403, 201, 0, 717, 718, 3, 439, 219, 0, 718, 719, 3, 433, 216, 0, 719, 720, 3, 433, 216, 0, 720, 721, 3, 407, 203, 0, 721, 722, 3, 425, 212, 0, 722, 723, 3, 437, 218, 0, 723, 724, 5, 95, 0, 0, 724, 725, 3, 437, 218, 0, 725, 726, 3, 415, 207, 0, 726, 727, 3, 423, 211, 0, 727, 728, 3, 407, 203, 0, 728, 729, 3, 435, 217, 0, 729, 730, 3, 437, 218, 0, 730, 731, 3, 399, 199, 0, 731, 732, 3, 423, 211, 0, 732, 733, 3, 429, 214, 0, 733, 112, 1, 0, 0, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 399, 199, 0, 736, 737, 3, 437, 218, 0, 737, 738, 3, 399, 199, 0, 738, 739, 3, 401, 200, 0, 739, 740, 3, 399, 199, 0, 740, 741, 3, 435, 217, 0, 741, 742, 3, 407, 203, 0, 742, 114, 1, 0, 0, 0, 743, 744, 3, 405, 202, 0, 744, 745, 3, 407, 203, 0, 745, 746, 3, 409, 204, 0, 746, 747, 3, 399, 199, 0, 747, 748, 3, 439, 219, 0, 748, 749, 3, 421, 210, 0, 749, 750, 3, 437, 218, 0, 750, 116, 1, 0, 0, 0, 751, 752, 3, 405, 202, 0, 752, 753, 3, 407, 203, 0, 753, 754, 3, 409, 204, 0, 754, 755, 3, 407, 203, 0, 755, 756, 3, 433, 216, 0, 756, 757, 3, 433, 216, 0, 757, 758, 3, 399, 199, 0, 758, 759, 3, 401, 200, 0, 759, 760, 3, 421, 210, 0, 760, 761, 3, 407, 203, 0, 761, 118, 1, 0, 0, 0, 762, 763, 3, 405, 202, 0, 763, 764, 3, 407, 203, 0, 764, 765, 3, 409, 204, 0, 765, 766, 3, 407, 203, 0, 766, 767, 3, 433, 216, 0, 767, 768, 3, 433, 216, 0, 768, 769, 3, 407, 203, 0, 769, 770, 3, 405, 202, 0, 770, 120, 1, 0, 0, 0, 771, 772, 3, 405, 202, 0, 772, 773, 3, 407, 203, 0, 773, 774, 3, 421, 210, 0, 774, 775, 3, 407, 203, 0, 775, 776, 3, 437, 218, 0, 776, 777, 3, 407, 203, 0, 777, 122, 1, 0, 0, 0, 778, 779, 3, 405, 202, 0, 779, 780, 3, 407, 203, 0, 780, 781, 3, 435, 217, 0, 781, 782, 3, 403, 201, 0, 782, 124, 1, 0, 0, 0, 783, 784, 3, 405, 202, 0, 784, 785, 3, 407, 203, 0, 785, 786, 3, 437, 218, 0, 786, 787, 3, 399, 199, 0, 787, 788, 3, 403, 201, 0, 788, 789, 3, 413, 206, 0, 789, 126, 1, 0, 0, 0, 790, 791, 3, 405, 202, 0, 791, 792, 3, 415, 207, 0, 792, 793, 3, 435, 217, 0, 793, 794, 3, 437, 218, 0, 794, 795, 3, 415, 207, 0, 795, 796, 3, 425, 212, 0, 796, 797, 3, 403, 201, 0, 797, 798, 3, 437, 218, 0, 798, 128, 1, 0, 0, 0, 799, 800, 3, 405, 202, 0, 800, 801, 3, 433, 216, 0, 801, 802, 3, 427, 213, 0, 802, 803, 3, 429, 214, 0, 803, 130, 1, 0, 0, 0, 804, 805, 3, 407, 203, 0, 805, 806, 3, 399, 199, 0, 806, 807, 3, 403, 201, 0, 807, 808, 3, 413, 206, 0, 808, 132, 1, 0, 0, 0, 809, 810, 3, 407, 203, 0, 810, 811, 3, 421, 210, 0, 811, 812, 3, 435, 217, 0, 812, 813, 3, 407, 203, 0, 813, 134, 1, 0, 0, 0, 814, 815, 3, 407, 203, 0, 815, 816, 3, 425, 212, 0, 816, 817, 3, 405, 202, 0, 817, 136, 1, 0, 0, 0, 818, 819, 3, 407, 203, 0, 819, 820, 3, 435, 217, 0, 820, 821, 3, 403, 201, 0, 821, 822, 3, 399, 199, 0, 822, 823, 3, 429, 214, 0, 823, 824, 3, 407, 203, 0, 824, 138, 1, 0, 0, 0, 825, 826, 3, 407, 203, 0, 826, 827, 3, 445, 222, 0, 827, 828, 3, 403, 201, 0, 828, 829, 3, 407, 203, 0, 829, 830, 3, 429, 214, 0, 830, 831, 3, 437, 218, 0, 831, 140, 1, 0, 0, 0, 832, 833, 3, 407, 203, 0, 833, 834, 3, 445, 222, 0, 834, 835, 3, 403, 201, 0, 835, 836, 3, 421, 210, 0, 836, 837, 3, 439, 219, 0, 837, 838, 3, 435, 217, 0, 838, 839, 3, 415, 207, 0, 839, 840, 3, 441, 220, 0, 840, 841, 3, 407, 203, 0, 841, 142, 1, 0, 0, 0, 842, 843, 3, 407, 203, 0, 843, 844, 3, 445, 222, 0, 844, 845, 3, 415, 207, 0, 845, 846, 3, 435, 217, 0, 846, 847, 3, 437, 218, 0, 847, 848, 3, 435, 217, 0, 848, 144, 1, 0, 0, 0, 849, 850, 3, 407, 203, 0, 850, 851, 3, 445, 222, 0, 851, 852, 3, 429, 214, 0, 852, 853, 3, 421, 210, 0, 853, 854, 3, 399, 199, 0, 854, 855, 3, 415, 207, 0, 855, 856, 3, 425, 212, 0, 856, 146, 1, 0, 0, 0, 857, 858, 3, 409, 204, 0, 858, 859, 3, 399, 199, 0, 859, 860, 3, 415, 207, 0, 860, 861, 3, 421, 210, 0, 861, 148, 1, 0, 0, 0, 862, 863, 3, 409, 204, 0, 863, 864, 3, 427, 213, 0, 864, 865, 3, 433, 216, 0, 865, 150, 1, 0, 0, 0, 866, 867, 3, 409, 204, 0, 867, 868, 3, 427, 213, 0, 868, 869, 3, 433, 216, 0, 869, 870, 3, 407, 203, 0, 870, 871, 3, 415, 207, 0, 871, 872, 3, 411, 205, 0, 872, 873, 3, 425, 212, 0, 873, 152, 1, 0, 0, 0, 874, 875, 3, 409, 204, 0, 875, 876, 3, 433, 216, 0, 876, 877, 3, 427, 213, 0, 877, 878, 3, 423, 211, 0, 878, 154, 1, 0, 0, 0, 879, 880, 3, 409, 204, 0, 880, 881, 3, 439, 219, 0, 881, 882, 3, 421, 210, 0, 882, 883, 3, 421, 210, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 411, 205, 0, 885, 886, 3, 421, 210, 0, 886, 887, 3, 427, 213, 0, 887, 888, 3, 401, 200, 0, 888, 158, 1, 0, 0, 0, 889, 890, 3, 411, 205, 0, 890, 891, 3, 433, 216, 0, 891, 892, 3, 427, 213, 0, 892, 893, 3, 439, 219, 0, 893, 894, 3, 429, 214, 0, 894, 160, 1, 0, 0, 0, 895, 896, 3, 413, 206, 0, 896, 897, 3, 399, 199, 0, 897, 898, 3, 441, 220, 0, 898, 899, 3, 415, 207, 0, 899, 900, 3, 425, 212, 0, 900, 901, 3, 411, 205, 0, 901, 162, 1, 0, 0, 0, 902, 903, 3, 415, 207, 0, 903, 904, 3, 409, 204, 0, 904, 164, 1, 0, 0, 0, 905, 906, 3, 415, 207, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 425, 212, 0, 908, 909, 3, 427, 213, 0, 909, 910, 3, 433, 216, 0, 910, 911, 3, 407, 203, 0, 911, 166, 1, 0, 0, 0, 912, 913, 3, 415, 207, 0, 913, 914, 3, 423, 211, 0, 914, 915, 3, 423, 211, 0, 915, 916, 3, 407, 203, 0, 916, 917, 3, 405, 202, 0, 917, 918, 3, 415, 207, 0, 918, 919, 3, 399, 199, 0, 919, 920, 3, 437, 218, 0, 920, 921, 3, 407, 203, 0, 921, 168, 1, 0, 0, 0, 922, 923, 3, 415, 207, 0, 923, 924, 3, 425, 212, 0, 924, 170, 1, 0, 0, 0, 925, 926, 3, 415, 207, 0, 926, 927, 3, 425, 212, 0, 927, 928, 3, 405, 202, 0, 928, 929, 3, 407, 203, 0, 929, 930, 3, 445, 222, 0, 930, 172, 1, 0, 0, 0, 931, 932, 3, 415, 207, 0, 932, 933, 3, 425, 212, 0, 933, 934, 3, 405, 202, 0, 934, 935, 3, 407, 203, 0, 935, 936, 3, 445, 222, 0, 936, 937, 3, 407, 203, 0, 937, 938, 3, 405, 202, 0, 938, 174, 1, 0, 0, 0, 939, 940, 3, 415, 207, 0, 940, 941, 3, 425, 212, 0, 941, 942, 3, 415, 207, 0, 942, 943, 3, 437, 218, 0, 943, 944, 3, 415, 207, 0, 944, 945, 3, 399, 199, 0, 945, 946, 3, 421, 210, 0, 946, 947, 3, 421, 210, 0, 947, 948, 3, 447, 223, 0, 948, 176, 1, 0, 0, 0, 949, 950, 3, 415, 207, 0, 950, 951, 3, 425, 212, 0, 951, 952, 3, 425, 212, 0, 952, 953, 3, 407, 203, 0, 953, 954, 3, 433, 216, 0, 954, 178, 1, 0, 0, 0, 955, 956, 3, 415, 207, 0, 956, 957, 3, 425, 212, 0, 957, 958, 3, 435, 217, 0, 958, 959, 3, 407, 203, 0, 959, 960, 3, 433, 216, 0, 960, 961, 3, 437, 218, 0, 961, 180, 1, 0, 0, 0, 962, 963, 3, 415, 207, 0, 963, 964, 3, 425, 212, 0, 964, 965, 3, 435, 217, 0, 965, 966, 3, 437, 218, 0, 966, 967, 3, 407, 203, 0, 967, 968, 3, 399, 199, 0, 968, 969, 3, 405, 202, 0, 969, 182, 1, 0, 0, 0, 970, 971, 3, 415, 207, 0, 971, 972, 3, 425, 212, 0, 972, 973, 3, 437, 218, 0, 973, 974, 3, 407, 203, 0, 974, 975, 3, 433, 216, 0, 975, 976, 3, 435, 217, 0, 976, 977, 3, 407, 203, 0, 977, 978, 3, 403, 201, 0, 978, 979, 3, 437, 218, 0, 979, 184, 1, 0, 0, 0, 980, 981, 3, 415, 207, 0, 981, 982, 3, 425, 212, 0, 982, 983, 3, 437, 218, 0, 983, 984, 3, 427, 213, 0, 984, 186, 1, 0, 0, 0, 985, 986, 3, 415, 207, 0, 986, 987, 3, 435, 217, 0, 987, 188, 1, 0, 0, 0, 988, 989, 3, 415, 207, 0, 989, 990, 3, 435, 217, 0, 990, 991, 3, 425, 212, 0, 991, 992, 3, 439, 219, 0, 992, 993, 3, 421, 210, 0, 993, 994, 3, 421, 210, 0, 994, 190, 1, 0, 0, 0, 995, 996, 3, 417, 208, 0, 996, 997, 3, 427, 213, 0, 997, 998, 3, 415, 207, 0, 998, 999, 3, 425, 212, 0, 999, 192, 1, 0, 0, 0, 1000, 1001, 3, 419, 209, 0, 1001, 1002, 3, 407, 203, 0, 1002, 1003, 3, 447, 223, 0, 1003, 194, 1, 0, 0, 0, 1004, 1005, 3, 421, 210, 0, 1005, 1006, 3, 407, 203, 0, 1006, 1007, 3, 409, 204, 0, 1007, 1008, 3, 437, 218, 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 421, 210, 0, 1010, 1011, 3, 415, 207, 0, 1011, 1012, 3, 419, 209, 0, 1012, 1013, 3, 407, 203, 0, 1013, 198, 1, 0, 0, 0, 1014, 1015, 3, 421, 210, 0, 1015, 1016, 3, 415, 207, 0, 1016, 1017, 3, 423, 211, 0, 1017, 1018, 3, 415, 207, 0, 1018, 1019, 3, 437, 218, 0, 1019, 200, 1, 0, 0, 0, 1020, 1021, 3, 423, 211, 0, 1021, 1022, 3, 399, 199, 0, 1022, 1023, 3, 437, 218, 0, 1023, 1024, 3, 403, 201, 0, 1024, 1025, 3, 413, 206, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 425, 212, 0, 1027, 1028, 3, 399, 199, 0, 1028, 1029, 3, 437, 218, 0, 1029, 1030, 3, 439, 219, 0, 1030, 1031, 3, 433, 216, 0, 1031, 1032, 3, 399, 199, 0, 1032, 1033, 3, 421, 210, 0, 1033, 204, 1, 0, 0, 0, 1034, 1035, 3, 425, 212, 0, 1035, 1036, 3, 427, 213, 0, 1036, 206, 1, 0, 0, 0, 1037, 1038, 3, 425, 212, 0, 1038, 1039, 3, 427, 213, 0, 1039, 1040, 3, 437, 218, 0, 1040, 208, 1, 0, 0, 0, 1041, 1042, 3, 425, 212, 0, 1042, 1043, 3, 427, 213, 0, 1043, 1044, 3, 437, 218, 0, 1044, 1045, 3, 425, 212, 0, 1045, 1046, 3, 439, 219, 0, 1046, 1047, 3, 421, 210, 0, 1047, 1048, 3, 421, 210, 0, 1048, 210, 1, 0, 0, 0, 1049, 1050, 3, 425, 212, 0, 1050, 1051, 3, 439, 219, 0, 1051, 1052, 3, 421, 210, 0, 1052, 1053, 3, 421, 210, 0, 1053, 212, 1, 0, 0, 0, 1054, 1055, 3, 427, 213, 0, 1055, 1056, 3, 409, 204, 0, 1056, 214, 1, 0, 0, 0, 1057, 1058, 3, 427, 213, 0, 1058, 1059, 3, 409, 204, 0, 1059, 1060, 3, 409, 204, 0, 1060, 1061, 3, 435, 217, 0, 1061, 1062, 3, 407, 203, 0, 1062, 1063, 3, 437, 218, 0, 1063, 216, 1, 0, 0, 0, 1064, 1065, 3, 427, 213, 0, 1065, 1066, 3, 425, 212, 0, 1066, 218, 1, 0, 0, 0, 1067, 1068, 3, 427, 213, 0, 1068, 1069, 3, 433, 216, 0, 1069, 220, 1, 0, 0, 0, 1070, 1071, 3, 427, 213, 0, 1071, 1072, 3, 433, 216, 0, 1072, 1073, 3, 405, 202, 0, 1073, 1074, 3, 407, 203, 0, 1074, 1075, 3, 433, 216, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, 3, 427, 213, 0, 1077, 1078, 3, 439, 219, 0, 1078, 1079, 3, 437, 218, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 433, 216, 0, 1081, 224, 1, 0, 0, 0, 1082, 1083, 3, 429, 214, 0, 1083, 1084, 3, 421, 210, 0, 1084, 1085, 3, 399, 199, 0, 1085, 1086, 3, 425, 212, 0, 1086, 226, 1, 0, 0, 0, 1087, 1088, 3, 429, 214, 0, 1088, 1089, 3, 433, 216, 0, 1089, 1090, 3, 399, 199, 0, 1090, 1091, 3, 411, 205, 0, 1091, 1092, 3, 423, 211, 0, 1092, 1093, 3, 399, 199, 0, 1093, 228, 1, 0, 0, 0, 1094, 1095, 3, 429, 214, 0, 1095, 1096, 3, 433, 216, 0, 1096, 1097, 3, 415, 207, 0, 1097, 1098, 3, 423, 211, 0, 1098, 1099, 3, 399, 199, 0, 1099, 1100, 3, 433, 216, 0, 1100, 1101, 3, 447, 223, 0, 1101, 230, 1, 0, 0, 0, 1102, 1103, 3, 431, 215, 0, 1103, 1104, 3, 439, 219, 0, 1104, 1105, 3, 407, 203, 0, 1105, 1106, 3, 433, 216, 0, 1106, 1107, 3, 447, 223, 0, 1107, 232, 1, 0, 0, 0, 1108, 1109, 3, 433, 216, 0, 1109, 1110, 3, 399, 199, 0, 1110, 1111, 3, 415, 207, 0, 1111, 1112, 3, 435, 217, 0, 1112, 1113, 3, 407, 203, 0, 1113, 234, 1, 0, 0, 0, 1114, 1115, 3, 433, 216, 0, 1115, 1116, 3, 407, 203, 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 439, 219, 0, 1118, 1119, 3, 433, 216, 0, 1119, 1120, 3, 435, 217, 0, 1120, 1121, 3, 415, 207, 0, 1121, 1122, 3, 441, 220, 0, 1122, 1123, 3, 407, 203, 0, 1123, 236, 1, 0, 0, 0, 1124, 1125, 3, 433, 216, 0, 1125, 1126, 3, 407, 203, 0, 1126, 1127, 3, 409, 204, 0, 1127, 1128, 3, 407, 203, 0, 1128, 1129, 3, 433, 216, 0, 1129, 1130, 3, 407, 203, 0, 1130, 1131, 3, 425, 212, 0, 1131, 1132, 3, 403, 201, 0, 1132, 1133, 3, 407, 203, 0, 1133, 1134, 3, 435, 217, 0, 1134, 238, 1, 0, 0, 0, 1135, 1136, 3, 433, 216, 0, 1136, 1137, 3, 407, 203, 0, 1137, 1138, 3, 411, 205, 0, 1138, 1139, 3, 407, 203, 0, 1139, 1140, 3, 445, 222, 0, 1140, 1141, 3, 429, 214, 0, 1141, 240, 1, 0, 0, 0, 1142, 1143, 3, 433, 216, 0, 1143, 1144, 3, 407, 203, 0, 1144, 1145, 3, 415, 207, 0, 1145, 1146, 3, 425, 212, 0, 1146, 1147, 3, 405, 202, 0, 1147, 1148, 3, 407, 203, 0, 1148, 1149, 3, 445, 222, 0, 1149, 242, 1, 0, 0, 0, 1150, 1151, 3, 433, 216, 0, 1151, 1152, 3, 407, 203, 0, 1152, 1153, 3, 421, 210, 0, 1153, 1154, 3, 407, 203, 0, 1154, 1155, 3, 399, 199, 0, 1155, 1156, 3, 435, 217, 0, 1156, 1157, 3, 407, 203, 0, 1157, 244, 1, 0, 0, 0, 1158, 1159, 3, 433, 216, 0, 1159, 1160, 3, 407, 203, 0, 1160, 1161, 3, 425, 212, 0, 1161, 1162, 3, 399, 199, 0, 1162, 1163, 3, 423, 211, 0, 1163, 1164, 3, 407, 203, 0, 1164, 246, 1, 0, 0, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 407, 203, 0, 1167, 1168, 3, 429, 214, 0, 1168, 1169, 3, 421, 210, 0, 1169, 1170, 3, 399, 199, 0, 1170, 1171, 3, 403, 201, 0, 1171, 1172, 3, 407, 203, 0, 1172, 248, 1, 0, 0, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 407, 203, 0, 1175, 1176, 3, 435, 217, 0, 1176, 1177, 3, 437, 218, 0, 1177, 1178, 3, 433, 216, 0, 1178, 1179, 3, 415, 207, 0, 1179, 1180, 3, 403, 201, 0, 1180, 1181, 3, 437, 218, 0, 1181, 250, 1, 0, 0, 0, 1182, 1183, 3, 433, 216, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 437, 218, 0, 1185, 1186, 3, 439, 219, 0, 1186, 1187, 3, 433, 216, 0, 1187, 1188, 3, 425, 212, 0, 1188, 1189, 3, 415, 207, 0, 1189, 1190, 3, 425, 212, 0, 1190, 1191, 3, 411, 205, 0, 1191, 252, 1, 0, 0, 0, 1192, 1193, 3, 433, 216, 0, 1193, 1194, 3, 415, 207, 0, 1194, 1195, 3, 411, 205, 0, 1195, 1196, 3, 413, 206, 0, 1196, 1197, 3, 437, 218, 0, 1197, 254, 1, 0, 0, 0, 1198, 1199, 3, 433, 216, 0, 1199, 1200, 3, 427, 213, 0, 1200, 1201, 3, 421, 210, 0, 1201, 1202, 3, 421, 210, 0, 1202, 1203, 3, 401, 200, 0, 1203, 1204, 3, 399, 199, 0, 1204, 1205, 3, 403, 201, 0, 1205, 1206, 3, 419, 209, 0, 1206, 256, 1, 0, 0, 0, 1207, 1208, 3, 433, 216, 0, 1208, 1209, 3, 427, 213, 0, 1209, 1210, 3, 443, 221, 0, 1210, 258, 1, 0, 0, 0, 1211, 1212, 3, 433, 216, 0, 1212, 1213, 3, 427, 213, 0, 1213, 1214, 3, 443, 221, 0, 1214, 1215, 3, 435, 217, 0, 1215, 260, 1, 0, 0, 0, 1216, 1217, 3, 435, 217, 0, 1217, 1218, 3, 399, 199, 0, 1218, 1219, 3, 441, 220, 0, 1219, 1220, 3, 407, 203, 0, 1220, 1221, 3, 429, 214, 0, 1221, 1222, 3, 427, 213, 0, 1222, 1223, 3, 415, 207, 0, 1223, 1224, 3, 425, 212, 0, 1224, 1225, 3, 437, 218, 0, 1225, 262, 1, 0, 0, 0, 1226, 1227, 3, 435, 217, 0, 1227, 1228, 3, 407, 203, 0, 1228, 1229, 3, 421, 210, 0, 1229, 1230, 3, 407, 203, 0, 1230, 1231, 3, 403, 201, 0, 1231, 1232, 3, 437, 218, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 435, 217, 0, 1234, 1235, 3, 407, 203, 0, 1235, 1236, 3, 437, 218, 0, 1236, 266, 1, 0, 0, 0, 1237, 1238, 3, 435, 217, 0, 1238, 1239, 3, 437, 218, 0, 1239, 1240, 3, 433, 216, 0, 1240, 1241, 3, 415, 207, 0, 1241, 1242, 3, 403, 201, 0, 1242, 1243, 3, 437, 218, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 437, 218, 0, 1245, 1246, 3, 399, 199, 0, 1246, 1247, 3, 401, 200, 0, 1247, 1248, 3, 421, 210, 0, 1248, 1249, 3, 407, 203, 0, 1249, 270, 1, 0, 0, 0, 1250, 1251, 3, 437, 218, 0, 1251, 1252, 3, 407, 203, 0, 1252, 1253, 3, 423, 211, 0, 1253, 1254, 3, 429, 214, 0, 1254, 272, 1, 0, 0, 0, 1255, 1256, 3, 437, 218, 0, 1256, 1257, 3, 407, 203, 0, 1257, 1258, 3, 423, 211, 0, 1258, 1259, 3, 429, 214, 0, 1259, 1260, 3, 427, 213, 0, 1260, 1261, 3, 433, 216, 0, 1261, 1262, 3, 399, 199, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, 447, 223, 0, 1264, 274, 1, 0, 0, 0, 1265, 1266, 3, 437, 218, 0, 1266, 1267, 3, 413, 206, 0, 1267, 1268, 3, 407, 203, 0, 1268, 1269, 3, 425, 212, 0, 1269, 276, 1, 0, 0, 0, 1270, 1271, 3, 437, 218, 0, 1271, 1272, 3, 427, 213, 0, 1272, 278, 1, 0, 0, 0, 1273, 1274, 3, 437, 218, 0, 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 399, 199, 0, 1276, 1277, 3, 425, 212, 0, 1277, 1278, 3, 435, 217, 0, 1278, 1279, 3, 399, 199, 0, 1279, 1280, 3, 403, 201, 0, 1280, 1281, 3, 437, 218, 0, 1281, 1282, 3, 415, 207, 0, 1282, 1283, 3, 427, 213, 0, 1283, 1284, 3, 425, 212, 0, 1284, 280, 1, 0, 0, 0, 1285, 1286, 3, 437, 218, 0, 1286, 1287, 3, 433, 216, 0, 1287, 1288, 3, 415, 207, 0, 1288, 1289, 3, 411, 205, 0, 1289, 1290, 3, 411, 205, 0, 1290, 1291, 3, 407, 203, 0, 1291, 1292, 3, 433, 216, 0, 1292, 282, 1, 0, 0, 0, 1293, 1294, 3, 439, 219, 0, 1294, 1295, 3, 425, 212, 0, 1295, 1296, 3, 415, 207, 0, 1296, 1297, 3, 427, 213, 0, 1297, 1298, 3, 425, 212, 0, 1298, 284, 1, 0, 0, 0, 1299, 1300, 3, 439, 219, 0, 1300, 1301, 3, 425, 212, 0, 1301, 1302, 3, 415, 207, 0, 1302, 1303, 3, 431, 215, 0, 1303, 1304, 3, 439, 219, 0, 1304, 1305, 3, 407, 203, 0, 1305, 286, 1, 0, 0, 0, 1306, 1307, 3, 439, 219, 0, 1307, 1308, 3, 429, 214, 0, 1308, 1309, 3, 405, 202, 0, 1309, 1310, 3, 399, 199, 0, 1310, 1311, 3, 437, 218, 0, 1311, 1312, 3, 407, 203, 0, 1312, 288, 1, 0, 0, 0, 1313, 1314, 3, 439, 219, 0, 1314, 1315, 3, 435, 217, 0, 1315, 1316, 3, 415, 207, 0, 1316, 1317, 3, 425, 212, 0, 1317, 1318, 3, 411, 205, 0, 1318, 290, 1, 0, 0, 0, 1319, 1320, 3, 441, 220, 0, 1320, 1321, 3, 399, 199, 0, 1321, 1322, 3, 403, 201, 0, 1322, 1323, 3, 439, 219, 0, 1323, 1324, 3, 439, 219, 0, 1324, 1325, 3, 423, 211, 0, 1325, 292, 1, 0, 0, 0, 1326, 1327, 3, 441, 220, 0, 1327, 1328, 3, 399, 199, 0, 1328, 1329, 3, 421, 210, 0, 1329, 1330, 3, 439, 219, 0, 1330, 1331, 3, 407, 203, 0, 1331, 1332, 3, 435, 217, 0, 1332, 294, 1, 0, 0, 0, 1333, 1334, 3, 441, 220, 0, 1334, 1335, 3, 415, 207, 0, 1335, 1336, 3, 407, 203, 0, 1336, 1337, 3, 443, 221, 0, 1337, 296, 1, 0, 0, 0, 1338, 1339, 3, 441, 220, 0, 1339, 1340, 3, 415, 207, 0, 1340, 1341, 3, 433, 216, 0, 1341, 1342, 3, 437, 218, 0, 1342, 1343, 3, 439, 219, 0, 1343, 1344, 3, 399, 199, 0, 1344, 1345, 3, 421, 210, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 443, 221, 0, 1347, 1348, 3, 413, 206, 0, 1348, 1349, 3, 407, 203, 0, 1349, 1350, 3, 425, 212, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 443, 221, 0, 1352, 1353, 3, 413, 206, 0, 1353, 1354, 3, 407, 203, 0, 1354, 1355, 3, 433, 216, 0, 1355, 1356, 3, 407, 203, 0, 1356, 302, 1, 0, 0, 0, 1357, 1358, 3, 443, 221, 0, 1358, 1359, 3, 415, 207, 0, 1359, 1360, 3, 437, 218, 0, 1360, 1361, 3, 413, 206, 0, 1361, 304, 1, 0, 0, 0, 1362, 1363, 3, 443, 221, 0, 1363, 1364, 3, 415, 207, 0, 1364, 1365, 3, 437, 218, 0, 1365, 1366, 3, 413, 206, 0, 1366, 1367, 3, 427, 213, 0, 1367, 1368, 3, 439, 219, 0, 1368, 1369, 3, 437, 218, 0, 1369, 306, 1, 0, 0, 0, 1370, 1371, 3, 409, 204, 0, 1371, 1372, 3, 415, 207, 0, 1372, 1373, 3, 433, 216, 0, 1373, 1374, 3, 435, 217, 0, 1374, 1375, 3, 437, 218, 0, 1375, 1376, 5, 95, 0, 0, 1376, 1377, 3, 441, 220, 0, 1377, 1378, 3, 399, 199, 0, 1378, 1379, 3, 421, 210, 0, 1379, 1380, 3, 439, 219, 0, 1380, 1381, 3, 407, 203, 0, 1381, 308, 1, 0, 0, 0, 1382, 1383, 3, 427, 213, 0, 1383, 1384, 3, 441, 220, 0, 1384, 1385, 3, 407, 203, 0, 1385, 1386, 3, 433, 216, 0, 1386, 310, 1, 0, 0, 0, 1387, 1388, 3, 429, 214, 0, 1388, 1389, 3, 399, 199, 0, 1389, 1390, 3, 433, 216, 0, 1390, 1391, 3, 437, 218, 0, 1391, 1392, 3, 415, 207, 0, 1392, 1393, 3, 437, 218, 0, 1393, 1394, 3, 415, 207, 0, 1394, 1395, 3, 427, 213, 0, 1395, 1396, 3, 425, 212, 0, 1396, 312, 1, 0, 0, 0, 1397, 1398, 3, 433, 216, 0, 1398, 1399, 3, 399, 199, 0, 1399, 1400, 3, 425, 212, 0, 1400, 1401, 3, 411, 205, 0, 1401, 1402, 3, 407, 203, 0, 1402, 314, 1, 0, 0, 0, 1403, 1404, 3, 429, 214, 0, 1404, 1405, 3, 433, 216, 0, 1405, 1406, 3, 407, 203, 0, 1406, 1407, 3, 403, 201, 0, 1407, 1408, 3, 407, 203, 0, 1408, 1409, 3, 405, 202, 0, 1409, 1410, 3, 415, 207, 0, 1410, 1411, 3, 425, 212, 0, 1411, 1412, 3, 411, 205, 0, 1412, 316, 1, 0, 0, 0, 1413, 1414, 3, 439, 219, 0, 1414, 1415, 3, 425, 212, 0, 1415, 1416, 3, 401, 200, 0, 1416, 1417, 3, 427, 213, 0, 1417, 1418, 3, 439, 219, 0, 1418, 1419, 3, 425, 212, 0, 1419, 1420, 3, 405, 202, 0, 1420, 1421, 3, 407, 203, 0, 1421, 1422, 3, 405, 202, 0, 1422, 318, 1, 0, 0, 0, 1423, 1424, 3, 403, 201, 0, 1424, 1425, 3, 439, 219, 0, 1425, 1426, 3, 433, 216, 0, 1426, 1427, 3, 433, 216, 0, 1427, 1428, 3, 407, 203, 0, 1428, 1429, 3, 425, 212, 0, 1429, 1430, 3, 437, 218, 0, 1430, 320, 1, 0, 0, 0, 1431, 1432, 3, 409, 204, 0, 1432, 1433, 3, 427, 213, 0, 1433, 1434, 3, 421, 210, 0, 1434, 1435, 3, 421, 210, 0, 1435, 1436, 3, 427, 213, 0, 1436, 1437, 3, 443, 221, 0, 1437, 1438, 3, 415, 207, 0, 1438, 1439, 3, 425, 212, 0, 1439, 1440, 3, 411, 205, 0, 1440, 322, 1, 0, 0, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 439, 219, 0, 1443, 1444, 3, 423, 211, 0, 1444, 1445, 3, 407, 203, 0, 1445, 1446, 5, 95, 0, 0, 1446, 1447, 3, 405, 202, 0, 1447, 1448, 3, 415, 207, 0, 1448, 1449, 3, 435, 217, 0, 1449, 1450, 3, 437, 218, 0, 1450, 324, 1, 0, 0, 0, 1451, 1452, 3, 405, 202, 0, 1452, 1453, 3, 407, 203, 0, 1453, 1454, 3, 425, 212, 0, 1454, 1455, 3, 435, 217, 0, 1455, 1456, 3, 407, 203, 0, 1456, 1457, 5, 95, 0, 0, 1457, 1458, 3, 433, 216, 0, 1458, 1459, 3, 399, 199, 0, 1459, 1460, 3, 425, 212, 0, 1460, 1461, 3, 419, 209, 0, 1461, 326, 1, 0, 0, 0, 1462, 1463, 3, 421, 210, 0, 1463, 1464, 3, 399, 199, 0, 1464, 1465, 3, 411, 205, 0, 1465, 328, 1, 0, 0, 0, 1466, 1467, 3, 421, 210, 0, 1467, 1468, 3, 399, 199, 0, 1468, 1469, 3, 435, 217, 0, 1469, 1470, 3, 437, 218, 0, 1470, 1471, 5, 95, 0, 0, 1471, 1472, 3, 441, 220, 0, 1472, 1473, 3, 399, 199, 0, 1473, 1474, 3, 421, 210, 0, 1474, 1475, 3, 439, 219, 0, 1475, 1476, 3, 407, 203, 0, 1476, 330, 1, 0, 0, 0, 1477, 1478, 3, 421, 210, 0, 1478, 1479, 3, 407, 203, 0, 1479, 1480, 3, 399, 199, 0, 1480, 1481, 3, 405, 202, 0, 1481, 332, 1, 0, 0, 0, 1482, 1483, 3, 425, 212, 0, 1483, 1484, 3, 437, 218, 0, 1484, 1485, 3, 413, 206, 0, 1485, 1486, 5, 95, 0, 0, 1486, 1487, 3, 441, 220, 0, 1487, 1488, 3, 399, 199, 0, 1488, 1489, 3, 421, 210, 0, 1489, 1490, 3, 439, 219, 0, 1490, 1491, 3, 407, 203, 0, 1491, 334, 1, 0, 0, 0, 1492, 1493, 3, 425, 212, 0, 1493, 1494, 3, 437, 218, 0, 1494, 1495, 3, 415, 207, 0, 1495, 1496, 3, 421, 210, 0, 1496, 1497, 3, 407, 203, 0, 1497, 336, 1, 0, 0, 0, 1498, 1499, 3, 429, 214, 0, 1499, 1500, 3, 407, 203, 0, 1500, 1501, 3, 433, 216, 0, 1501, 1502, 3, 403, 201, 0, 1502, 1503, 3, 407, 203, 0, 1503, 1504, 3, 425, 212, 0, 1504, 1505, 3, 437, 218, 0, 1505, 1506, 5, 95, 0, 0, 1506, 1507, 3, 433, 216, 0, 1507, 1508, 3, 399, 199, 0, 1508, 1509, 3, 425, 212, 0, 1509, 1510, 3, 419, 209, 0, 1510, 338, 1, 0, 0, 0, 1511, 1512, 3, 433, 216, 0, 1512, 1513, 3, 399, 199, 0, 1513, 1514, 3, 425, 212, 0, 1514, 1515, 3, 419, 209, 0, 1515, 340, 1, 0, 0, 0, 1516, 1517, 3, 433, 216, 0, 1517, 1518, 3, 427, 213, 0, 1518, 1519, 3, 443, 221, 0, 1519, 1520, 5, 95, 0, 0, 1520, 1521, 3, 425, 212, 0, 1521, 1522, 3, 439, 219, 0, 1522, 1523, 3, 423, 211, 0, 1523, 1524, 3, 401, 200, 0, 1524, 1525, 3, 407, 203, 0, 1525, 1526, 3, 433, 216, 0, 1526, 342, 1, 0, 0, 0, 1527, 1528, 3, 411, 205, 0, 1528, 1529, 3, 407, 203, 0, 1529, 1530, 3, 425, 212, 0, 1530, 1531, 3, 407, 203, 0, 1531, 1532, 3, 433, 216, 0, 1532, 1533, 3, 399, 199, 0, 1533, 1534, 3, 437, 218, 0, 1534, 1535, 3, 407, 203, 0, 1535, 1536, 3, 405, 202, 0, 1536, 344, 1, 0, 0, 0, 1537, 1538, 3, 399, 199, 0, 1538, 1539, 3, 421, 210, 0, 1539, 1540, 3, 443, 221, 0, 1540, 1541, 3, 399, 199, 0, 1541, 1542, 3, 447, 223, 0, 1542, 1543, 3, 435, 217, 0, 1543, 346, 1, 0, 0, 0, 1544, 1545, 3, 435, 217, 0, 1545, 1546, 3, 437, 218, 0, 1546, 1547, 3, 427, 213, 0, 1547, 1548, 3, 433, 216, 0, 1548, 1549, 3, 407, 203, 0, 1549, 1550, 3, 405, 202, 0, 1550, 348, 1, 0, 0, 0, 1551, 1552, 3, 437, 218, 0, 1552, 1553, 3, 433, 216, 0, 1553, 1554, 3, 439, 219, 0, 1554, 1555, 3, 407, 203, 0, 1555, 350, 1, 0, 0, 0, 1556, 1557, 3, 409, 204, 0, 1557, 1558, 3, 399, 199, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, 3, 435, 217, 0, 1560, 1561, 3, 407, 203, 0, 1561, 352, 1, 0, 0, 0, 1562, 1563, 3, 443, 221, 0, 1563, 1564, 3, 415, 207, 0, 1564, 1565, 3, 425, 212, 0, 1565, 1566, 3, 405, 202, 0, 1566, 1567, 3, 427, 213, 0, 1567, 1568, 3, 443, 221, 0, 1568, 354, 1, 0, 0, 0, 1569, 1570, 3, 425, 212, 0, 1570, 1571, 3, 439, 219, 0, 1571, 1572, 3, 421, 210, 0, 1572, 1573, 3, 421, 210, 0, 1573, 1574, 3, 435, 217, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 409, 204, 0, 1576, 1577, 3, 415, 207, 0, 1577, 1578, 3, 433, 216, 0, 1578, 1579, 3, 435, 217, 0, 1579, 1580, 3, 437, 218, 0, 1580, 358, 1, 0, 0, 0, 1581, 1582, 3, 421, 210, 0, 1582, 1583, 3, 399, 199, 0, 1583, 1584, 3, 435, 217, 0, 1584, 1585, 3, 437, 218, 0, 1585, 360, 1, 0, 0, 0, 1586, 1587, 3, 409, 204, 0, 1587, 1588, 3, 415, 207, 0, 1588, 1589, 3, 421, 210, 0, 1589, 1590, 3, 437, 218, 0, 1590, 1591, 3, 407, 203, 0, 1591, 1592, 3, 433, 216, 0, 1592, 362, 1, 0, 0, 0, 1593, 1594, 3, 411, 205, 0, 1594, 1595, 3, 433, 216, 0, 1595, 1596, 3, 427, 213, 0, 1596, 1597, 3, 439, 219, 0, 1597, 1598, 3, 429, 214, 0, 1598, 1599, 3, 435, 217, 0, 1599, 364, 1, 0, 0, 0, 1600, 1601, 3, 407, 203, 0, 1601, 1602, 3, 445, 222, 0, 1602, 1603, 3, 403, 201, 0, 1603, 1604, 3, 421, 210, 0, 1604, 1605, 3, 439, 219, 0, 1605, 1606, 3, 405, 202, 0, 1606, 1607, 3, 407, 203, 0, 1607, 366, 1, 0, 0, 0, 1608, 1609, 3, 437, 218, 0, 1609, 1610, 3, 415, 207, 0, 1610, 1611, 3, 407, 203, 0, 1611, 1612, 3, 435, 217, 0, 1612, 368, 1, 0, 0, 0, 1613, 1614, 3, 427, 213, 0, 1614, 1615, 3, 437, 218, 0, 1615, 1616, 3, 413, 206, 0, 1616, 1617, 3, 407, 203, 0, 1617, 1618, 3, 433, 216, 0, 1618, 1619, 3, 435, 217, 0, 1619, 370, 1, 0, 0, 0, 1620, 1621, 3, 405, 202, 0, 1621, 1622, 3, 427, 213, 0, 1622, 372, 1, 0, 0, 0, 1623, 1624, 3, 425, 212, 0, 1624, 1625, 3, 427, 213, 0, 1625, 1626, 3, 437, 218, 0, 1626, 1627, 3, 413, 206, 0, 1627, 1628, 3, 415, 207, 0, 1628, 1629, 3, 425, 212, 0, 1629, 1630, 3, 411, 205, 0, 1630, 374, 1, 0, 0, 0, 1631, 1637, 5, 34, 0, 0, 1632, 1636, 8, 0, 0, 0, 1633, 1634, 5, 34, 0, 0, 1634, 1636, 5, 34, 0, 0, 1635, 1632, 1, 0, 0, 0, 1635, 1633, 1, 0, 0, 0, 1636, 1639, 1, 0, 0, 0, 1637, 1635, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1640, 1, 0, 0, 0, 1639, 1637, 1, 0, 0, 0, 1640, 1667, 5, 34, 0, 0, 1641, 1647, 5, 96, 0, 0, 1642, 1646, 8, 1, 0, 0, 1643, 1644, 5, 96, 0, 0, 1644, 1646, 5, 96, 0, 0, 1645, 1642, 1, 0, 0, 0, 1645, 1643, 1, 0, 0, 0, 1646, 1649, 1, 0, 0, 0, 1647, 1645, 1, 0, 0, 0, 1647, 1648, 1, 0, 0, 0, 1648, 1650, 1, 0, 0, 0, 1649, 1647, 1, 0, 0, 0, 1650, 1667, 5, 96, 0, 0, 1651, 1655, 5, 91, 0, 0, 1652, 1654, 8, 2, 0, 0, 1653, 1652, 1, 0, 0, 0, 1654, 1657, 1, 0, 0, 0, 1655, 1653, 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1655, 1, 0, 0, 0, 1658, 1667, 5, 93, 0, 0, 1659, 1663, 7, 3, 0, 0, 1660, 1662, 7, 4, 0, 0, 1661, 1660, 1, 0, 0, 0, 1662, 1665, 1, 0, 0, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1667, 1, 0, 0, 0, 1665, 1663, 1, 0, 0, 0, 1666, 1631, 1, 0, 0, 0, 1666, 1641, 1, 0, 0, 0, 1666, 1651, 1, 0, 0, 0, 1666, 1659, 1, 0, 0, 0, 1667, 376, 1, 0, 0, 0, 1668, 1670, 3, 397, 198, 0, 1669, 1668, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1669, 1, 0, 0, 0, 1671, 1672, 1, 0, 0, 0, 1672, 1680, 1, 0, 0, 0, 1673, 1677, 5, 46, 0, 0, 1674, 1676, 3, 397, 198, 0, 1675, 1674, 1, 0, 0, 0, 1676, 1679, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, 1681, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1680, 1673, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1689, 1, 0, 0, 0, 1682, 1684, 5, 46, 0, 0, 1683, 1685, 3, 397, 198, 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, 1669, 1, 0, 0, 0, 1688, 1682, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1692, 3, 407, 203, 0, 1691, 1693, 7, 5, 0, 0, 1692, 1691, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1695, 1, 0, 0, 0, 1694, 1696, 3, 397, 198, 0, 1695, 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1695, 1, 0, 0, 0, 1697, 1698, 1, 0, 0, 0, 1698, 1700, 1, 0, 0, 0, 1699, 1690, 1, 0, 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1710, 1, 0, 0, 0, 1701, 1702, 5, 48, 0, 0, 1702, 1703, 5, 120, 0, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1706, 3, 395, 197, 0, 1705, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, 1707, 1708, 1, 0, 0, 0, 1708, 1710, 1, 0, 0, 0, 1709, 1688, 1, 0, 0, 0, 1709, 1701, 1, 0, 0, 0, 1710, 378, 1, 0, 0, 0, 1711, 1715, 5, 63, 0, 0, 1712, 1714, 3, 397, 198, 0, 1713, 1712, 1, 0, 0, 0, 1714, 1717, 1, 0, 0, 0, 1715, 1713, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 380, 1, 0, 0, 0, 1717, 1715, 1, 0, 0, 0, 1718, 1719, 7, 6, 0, 0, 1719, 1720, 3, 375, 187, 0, 1720, 382, 1, 0, 0, 0, 1721, 1727, 5, 39, 0, 0, 1722, 1726, 8, 7, 0, 0, 1723, 1724, 5, 39, 0, 0, 1724, 1726, 5, 39, 0, 0, 1725, 1722, 1, 0, 0, 0, 1725, 1723, 1, 0, 0, 0, 1726, 1729, 1, 0, 0, 0, 1727, 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1730, 1, 0, 0, 0, 1729, 1727, 1, 0, 0, 0, 1730, 1731, 5, 39, 0, 0, 1731, 384, 1, 0, 0, 0, 1732, 1733, 3, 445, 222, 0, 1733, 1734, 3, 383, 191, 0, 1734, 386, 1, 0, 0, 0, 1735, 1736, 5, 45, 0, 0, 1736, 1737, 5, 45, 0, 0, 1737, 1741, 1, 0, 0, 0, 1738, 1740, 8, 8, 0, 0, 1739, 1738, 1, 0, 0, 0, 1740, 1743, 1, 0, 0, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 1749, 1, 0, 0, 0, 1743, 1741, 1, 0, 0, 0, 1744, 1746, 5, 13, 0, 0, 1745, 1744, 1, 0, 0, 0, 1745, 1746, 1, 0, 0, 0, 1746, 1747, 1, 0, 0, 0, 1747, 1750, 5, 10, 0, 0, 1748, 1750, 5, 0, 0, 1, 1749, 1745, 1, 0, 0, 0, 1749, 1748, 1, 0, 0, 0, 1750, 1751, 1, 0, 0, 0, 1751, 1752, 6, 193, 0, 0, 1752, 388, 1, 0, 0, 0, 1753, 1754, 5, 47, 0, 0, 1754, 1755, 5, 42, 0, 0, 1755, 1759, 1, 0, 0, 0, 1756, 1758, 9, 0, 0, 0, 1757, 1756, 1, 0, 0, 0, 1758, 1761, 1, 0, 0, 0, 1759, 1760, 1, 0, 0, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1762, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1762, 1763, 5, 42, 0, 0, 1763, 1764, 5, 47, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 6, 194, 0, 0, 1766, 390, 1, 0, 0, 0, 1767, 1768, 7, 9, 0, 0, 1768, 1769, 1, 0, 0, 0, 1769, 1770, 6, 195, 0, 0, 1770, 392, 1, 0, 0, 0, 1771, 1772, 9, 0, 0, 0, 1772, 394, 1, 0, 0, 0, 1773, 1774, 7, 10, 0, 0, 1774, 396, 1, 0, 0, 0, 1775, 1776, 7, 11, 0, 0, 1776, 398, 1, 0, 0, 0, 1777, 1778, 7, 12, 0, 0, 1778, 400, 1, 0, 0, 0, 1779, 1780, 7, 13, 0, 0, 1780, 402, 1, 0, 0, 0, 1781, 1782, 7, 14, 0, 0, 1782, 404, 1, 0, 0, 0, 1783, 1784, 7, 15, 0, 0, 1784, 406, 1, 0, 0, 0, 1785, 1786, 7, 16, 0, 0, 1786, 408, 1, 0, 0, 0, 1787, 1788, 7, 17, 0, 0, 1788, 410, 1, 0, 0, 0, 1789, 1790, 7, 18, 0, 0, 1790, 412, 1, 0, 0, 0, 1791, 1792, 7, 19, 0, 0, 1792, 414, 1, 0, 0, 0, 1793, 1794, 7, 20, 0, 0, 1794, 416, 1, 0, 0, 0, 1795, 1796, 7, 21, 0, 0, 1796, 418, 1, 0, 0, 0, 1797, 1798, 7, 22, 0, 0, 1798, 420, 1, 0, 0, 0, 1799, 1800, 7, 23, 0, 0, 1800, 422, 1, 0, 0, 0, 1801, 1802, 7, 24, 0, 0, 1802, 424, 1, 0, 0, 0, 1803, 1804, 7, 25, 0, 0, 1804, 426, 1, 0, 0, 0, 1805, 1806, 7, 26, 0, 0, 1806, 428, 1, 0, 0, 0, 1807, 1808, 7, 27, 0, 0, 1808, 430, 1, 0, 0, 0, 1809, 1810, 7, 28, 0, 0, 1810, 432, 1, 0, 0, 0, 1811, 1812, 7, 29, 0, 0, 1812, 434, 1, 0, 0, 0, 1813, 1814, 7, 30, 0, 0, 1814, 436, 1, 0, 0, 0, 1815, 1816, 7, 31, 0, 0, 1816, 438, 1, 0, 0, 0, 1817, 1818, 7, 32, 0, 0, 1818, 440, 1, 0, 0, 0, 1819, 1820, 7, 33, 0, 0, 1820, 442, 1, 0, 0, 0, 1821, 1822, 7, 34, 0, 0, 1822, 444, 1, 0, 0, 0, 1823, 1824, 7, 35, 0, 0, 1824, 446, 1, 0, 0, 0, 1825, 1826, 7, 36, 0, 0, 1826, 448, 1, 0, 0, 0, 1827, 1828, 7, 37, 0, 0, 1828, 450, 1, 0, 0, 0, 25, 0, 1635, 1637, 1645, 1647, 1655, 1663, 1666, 1671, 1677, 1680, 1686, 1688, 1692, 1697, 1699, 1707, 1709, 1715, 1725, 1727, 1741, 1745, 1749, 1759, 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 index c57b62b5ad..6777c57bdc 100644 --- a/internal/engine/sqlite/parser/SQLiteLexer.tokens +++ b/internal/engine/sqlite/parser/SQLiteLexer.tokens @@ -6,155 +6,195 @@ 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 -K_ABORT=25 -K_ACTION=26 -K_ADD=27 -K_AFTER=28 -K_ALL=29 -K_ALTER=30 -K_ANALYZE=31 -K_AND=32 -K_AS=33 -K_ASC=34 -K_ATTACH=35 -K_AUTOINCREMENT=36 -K_BEFORE=37 -K_BEGIN=38 -K_BETWEEN=39 -K_BY=40 -K_CASCADE=41 -K_CASE=42 -K_CAST=43 -K_CHECK=44 -K_COLLATE=45 -K_COLUMN=46 -K_COMMIT=47 -K_CONFLICT=48 -K_CONSTRAINT=49 -K_CREATE=50 -K_CROSS=51 -K_CURRENT_DATE=52 -K_CURRENT_TIME=53 -K_CURRENT_TIMESTAMP=54 -K_DATABASE=55 -K_DEFAULT=56 -K_DEFERRABLE=57 -K_DEFERRED=58 -K_DELETE=59 -K_DESC=60 -K_DETACH=61 -K_DISTINCT=62 -K_DROP=63 -K_EACH=64 -K_ELSE=65 -K_END=66 -K_ESCAPE=67 -K_EXCEPT=68 -K_EXCLUSIVE=69 -K_EXISTS=70 -K_EXPLAIN=71 -K_FAIL=72 -K_FOR=73 -K_FOREIGN=74 -K_FROM=75 -K_FULL=76 -K_GLOB=77 -K_GROUP=78 -K_HAVING=79 -K_IF=80 -K_IGNORE=81 -K_IMMEDIATE=82 -K_IN=83 -K_INDEX=84 -K_INDEXED=85 -K_INITIALLY=86 -K_INNER=87 -K_INSERT=88 -K_INSTEAD=89 -K_INTERSECT=90 -K_INTO=91 -K_IS=92 -K_ISNULL=93 -K_JOIN=94 -K_KEY=95 -K_LEFT=96 -K_LIKE=97 -K_LIMIT=98 -K_MATCH=99 -K_NATURAL=100 -K_NO=101 -K_NOT=102 -K_NOTNULL=103 -K_NULL=104 -K_OF=105 -K_OFFSET=106 -K_ON=107 -K_OR=108 -K_ORDER=109 -K_OUTER=110 -K_PLAN=111 -K_PRAGMA=112 -K_PRIMARY=113 -K_QUERY=114 -K_RAISE=115 -K_RECURSIVE=116 -K_REFERENCES=117 -K_REGEXP=118 -K_REINDEX=119 -K_RELEASE=120 -K_RENAME=121 -K_REPLACE=122 -K_RESTRICT=123 -K_RIGHT=124 -K_ROLLBACK=125 -K_ROW=126 -K_SAVEPOINT=127 -K_SELECT=128 -K_SET=129 -K_TABLE=130 -K_TEMP=131 -K_TEMPORARY=132 -K_THEN=133 -K_TO=134 -K_TRANSACTION=135 -K_TRIGGER=136 -K_UNION=137 -K_UNIQUE=138 -K_UPDATE=139 -K_USING=140 -K_VACUUM=141 -K_VALUES=142 -K_VIEW=143 -K_VIRTUAL=144 -K_WHEN=145 -K_WHERE=146 -K_WITH=147 -K_WITHOUT=148 -IDENTIFIER=149 -NUMERIC_LITERAL=150 -BIND_PARAMETER=151 -STRING_LITERAL=152 -BLOB_LITERAL=153 -SINGLE_LINE_COMMENT=154 -MULTILINE_COMMENT=155 -SPACES=156 -UNEXPECTED_CHAR=157 +PTR2=9 +PTR=10 +MINUS=11 +TILDE=12 +PIPE2=13 +DIV=14 +MOD=15 +LT2=16 +GT2=17 +AMP=18 +PIPE=19 +LT=20 +LT_EQ=21 +GT=22 +GT_EQ=23 +EQ=24 +NOT_EQ1=25 +NOT_EQ2=26 +ABORT_=27 +ACTION_=28 +ADD_=29 +AFTER_=30 +ALL_=31 +ALTER_=32 +ANALYZE_=33 +AND_=34 +AS_=35 +ASC_=36 +ATTACH_=37 +AUTOINCREMENT_=38 +BEFORE_=39 +BEGIN_=40 +BETWEEN_=41 +BY_=42 +CASCADE_=43 +CASE_=44 +CAST_=45 +CHECK_=46 +COLLATE_=47 +COLUMN_=48 +COMMIT_=49 +CONFLICT_=50 +CONSTRAINT_=51 +CREATE_=52 +CROSS_=53 +CURRENT_DATE_=54 +CURRENT_TIME_=55 +CURRENT_TIMESTAMP_=56 +DATABASE_=57 +DEFAULT_=58 +DEFERRABLE_=59 +DEFERRED_=60 +DELETE_=61 +DESC_=62 +DETACH_=63 +DISTINCT_=64 +DROP_=65 +EACH_=66 +ELSE_=67 +END_=68 +ESCAPE_=69 +EXCEPT_=70 +EXCLUSIVE_=71 +EXISTS_=72 +EXPLAIN_=73 +FAIL_=74 +FOR_=75 +FOREIGN_=76 +FROM_=77 +FULL_=78 +GLOB_=79 +GROUP_=80 +HAVING_=81 +IF_=82 +IGNORE_=83 +IMMEDIATE_=84 +IN_=85 +INDEX_=86 +INDEXED_=87 +INITIALLY_=88 +INNER_=89 +INSERT_=90 +INSTEAD_=91 +INTERSECT_=92 +INTO_=93 +IS_=94 +ISNULL_=95 +JOIN_=96 +KEY_=97 +LEFT_=98 +LIKE_=99 +LIMIT_=100 +MATCH_=101 +NATURAL_=102 +NO_=103 +NOT_=104 +NOTNULL_=105 +NULL_=106 +OF_=107 +OFFSET_=108 +ON_=109 +OR_=110 +ORDER_=111 +OUTER_=112 +PLAN_=113 +PRAGMA_=114 +PRIMARY_=115 +QUERY_=116 +RAISE_=117 +RECURSIVE_=118 +REFERENCES_=119 +REGEXP_=120 +REINDEX_=121 +RELEASE_=122 +RENAME_=123 +REPLACE_=124 +RESTRICT_=125 +RETURNING_=126 +RIGHT_=127 +ROLLBACK_=128 +ROW_=129 +ROWS_=130 +SAVEPOINT_=131 +SELECT_=132 +SET_=133 +STRICT_=134 +TABLE_=135 +TEMP_=136 +TEMPORARY_=137 +THEN_=138 +TO_=139 +TRANSACTION_=140 +TRIGGER_=141 +UNION_=142 +UNIQUE_=143 +UPDATE_=144 +USING_=145 +VACUUM_=146 +VALUES_=147 +VIEW_=148 +VIRTUAL_=149 +WHEN_=150 +WHERE_=151 +WITH_=152 +WITHOUT_=153 +FIRST_VALUE_=154 +OVER_=155 +PARTITION_=156 +RANGE_=157 +PRECEDING_=158 +UNBOUNDED_=159 +CURRENT_=160 +FOLLOWING_=161 +CUME_DIST_=162 +DENSE_RANK_=163 +LAG_=164 +LAST_VALUE_=165 +LEAD_=166 +NTH_VALUE_=167 +NTILE_=168 +PERCENT_RANK_=169 +RANK_=170 +ROW_NUMBER_=171 +GENERATED_=172 +ALWAYS_=173 +STORED_=174 +TRUE_=175 +FALSE_=176 +WINDOW_=177 +NULLS_=178 +FIRST_=179 +LAST_=180 +FILTER_=181 +GROUPS_=182 +EXCLUDE_=183 +TIES_=184 +OTHERS_=185 +DO_=186 +NOTHING_=187 +IDENTIFIER=188 +NUMERIC_LITERAL=189 +NUMBERED_BIND_PARAMETER=190 +NAMED_BIND_PARAMETER=191 +STRING_LITERAL=192 +BLOB_LITERAL=193 +SINGLE_LINE_COMMENT=194 +MULTILINE_COMMENT=195 +SPACES=196 +UNEXPECTED_CHAR=197 ';'=1 '.'=2 '('=3 @@ -163,19 +203,21 @@ UNEXPECTED_CHAR=157 '='=6 '*'=7 '+'=8 -'-'=9 -'~'=10 -'||'=11 -'/'=12 -'%'=13 -'<<'=14 -'>>'=15 -'&'=16 -'|'=17 -'<'=18 -'<='=19 -'>'=20 -'>='=21 -'=='=22 -'!='=23 -'<>'=24 +'->>'=9 +'->'=10 +'-'=11 +'~'=12 +'||'=13 +'/'=14 +'%'=15 +'<<'=16 +'>>'=17 +'&'=18 +'|'=19 +'<'=20 +'<='=21 +'>'=22 +'>='=23 +'=='=24 +'!='=25 +'<>'=26 diff --git a/internal/engine/sqlite/parser/SQLiteParser.g4 b/internal/engine/sqlite/parser/SQLiteParser.g4 new file mode 100644 index 0000000000..14ca873687 --- /dev/null +++ b/internal/engine/sqlite/parser/SQLiteParser.g4 @@ -0,0 +1,924 @@ +/* + * 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 ( PTR | PTR2 ) expr #expr_binary + | expr ( STAR | DIV | MOD) expr #expr_binary + | expr ( PLUS | MINUS) expr #expr_binary + | 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_bool + | expr OR_ expr #expr_bool + | 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 + | DEFAULT_ VALUES_ + ) upsert_clause? returning_clause? + ) +; + +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 new file mode 100644 index 0000000000..7a268aa1a8 --- /dev/null +++ b/internal/engine/sqlite/parser/SQLiteParser.interp @@ -0,0 +1,520 @@ +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 +PTR2 +PTR +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, 197, 2176, 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, 1, 34, 1, 34, 1, 34, 3, 34, 1035, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1042, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1053, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1062, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1070, 8, 34, 10, 34, 12, 34, 1073, 9, 34, 3, 34, 1075, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1081, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1087, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1094, 8, 34, 10, 34, 12, 34, 1097, 9, 34, 3, 34, 1099, 8, 34, 1, 34, 1, 34, 3, 34, 1103, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1116, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1123, 8, 34, 5, 34, 1125, 8, 34, 10, 34, 12, 34, 1128, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1136, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1143, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1156, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1161, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1167, 8, 37, 10, 37, 12, 37, 1170, 9, 37, 1, 37, 1, 37, 3, 37, 1174, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1181, 8, 37, 10, 37, 12, 37, 1184, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1192, 8, 37, 10, 37, 12, 37, 1195, 9, 37, 1, 37, 1, 37, 5, 37, 1199, 8, 37, 10, 37, 12, 37, 1202, 9, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1207, 8, 37, 1, 37, 3, 37, 1210, 8, 37, 1, 37, 3, 37, 1213, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1221, 8, 38, 10, 38, 12, 38, 1224, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1229, 8, 38, 3, 38, 1231, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1239, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1246, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1251, 8, 38, 10, 38, 12, 38, 1254, 9, 38, 1, 38, 1, 38, 3, 38, 1258, 8, 38, 3, 38, 1260, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1266, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1275, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1280, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 1, 41, 1, 41, 3, 41, 1291, 8, 41, 3, 41, 1293, 8, 41, 1, 42, 3, 42, 1296, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1302, 8, 42, 10, 42, 12, 42, 1305, 9, 42, 1, 42, 3, 42, 1308, 8, 42, 1, 42, 3, 42, 1311, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1318, 8, 43, 10, 43, 12, 43, 1321, 9, 43, 1, 44, 1, 44, 3, 44, 1325, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1330, 8, 44, 10, 44, 12, 44, 1333, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1339, 8, 44, 10, 44, 12, 44, 1342, 9, 44, 1, 44, 3, 44, 1345, 8, 44, 3, 44, 1347, 8, 44, 1, 44, 1, 44, 3, 44, 1351, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1358, 8, 44, 10, 44, 12, 44, 1361, 9, 44, 1, 44, 1, 44, 3, 44, 1365, 8, 44, 3, 44, 1367, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1378, 8, 44, 10, 44, 12, 44, 1381, 9, 44, 3, 44, 1383, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1390, 8, 44, 10, 44, 12, 44, 1393, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1401, 8, 44, 10, 44, 12, 44, 1404, 9, 44, 1, 44, 1, 44, 5, 44, 1408, 8, 44, 10, 44, 12, 44, 1411, 9, 44, 3, 44, 1413, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1418, 8, 46, 1, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 46, 3, 46, 1425, 8, 46, 1, 47, 3, 47, 1428, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1433, 8, 47, 1, 47, 1, 47, 3, 47, 1437, 8, 47, 1, 47, 4, 47, 1440, 8, 47, 11, 47, 12, 47, 1441, 1, 47, 3, 47, 1445, 8, 47, 1, 47, 3, 47, 1448, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1453, 8, 48, 1, 48, 1, 48, 3, 48, 1457, 8, 48, 1, 48, 3, 48, 1460, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1467, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1472, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1479, 8, 48, 10, 48, 12, 48, 1482, 9, 48, 1, 48, 1, 48, 3, 48, 1486, 8, 48, 1, 48, 3, 48, 1489, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1495, 8, 48, 10, 48, 12, 48, 1498, 9, 48, 1, 48, 3, 48, 1501, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1509, 8, 48, 1, 48, 3, 48, 1512, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1517, 8, 48, 1, 48, 1, 48, 3, 48, 1521, 8, 48, 1, 48, 3, 48, 1524, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1531, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1536, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1543, 8, 48, 10, 48, 12, 48, 1546, 9, 48, 1, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 3, 48, 1553, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1559, 8, 48, 10, 48, 12, 48, 1562, 9, 48, 1, 48, 3, 48, 1565, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1573, 8, 48, 1, 48, 3, 48, 1576, 8, 48, 3, 48, 1578, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1587, 8, 49, 1, 49, 3, 49, 1590, 8, 49, 3, 49, 1592, 8, 49, 1, 50, 1, 50, 3, 50, 1596, 8, 50, 1, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 3, 50, 1603, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1608, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1617, 8, 51, 10, 51, 12, 51, 1620, 9, 51, 1, 51, 1, 51, 3, 51, 1624, 8, 51, 1, 52, 1, 52, 3, 52, 1628, 8, 52, 1, 52, 1, 52, 3, 52, 1632, 8, 52, 1, 53, 3, 53, 1635, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1640, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1646, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1653, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1658, 8, 53, 10, 53, 12, 53, 1661, 9, 53, 1, 53, 1, 53, 3, 53, 1665, 8, 53, 1, 53, 3, 53, 1668, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1674, 8, 54, 10, 54, 12, 54, 1677, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1682, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1687, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1693, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1700, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1705, 8, 55, 10, 55, 12, 55, 1708, 9, 55, 1, 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 55, 3, 55, 1718, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1723, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1728, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1735, 8, 56, 1, 57, 1, 57, 3, 57, 1739, 8, 57, 1, 57, 1, 57, 3, 57, 1743, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1753, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1760, 8, 59, 10, 59, 12, 59, 1763, 9, 59, 3, 59, 1765, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1772, 8, 59, 10, 59, 12, 59, 1775, 9, 59, 1, 59, 3, 59, 1778, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1786, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1793, 8, 60, 10, 60, 12, 60, 1796, 9, 60, 3, 60, 1798, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1805, 8, 60, 10, 60, 12, 60, 1808, 9, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, 8, 60, 1, 60, 3, 60, 1816, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1826, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1835, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1842, 8, 63, 10, 63, 12, 63, 1845, 9, 63, 1, 63, 3, 63, 1848, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1855, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1860, 8, 64, 10, 64, 12, 64, 1863, 9, 64, 1, 64, 3, 64, 1866, 8, 64, 1, 64, 1, 64, 3, 64, 1870, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1877, 8, 65, 10, 65, 12, 65, 1880, 9, 65, 1, 65, 3, 65, 1883, 8, 65, 1, 65, 1, 65, 3, 65, 1887, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1892, 8, 65, 1, 66, 1, 66, 3, 66, 1896, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1901, 8, 66, 10, 66, 12, 66, 1904, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1911, 8, 67, 10, 67, 12, 67, 1914, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1920, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1925, 8, 69, 1, 69, 3, 69, 1928, 8, 69, 1, 69, 1, 69, 3, 69, 1932, 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, 1946, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1958, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1967, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1976, 8, 74, 1, 74, 1, 74, 3, 74, 1980, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, 3, 74, 1993, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2002, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2011, 8, 74, 1, 74, 3, 74, 2014, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2020, 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, 2034, 8, 74, 1, 74, 1, 74, 3, 74, 2038, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2049, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2054, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2065, 8, 77, 11, 77, 12, 77, 2066, 1, 78, 1, 78, 1, 78, 4, 78, 2072, 8, 78, 11, 78, 12, 78, 2073, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2082, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2087, 8, 80, 5, 80, 2089, 8, 80, 10, 80, 12, 80, 2092, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2104, 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, 2117, 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, 2174, 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, 30, 3, 0, 60, 60, 71, 71, 84, 84, 2, 0, 49, 49, 68, 68, 1, 0, 136, 137, 2, 0, 149, 149, 174, 174, 2, 0, 8, 8, 11, 11, 2, 0, 61, 61, 144, 144, 2, 0, 58, 58, 106, 106, 2, 0, 60, 60, 84, 84, 5, 0, 27, 27, 74, 74, 83, 83, 124, 124, 128, 128, 4, 0, 86, 86, 135, 135, 141, 141, 148, 148, 1, 0, 9, 10, 2, 0, 7, 7, 14, 15, 1, 0, 16, 19, 1, 0, 20, 23, 4, 0, 79, 79, 99, 99, 101, 101, 120, 120, 3, 0, 27, 27, 74, 74, 128, 128, 5, 0, 54, 56, 106, 106, 175, 176, 189, 189, 192, 193, 2, 0, 31, 31, 64, 64, 3, 0, 78, 78, 98, 98, 127, 127, 3, 0, 130, 130, 157, 157, 182, 182, 2, 0, 5, 5, 108, 108, 1, 0, 179, 180, 2, 0, 36, 36, 62, 62, 2, 0, 154, 154, 165, 165, 2, 0, 162, 162, 169, 169, 2, 0, 163, 163, 170, 171, 2, 0, 164, 164, 166, 166, 3, 0, 8, 8, 11, 12, 104, 104, 2, 0, 188, 188, 192, 192, 1, 0, 27, 183, 2482, 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, 1129, 1, 0, 0, 0, 72, 1139, 1, 0, 0, 0, 74, 1142, 1, 0, 0, 0, 76, 1214, 1, 0, 0, 0, 78, 1261, 1, 0, 0, 0, 80, 1279, 1, 0, 0, 0, 82, 1281, 1, 0, 0, 0, 84, 1295, 1, 0, 0, 0, 86, 1312, 1, 0, 0, 0, 88, 1412, 1, 0, 0, 0, 90, 1414, 1, 0, 0, 0, 92, 1417, 1, 0, 0, 0, 94, 1427, 1, 0, 0, 0, 96, 1577, 1, 0, 0, 0, 98, 1591, 1, 0, 0, 0, 100, 1607, 1, 0, 0, 0, 102, 1623, 1, 0, 0, 0, 104, 1631, 1, 0, 0, 0, 106, 1634, 1, 0, 0, 0, 108, 1669, 1, 0, 0, 0, 110, 1681, 1, 0, 0, 0, 112, 1722, 1, 0, 0, 0, 114, 1736, 1, 0, 0, 0, 116, 1744, 1, 0, 0, 0, 118, 1750, 1, 0, 0, 0, 120, 1781, 1, 0, 0, 0, 122, 1817, 1, 0, 0, 0, 124, 1827, 1, 0, 0, 0, 126, 1836, 1, 0, 0, 0, 128, 1851, 1, 0, 0, 0, 130, 1871, 1, 0, 0, 0, 132, 1893, 1, 0, 0, 0, 134, 1905, 1, 0, 0, 0, 136, 1915, 1, 0, 0, 0, 138, 1921, 1, 0, 0, 0, 140, 1933, 1, 0, 0, 0, 142, 1945, 1, 0, 0, 0, 144, 1957, 1, 0, 0, 0, 146, 1966, 1, 0, 0, 0, 148, 2053, 1, 0, 0, 0, 150, 2055, 1, 0, 0, 0, 152, 2058, 1, 0, 0, 0, 154, 2061, 1, 0, 0, 0, 156, 2068, 1, 0, 0, 0, 158, 2075, 1, 0, 0, 0, 160, 2079, 1, 0, 0, 0, 162, 2093, 1, 0, 0, 0, 164, 2095, 1, 0, 0, 0, 166, 2097, 1, 0, 0, 0, 168, 2099, 1, 0, 0, 0, 170, 2103, 1, 0, 0, 0, 172, 2105, 1, 0, 0, 0, 174, 2107, 1, 0, 0, 0, 176, 2109, 1, 0, 0, 0, 178, 2111, 1, 0, 0, 0, 180, 2116, 1, 0, 0, 0, 182, 2120, 1, 0, 0, 0, 184, 2122, 1, 0, 0, 0, 186, 2124, 1, 0, 0, 0, 188, 2126, 1, 0, 0, 0, 190, 2128, 1, 0, 0, 0, 192, 2130, 1, 0, 0, 0, 194, 2132, 1, 0, 0, 0, 196, 2134, 1, 0, 0, 0, 198, 2136, 1, 0, 0, 0, 200, 2138, 1, 0, 0, 0, 202, 2140, 1, 0, 0, 0, 204, 2142, 1, 0, 0, 0, 206, 2144, 1, 0, 0, 0, 208, 2146, 1, 0, 0, 0, 210, 2148, 1, 0, 0, 0, 212, 2150, 1, 0, 0, 0, 214, 2152, 1, 0, 0, 0, 216, 2154, 1, 0, 0, 0, 218, 2156, 1, 0, 0, 0, 220, 2158, 1, 0, 0, 0, 222, 2160, 1, 0, 0, 0, 224, 2162, 1, 0, 0, 0, 226, 2164, 1, 0, 0, 0, 228, 2173, 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, 73, 0, 0, 263, 264, 5, 116, 0, 0, 264, 266, 5, 113, 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, 32, 0, 0, 296, 300, 5, 135, 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, 123, 0, 0, 304, 305, 5, 139, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, 5, 48, 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, 139, 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, 29, 0, 0, 316, 318, 5, 48, 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, 65, 0, 0, 321, 323, 5, 48, 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, 33, 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, 37, 0, 0, 338, 340, 5, 57, 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, 35, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 40, 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, 140, 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, 140, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 128, 0, 0, 360, 362, 5, 140, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 139, 0, 0, 364, 366, 5, 131, 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, 131, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 122, 0, 0, 374, 376, 5, 131, 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, 52, 0, 0, 380, 382, 5, 143, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 387, 5, 86, 0, 0, 384, 385, 5, 82, 0, 0, 385, 386, 5, 104, 0, 0, 386, 388, 5, 72, 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, 109, 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, 151, 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, 47, 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, 153, 0, 0, 423, 426, 5, 188, 0, 0, 424, 426, 5, 134, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 52, 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, 135, 0, 0, 432, 433, 5, 82, 0, 0, 433, 434, 5, 104, 0, 0, 434, 436, 5, 72, 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, 35, 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, 51, 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, 115, 0, 0, 506, 508, 5, 97, 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, 38, 0, 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 104, 0, 0, 517, 520, 5, 106, 0, 0, 518, 520, 5, 143, 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, 46, 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, 58, 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, 47, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 172, 0, 0, 542, 544, 5, 173, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 35, 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, 189, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 51, 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, 115, 0, 0, 564, 567, 5, 97, 0, 0, 565, 567, 5, 143, 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, 46, 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, 76, 0, 0, 587, 588, 5, 97, 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, 119, 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, 109, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 133, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 43, 0, 0, 622, 626, 5, 125, 0, 0, 623, 624, 5, 103, 0, 0, 624, 626, 5, 28, 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, 101, 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, 104, 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 59, 0, 0, 638, 639, 5, 88, 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, 109, 0, 0, 645, 646, 5, 50, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 52, 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, 141, 0, 0, 653, 654, 5, 82, 0, 0, 654, 655, 5, 104, 0, 0, 655, 657, 5, 72, 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, 39, 0, 0, 665, 669, 5, 30, 0, 0, 666, 667, 5, 91, 0, 0, 667, 669, 5, 107, 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, 61, 0, 0, 671, 685, 5, 90, 0, 0, 672, 682, 5, 144, 0, 0, 673, 674, 5, 107, 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, 109, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 75, 0, 0, 689, 690, 5, 66, 0, 0, 690, 692, 5, 129, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 150, 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, 40, 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, 68, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 52, 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, 148, 0, 0, 717, 718, 5, 82, 0, 0, 718, 719, 5, 104, 0, 0, 719, 721, 5, 72, 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, 35, 0, 0, 742, 743, 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 52, 0, 0, 745, 746, 5, 149, 0, 0, 746, 750, 5, 135, 0, 0, 747, 748, 5, 82, 0, 0, 748, 749, 5, 104, 0, 0, 749, 751, 5, 72, 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, 145, 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, 152, 0, 0, 774, 776, 5, 118, 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, 35, 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, 35, 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, 35, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 142, 0, 0, 813, 815, 5, 31, 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, 35, 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, 126, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 35, 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, 35, 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, 61, 0, 0, 869, 870, 5, 77, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 151, 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, 61, 0, 0, 882, 883, 5, 77, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, 5, 151, 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, 63, 0, 0, 898, 900, 5, 57, 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, 65, 0, 0, 904, 907, 7, 9, 0, 0, 905, 906, 5, 82, 0, 0, 906, 908, 5, 72, 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, 190, 0, 0, 919, 1006, 5, 191, 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, 21, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, 5, 3, 0, 0, 936, 938, 5, 64, 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, 45, 0, 0, 969, 970, 5, 3, 0, 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 35, 0, 0, 972, 973, 3, 32, 16, 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 104, 0, 0, 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 72, 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, 44, 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, 150, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 138, 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, 67, 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, 68, 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, 1126, 1, 0, 0, 0, 1007, 1008, 10, 20, 0, 0, 1008, 1009, 5, 13, 0, 0, 1009, 1125, 3, 68, 34, 21, 1010, 1011, 10, 19, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1125, 3, 68, 34, 20, 1013, 1014, 10, 18, 0, 0, 1014, 1015, 7, 11, 0, 0, 1015, 1125, 3, 68, 34, 19, 1016, 1017, 10, 17, 0, 0, 1017, 1018, 7, 4, 0, 0, 1018, 1125, 3, 68, 34, 18, 1019, 1020, 10, 16, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1125, 3, 68, 34, 17, 1022, 1023, 10, 15, 0, 0, 1023, 1024, 7, 13, 0, 0, 1024, 1125, 3, 68, 34, 16, 1025, 1041, 10, 14, 0, 0, 1026, 1042, 5, 6, 0, 0, 1027, 1042, 5, 24, 0, 0, 1028, 1042, 5, 25, 0, 0, 1029, 1042, 5, 26, 0, 0, 1030, 1042, 5, 94, 0, 0, 1031, 1032, 5, 94, 0, 0, 1032, 1042, 5, 104, 0, 0, 1033, 1035, 5, 104, 0, 0, 1034, 1033, 1, 0, 0, 0, 1034, 1035, 1, 0, 0, 0, 1035, 1036, 1, 0, 0, 0, 1036, 1042, 5, 85, 0, 0, 1037, 1042, 5, 99, 0, 0, 1038, 1042, 5, 79, 0, 0, 1039, 1042, 5, 101, 0, 0, 1040, 1042, 5, 120, 0, 0, 1041, 1026, 1, 0, 0, 0, 1041, 1027, 1, 0, 0, 0, 1041, 1028, 1, 0, 0, 0, 1041, 1029, 1, 0, 0, 0, 1041, 1030, 1, 0, 0, 0, 1041, 1031, 1, 0, 0, 0, 1041, 1034, 1, 0, 0, 0, 1041, 1037, 1, 0, 0, 0, 1041, 1038, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, 1040, 1, 0, 0, 0, 1042, 1043, 1, 0, 0, 0, 1043, 1125, 3, 68, 34, 15, 1044, 1045, 10, 12, 0, 0, 1045, 1046, 5, 34, 0, 0, 1046, 1125, 3, 68, 34, 13, 1047, 1048, 10, 11, 0, 0, 1048, 1049, 5, 110, 0, 0, 1049, 1125, 3, 68, 34, 12, 1050, 1052, 10, 4, 0, 0, 1051, 1053, 5, 104, 0, 0, 1052, 1051, 1, 0, 0, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, 5, 41, 0, 0, 1055, 1056, 3, 68, 34, 0, 1056, 1057, 5, 34, 0, 0, 1057, 1058, 3, 68, 34, 5, 1058, 1125, 1, 0, 0, 0, 1059, 1061, 10, 13, 0, 0, 1060, 1062, 5, 104, 0, 0, 1061, 1060, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1063, 1, 0, 0, 0, 1063, 1102, 5, 85, 0, 0, 1064, 1074, 5, 3, 0, 0, 1065, 1075, 3, 84, 42, 0, 1066, 1071, 3, 68, 34, 0, 1067, 1068, 5, 5, 0, 0, 1068, 1070, 3, 68, 34, 0, 1069, 1067, 1, 0, 0, 0, 1070, 1073, 1, 0, 0, 0, 1071, 1069, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1075, 1, 0, 0, 0, 1073, 1071, 1, 0, 0, 0, 1074, 1065, 1, 0, 0, 0, 1074, 1066, 1, 0, 0, 0, 1074, 1075, 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1103, 5, 4, 0, 0, 1077, 1078, 3, 182, 91, 0, 1078, 1079, 5, 2, 0, 0, 1079, 1081, 1, 0, 0, 0, 1080, 1077, 1, 0, 0, 0, 1080, 1081, 1, 0, 0, 0, 1081, 1082, 1, 0, 0, 0, 1082, 1103, 3, 184, 92, 0, 1083, 1084, 3, 182, 91, 0, 1084, 1085, 5, 2, 0, 0, 1085, 1087, 1, 0, 0, 0, 1086, 1083, 1, 0, 0, 0, 1086, 1087, 1, 0, 0, 0, 1087, 1088, 1, 0, 0, 0, 1088, 1089, 3, 226, 113, 0, 1089, 1098, 5, 3, 0, 0, 1090, 1095, 3, 68, 34, 0, 1091, 1092, 5, 5, 0, 0, 1092, 1094, 3, 68, 34, 0, 1093, 1091, 1, 0, 0, 0, 1094, 1097, 1, 0, 0, 0, 1095, 1093, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1099, 1, 0, 0, 0, 1097, 1095, 1, 0, 0, 0, 1098, 1090, 1, 0, 0, 0, 1098, 1099, 1, 0, 0, 0, 1099, 1100, 1, 0, 0, 0, 1100, 1101, 5, 4, 0, 0, 1101, 1103, 1, 0, 0, 0, 1102, 1064, 1, 0, 0, 0, 1102, 1080, 1, 0, 0, 0, 1102, 1086, 1, 0, 0, 0, 1103, 1125, 1, 0, 0, 0, 1104, 1105, 10, 7, 0, 0, 1105, 1106, 5, 47, 0, 0, 1106, 1125, 3, 192, 96, 0, 1107, 1109, 10, 6, 0, 0, 1108, 1110, 5, 104, 0, 0, 1109, 1108, 1, 0, 0, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 1, 0, 0, 0, 1111, 1112, 7, 14, 0, 0, 1112, 1115, 3, 68, 34, 0, 1113, 1114, 5, 69, 0, 0, 1114, 1116, 3, 68, 34, 0, 1115, 1113, 1, 0, 0, 0, 1115, 1116, 1, 0, 0, 0, 1116, 1125, 1, 0, 0, 0, 1117, 1122, 10, 5, 0, 0, 1118, 1123, 5, 95, 0, 0, 1119, 1123, 5, 105, 0, 0, 1120, 1121, 5, 104, 0, 0, 1121, 1123, 5, 106, 0, 0, 1122, 1118, 1, 0, 0, 0, 1122, 1119, 1, 0, 0, 0, 1122, 1120, 1, 0, 0, 0, 1123, 1125, 1, 0, 0, 0, 1124, 1007, 1, 0, 0, 0, 1124, 1010, 1, 0, 0, 0, 1124, 1013, 1, 0, 0, 0, 1124, 1016, 1, 0, 0, 0, 1124, 1019, 1, 0, 0, 0, 1124, 1022, 1, 0, 0, 0, 1124, 1025, 1, 0, 0, 0, 1124, 1044, 1, 0, 0, 0, 1124, 1047, 1, 0, 0, 0, 1124, 1050, 1, 0, 0, 0, 1124, 1059, 1, 0, 0, 0, 1124, 1104, 1, 0, 0, 0, 1124, 1107, 1, 0, 0, 0, 1124, 1117, 1, 0, 0, 0, 1125, 1128, 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1126, 1127, 1, 0, 0, 0, 1127, 69, 1, 0, 0, 0, 1128, 1126, 1, 0, 0, 0, 1129, 1130, 5, 117, 0, 0, 1130, 1135, 5, 3, 0, 0, 1131, 1136, 5, 83, 0, 0, 1132, 1133, 7, 15, 0, 0, 1133, 1134, 5, 5, 0, 0, 1134, 1136, 3, 168, 84, 0, 1135, 1131, 1, 0, 0, 0, 1135, 1132, 1, 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1138, 5, 4, 0, 0, 1138, 71, 1, 0, 0, 0, 1139, 1140, 7, 16, 0, 0, 1140, 73, 1, 0, 0, 0, 1141, 1143, 3, 50, 25, 0, 1142, 1141, 1, 0, 0, 0, 1142, 1143, 1, 0, 0, 0, 1143, 1149, 1, 0, 0, 0, 1144, 1150, 5, 90, 0, 0, 1145, 1150, 5, 124, 0, 0, 1146, 1147, 5, 90, 0, 0, 1147, 1148, 5, 110, 0, 0, 1148, 1150, 7, 8, 0, 0, 1149, 1144, 1, 0, 0, 0, 1149, 1145, 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1150, 1151, 1, 0, 0, 0, 1151, 1155, 5, 93, 0, 0, 1152, 1153, 3, 182, 91, 0, 1153, 1154, 5, 2, 0, 0, 1154, 1156, 1, 0, 0, 0, 1155, 1152, 1, 0, 0, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1157, 1, 0, 0, 0, 1157, 1160, 3, 184, 92, 0, 1158, 1159, 5, 35, 0, 0, 1159, 1161, 3, 208, 104, 0, 1160, 1158, 1, 0, 0, 0, 1160, 1161, 1, 0, 0, 0, 1161, 1173, 1, 0, 0, 0, 1162, 1163, 5, 3, 0, 0, 1163, 1168, 3, 190, 95, 0, 1164, 1165, 5, 5, 0, 0, 1165, 1167, 3, 190, 95, 0, 1166, 1164, 1, 0, 0, 0, 1167, 1170, 1, 0, 0, 0, 1168, 1166, 1, 0, 0, 0, 1168, 1169, 1, 0, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1168, 1, 0, 0, 0, 1171, 1172, 5, 4, 0, 0, 1172, 1174, 1, 0, 0, 0, 1173, 1162, 1, 0, 0, 0, 1173, 1174, 1, 0, 0, 0, 1174, 1206, 1, 0, 0, 0, 1175, 1176, 5, 147, 0, 0, 1176, 1177, 5, 3, 0, 0, 1177, 1182, 3, 68, 34, 0, 1178, 1179, 5, 5, 0, 0, 1179, 1181, 3, 68, 34, 0, 1180, 1178, 1, 0, 0, 0, 1181, 1184, 1, 0, 0, 0, 1182, 1180, 1, 0, 0, 0, 1182, 1183, 1, 0, 0, 0, 1183, 1185, 1, 0, 0, 0, 1184, 1182, 1, 0, 0, 0, 1185, 1200, 5, 4, 0, 0, 1186, 1187, 5, 5, 0, 0, 1187, 1188, 5, 3, 0, 0, 1188, 1193, 3, 68, 34, 0, 1189, 1190, 5, 5, 0, 0, 1190, 1192, 3, 68, 34, 0, 1191, 1189, 1, 0, 0, 0, 1192, 1195, 1, 0, 0, 0, 1193, 1191, 1, 0, 0, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1196, 1, 0, 0, 0, 1195, 1193, 1, 0, 0, 0, 1196, 1197, 5, 4, 0, 0, 1197, 1199, 1, 0, 0, 0, 1198, 1186, 1, 0, 0, 0, 1199, 1202, 1, 0, 0, 0, 1200, 1198, 1, 0, 0, 0, 1200, 1201, 1, 0, 0, 0, 1201, 1207, 1, 0, 0, 0, 1202, 1200, 1, 0, 0, 0, 1203, 1207, 3, 84, 42, 0, 1204, 1205, 5, 58, 0, 0, 1205, 1207, 5, 147, 0, 0, 1206, 1175, 1, 0, 0, 0, 1206, 1203, 1, 0, 0, 0, 1206, 1204, 1, 0, 0, 0, 1207, 1209, 1, 0, 0, 0, 1208, 1210, 3, 76, 38, 0, 1209, 1208, 1, 0, 0, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1212, 1, 0, 0, 0, 1211, 1213, 3, 58, 29, 0, 1212, 1211, 1, 0, 0, 0, 1212, 1213, 1, 0, 0, 0, 1213, 75, 1, 0, 0, 0, 1214, 1215, 5, 109, 0, 0, 1215, 1230, 5, 50, 0, 0, 1216, 1217, 5, 3, 0, 0, 1217, 1222, 3, 24, 12, 0, 1218, 1219, 5, 5, 0, 0, 1219, 1221, 3, 24, 12, 0, 1220, 1218, 1, 0, 0, 0, 1221, 1224, 1, 0, 0, 0, 1222, 1220, 1, 0, 0, 0, 1222, 1223, 1, 0, 0, 0, 1223, 1225, 1, 0, 0, 0, 1224, 1222, 1, 0, 0, 0, 1225, 1228, 5, 4, 0, 0, 1226, 1227, 5, 151, 0, 0, 1227, 1229, 3, 68, 34, 0, 1228, 1226, 1, 0, 0, 0, 1228, 1229, 1, 0, 0, 0, 1229, 1231, 1, 0, 0, 0, 1230, 1216, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1232, 1, 0, 0, 0, 1232, 1259, 5, 186, 0, 0, 1233, 1260, 5, 187, 0, 0, 1234, 1235, 5, 144, 0, 0, 1235, 1238, 5, 133, 0, 0, 1236, 1239, 3, 190, 95, 0, 1237, 1239, 3, 108, 54, 0, 1238, 1236, 1, 0, 0, 0, 1238, 1237, 1, 0, 0, 0, 1239, 1240, 1, 0, 0, 0, 1240, 1241, 5, 6, 0, 0, 1241, 1252, 3, 68, 34, 0, 1242, 1245, 5, 5, 0, 0, 1243, 1246, 3, 190, 95, 0, 1244, 1246, 3, 108, 54, 0, 1245, 1243, 1, 0, 0, 0, 1245, 1244, 1, 0, 0, 0, 1246, 1247, 1, 0, 0, 0, 1247, 1248, 5, 6, 0, 0, 1248, 1249, 3, 68, 34, 0, 1249, 1251, 1, 0, 0, 0, 1250, 1242, 1, 0, 0, 0, 1251, 1254, 1, 0, 0, 0, 1252, 1250, 1, 0, 0, 0, 1252, 1253, 1, 0, 0, 0, 1253, 1257, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, 0, 1255, 1256, 5, 151, 0, 0, 1256, 1258, 3, 68, 34, 0, 1257, 1255, 1, 0, 0, 0, 1257, 1258, 1, 0, 0, 0, 1258, 1260, 1, 0, 0, 0, 1259, 1233, 1, 0, 0, 0, 1259, 1234, 1, 0, 0, 0, 1260, 77, 1, 0, 0, 0, 1261, 1265, 5, 114, 0, 0, 1262, 1263, 3, 182, 91, 0, 1263, 1264, 5, 2, 0, 0, 1264, 1266, 1, 0, 0, 0, 1265, 1262, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1267, 1, 0, 0, 0, 1267, 1274, 3, 204, 102, 0, 1268, 1269, 5, 6, 0, 0, 1269, 1275, 3, 80, 40, 0, 1270, 1271, 5, 3, 0, 0, 1271, 1272, 3, 80, 40, 0, 1272, 1273, 5, 4, 0, 0, 1273, 1275, 1, 0, 0, 0, 1274, 1268, 1, 0, 0, 0, 1274, 1270, 1, 0, 0, 0, 1274, 1275, 1, 0, 0, 0, 1275, 79, 1, 0, 0, 0, 1276, 1280, 3, 36, 18, 0, 1277, 1280, 3, 176, 88, 0, 1278, 1280, 5, 192, 0, 0, 1279, 1276, 1, 0, 0, 0, 1279, 1277, 1, 0, 0, 0, 1279, 1278, 1, 0, 0, 0, 1280, 81, 1, 0, 0, 0, 1281, 1292, 5, 121, 0, 0, 1282, 1293, 3, 192, 96, 0, 1283, 1284, 3, 182, 91, 0, 1284, 1285, 5, 2, 0, 0, 1285, 1287, 1, 0, 0, 0, 1286, 1283, 1, 0, 0, 0, 1286, 1287, 1, 0, 0, 0, 1287, 1290, 1, 0, 0, 0, 1288, 1291, 3, 184, 92, 0, 1289, 1291, 3, 196, 98, 0, 1290, 1288, 1, 0, 0, 0, 1290, 1289, 1, 0, 0, 0, 1291, 1293, 1, 0, 0, 0, 1292, 1282, 1, 0, 0, 0, 1292, 1286, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 83, 1, 0, 0, 0, 1294, 1296, 3, 132, 66, 0, 1295, 1294, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1297, 1, 0, 0, 0, 1297, 1303, 3, 88, 44, 0, 1298, 1299, 3, 104, 52, 0, 1299, 1300, 3, 88, 44, 0, 1300, 1302, 1, 0, 0, 0, 1301, 1298, 1, 0, 0, 0, 1302, 1305, 1, 0, 0, 0, 1303, 1301, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1306, 1308, 3, 134, 67, 0, 1307, 1306, 1, 0, 0, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1310, 1, 0, 0, 0, 1309, 1311, 3, 136, 68, 0, 1310, 1309, 1, 0, 0, 0, 1310, 1311, 1, 0, 0, 0, 1311, 85, 1, 0, 0, 0, 1312, 1319, 3, 96, 48, 0, 1313, 1314, 3, 100, 50, 0, 1314, 1315, 3, 96, 48, 0, 1315, 1316, 3, 102, 51, 0, 1316, 1318, 1, 0, 0, 0, 1317, 1313, 1, 0, 0, 0, 1318, 1321, 1, 0, 0, 0, 1319, 1317, 1, 0, 0, 0, 1319, 1320, 1, 0, 0, 0, 1320, 87, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, 1322, 1324, 5, 132, 0, 0, 1323, 1325, 7, 17, 0, 0, 1324, 1323, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1331, 3, 98, 49, 0, 1327, 1328, 5, 5, 0, 0, 1328, 1330, 3, 98, 49, 0, 1329, 1327, 1, 0, 0, 0, 1330, 1333, 1, 0, 0, 0, 1331, 1329, 1, 0, 0, 0, 1331, 1332, 1, 0, 0, 0, 1332, 1346, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1334, 1344, 5, 77, 0, 0, 1335, 1340, 3, 96, 48, 0, 1336, 1337, 5, 5, 0, 0, 1337, 1339, 3, 96, 48, 0, 1338, 1336, 1, 0, 0, 0, 1339, 1342, 1, 0, 0, 0, 1340, 1338, 1, 0, 0, 0, 1340, 1341, 1, 0, 0, 0, 1341, 1345, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1343, 1345, 3, 86, 43, 0, 1344, 1335, 1, 0, 0, 0, 1344, 1343, 1, 0, 0, 0, 1345, 1347, 1, 0, 0, 0, 1346, 1334, 1, 0, 0, 0, 1346, 1347, 1, 0, 0, 0, 1347, 1350, 1, 0, 0, 0, 1348, 1349, 5, 151, 0, 0, 1349, 1351, 3, 68, 34, 0, 1350, 1348, 1, 0, 0, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1366, 1, 0, 0, 0, 1352, 1353, 5, 80, 0, 0, 1353, 1354, 5, 42, 0, 0, 1354, 1359, 3, 68, 34, 0, 1355, 1356, 5, 5, 0, 0, 1356, 1358, 3, 68, 34, 0, 1357, 1355, 1, 0, 0, 0, 1358, 1361, 1, 0, 0, 0, 1359, 1357, 1, 0, 0, 0, 1359, 1360, 1, 0, 0, 0, 1360, 1364, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1362, 1363, 5, 81, 0, 0, 1363, 1365, 3, 68, 34, 0, 1364, 1362, 1, 0, 0, 0, 1364, 1365, 1, 0, 0, 0, 1365, 1367, 1, 0, 0, 0, 1366, 1352, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, 1382, 1, 0, 0, 0, 1368, 1369, 5, 177, 0, 0, 1369, 1370, 3, 214, 107, 0, 1370, 1371, 5, 35, 0, 0, 1371, 1379, 3, 118, 59, 0, 1372, 1373, 5, 5, 0, 0, 1373, 1374, 3, 214, 107, 0, 1374, 1375, 5, 35, 0, 0, 1375, 1376, 3, 118, 59, 0, 1376, 1378, 1, 0, 0, 0, 1377, 1372, 1, 0, 0, 0, 1378, 1381, 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1383, 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1382, 1368, 1, 0, 0, 0, 1382, 1383, 1, 0, 0, 0, 1383, 1413, 1, 0, 0, 0, 1384, 1385, 5, 147, 0, 0, 1385, 1386, 5, 3, 0, 0, 1386, 1391, 3, 68, 34, 0, 1387, 1388, 5, 5, 0, 0, 1388, 1390, 3, 68, 34, 0, 1389, 1387, 1, 0, 0, 0, 1390, 1393, 1, 0, 0, 0, 1391, 1389, 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 1394, 1, 0, 0, 0, 1393, 1391, 1, 0, 0, 0, 1394, 1409, 5, 4, 0, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1397, 5, 3, 0, 0, 1397, 1402, 3, 68, 34, 0, 1398, 1399, 5, 5, 0, 0, 1399, 1401, 3, 68, 34, 0, 1400, 1398, 1, 0, 0, 0, 1401, 1404, 1, 0, 0, 0, 1402, 1400, 1, 0, 0, 0, 1402, 1403, 1, 0, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1402, 1, 0, 0, 0, 1405, 1406, 5, 4, 0, 0, 1406, 1408, 1, 0, 0, 0, 1407, 1395, 1, 0, 0, 0, 1408, 1411, 1, 0, 0, 0, 1409, 1407, 1, 0, 0, 0, 1409, 1410, 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1412, 1322, 1, 0, 0, 0, 1412, 1384, 1, 0, 0, 0, 1413, 89, 1, 0, 0, 0, 1414, 1415, 3, 84, 42, 0, 1415, 91, 1, 0, 0, 0, 1416, 1418, 3, 132, 66, 0, 1417, 1416, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1419, 1, 0, 0, 0, 1419, 1421, 3, 88, 44, 0, 1420, 1422, 3, 134, 67, 0, 1421, 1420, 1, 0, 0, 0, 1421, 1422, 1, 0, 0, 0, 1422, 1424, 1, 0, 0, 0, 1423, 1425, 3, 136, 68, 0, 1424, 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 93, 1, 0, 0, 0, 1426, 1428, 3, 132, 66, 0, 1427, 1426, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1429, 1, 0, 0, 0, 1429, 1439, 3, 88, 44, 0, 1430, 1432, 5, 142, 0, 0, 1431, 1433, 5, 31, 0, 0, 1432, 1431, 1, 0, 0, 0, 1432, 1433, 1, 0, 0, 0, 1433, 1437, 1, 0, 0, 0, 1434, 1437, 5, 92, 0, 0, 1435, 1437, 5, 70, 0, 0, 1436, 1430, 1, 0, 0, 0, 1436, 1434, 1, 0, 0, 0, 1436, 1435, 1, 0, 0, 0, 1437, 1438, 1, 0, 0, 0, 1438, 1440, 3, 88, 44, 0, 1439, 1436, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1439, 1, 0, 0, 0, 1441, 1442, 1, 0, 0, 0, 1442, 1444, 1, 0, 0, 0, 1443, 1445, 3, 134, 67, 0, 1444, 1443, 1, 0, 0, 0, 1444, 1445, 1, 0, 0, 0, 1445, 1447, 1, 0, 0, 0, 1446, 1448, 3, 136, 68, 0, 1447, 1446, 1, 0, 0, 0, 1447, 1448, 1, 0, 0, 0, 1448, 95, 1, 0, 0, 0, 1449, 1450, 3, 182, 91, 0, 1450, 1451, 5, 2, 0, 0, 1451, 1453, 1, 0, 0, 0, 1452, 1449, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1454, 1, 0, 0, 0, 1454, 1459, 3, 184, 92, 0, 1455, 1457, 5, 35, 0, 0, 1456, 1455, 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1458, 1, 0, 0, 0, 1458, 1460, 3, 208, 104, 0, 1459, 1456, 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1466, 1, 0, 0, 0, 1461, 1462, 5, 87, 0, 0, 1462, 1463, 5, 42, 0, 0, 1463, 1467, 3, 196, 98, 0, 1464, 1465, 5, 104, 0, 0, 1465, 1467, 5, 87, 0, 0, 1466, 1461, 1, 0, 0, 0, 1466, 1464, 1, 0, 0, 0, 1466, 1467, 1, 0, 0, 0, 1467, 1578, 1, 0, 0, 0, 1468, 1469, 3, 182, 91, 0, 1469, 1470, 5, 2, 0, 0, 1470, 1472, 1, 0, 0, 0, 1471, 1468, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 1, 0, 0, 0, 1473, 1474, 3, 226, 113, 0, 1474, 1475, 5, 3, 0, 0, 1475, 1480, 3, 68, 34, 0, 1476, 1477, 5, 5, 0, 0, 1477, 1479, 3, 68, 34, 0, 1478, 1476, 1, 0, 0, 0, 1479, 1482, 1, 0, 0, 0, 1480, 1478, 1, 0, 0, 0, 1480, 1481, 1, 0, 0, 0, 1481, 1483, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1483, 1488, 5, 4, 0, 0, 1484, 1486, 5, 35, 0, 0, 1485, 1484, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1487, 1, 0, 0, 0, 1487, 1489, 3, 208, 104, 0, 1488, 1485, 1, 0, 0, 0, 1488, 1489, 1, 0, 0, 0, 1489, 1578, 1, 0, 0, 0, 1490, 1500, 5, 3, 0, 0, 1491, 1496, 3, 96, 48, 0, 1492, 1493, 5, 5, 0, 0, 1493, 1495, 3, 96, 48, 0, 1494, 1492, 1, 0, 0, 0, 1495, 1498, 1, 0, 0, 0, 1496, 1494, 1, 0, 0, 0, 1496, 1497, 1, 0, 0, 0, 1497, 1501, 1, 0, 0, 0, 1498, 1496, 1, 0, 0, 0, 1499, 1501, 3, 86, 43, 0, 1500, 1491, 1, 0, 0, 0, 1500, 1499, 1, 0, 0, 0, 1501, 1502, 1, 0, 0, 0, 1502, 1503, 5, 4, 0, 0, 1503, 1578, 1, 0, 0, 0, 1504, 1505, 5, 3, 0, 0, 1505, 1506, 3, 84, 42, 0, 1506, 1511, 5, 4, 0, 0, 1507, 1509, 5, 35, 0, 0, 1508, 1507, 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1510, 1, 0, 0, 0, 1510, 1512, 3, 208, 104, 0, 1511, 1508, 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1578, 1, 0, 0, 0, 1513, 1514, 3, 182, 91, 0, 1514, 1515, 5, 2, 0, 0, 1515, 1517, 1, 0, 0, 0, 1516, 1513, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1518, 1, 0, 0, 0, 1518, 1523, 3, 184, 92, 0, 1519, 1521, 5, 35, 0, 0, 1520, 1519, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1522, 1, 0, 0, 0, 1522, 1524, 3, 210, 105, 0, 1523, 1520, 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1530, 1, 0, 0, 0, 1525, 1526, 5, 87, 0, 0, 1526, 1527, 5, 42, 0, 0, 1527, 1531, 3, 196, 98, 0, 1528, 1529, 5, 104, 0, 0, 1529, 1531, 5, 87, 0, 0, 1530, 1525, 1, 0, 0, 0, 1530, 1528, 1, 0, 0, 0, 1530, 1531, 1, 0, 0, 0, 1531, 1578, 1, 0, 0, 0, 1532, 1533, 3, 182, 91, 0, 1533, 1534, 5, 2, 0, 0, 1534, 1536, 1, 0, 0, 0, 1535, 1532, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 1, 0, 0, 0, 1537, 1538, 3, 226, 113, 0, 1538, 1539, 5, 3, 0, 0, 1539, 1544, 3, 68, 34, 0, 1540, 1541, 5, 5, 0, 0, 1541, 1543, 3, 68, 34, 0, 1542, 1540, 1, 0, 0, 0, 1543, 1546, 1, 0, 0, 0, 1544, 1542, 1, 0, 0, 0, 1544, 1545, 1, 0, 0, 0, 1545, 1547, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1547, 1552, 5, 4, 0, 0, 1548, 1550, 5, 35, 0, 0, 1549, 1548, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1551, 1, 0, 0, 0, 1551, 1553, 3, 210, 105, 0, 1552, 1549, 1, 0, 0, 0, 1552, 1553, 1, 0, 0, 0, 1553, 1578, 1, 0, 0, 0, 1554, 1564, 5, 3, 0, 0, 1555, 1560, 3, 96, 48, 0, 1556, 1557, 5, 5, 0, 0, 1557, 1559, 3, 96, 48, 0, 1558, 1556, 1, 0, 0, 0, 1559, 1562, 1, 0, 0, 0, 1560, 1558, 1, 0, 0, 0, 1560, 1561, 1, 0, 0, 0, 1561, 1565, 1, 0, 0, 0, 1562, 1560, 1, 0, 0, 0, 1563, 1565, 3, 86, 43, 0, 1564, 1555, 1, 0, 0, 0, 1564, 1563, 1, 0, 0, 0, 1565, 1566, 1, 0, 0, 0, 1566, 1567, 5, 4, 0, 0, 1567, 1578, 1, 0, 0, 0, 1568, 1569, 5, 3, 0, 0, 1569, 1570, 3, 84, 42, 0, 1570, 1575, 5, 4, 0, 0, 1571, 1573, 5, 35, 0, 0, 1572, 1571, 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1574, 1, 0, 0, 0, 1574, 1576, 3, 210, 105, 0, 1575, 1572, 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 1, 0, 0, 0, 1577, 1452, 1, 0, 0, 0, 1577, 1471, 1, 0, 0, 0, 1577, 1490, 1, 0, 0, 0, 1577, 1504, 1, 0, 0, 0, 1577, 1516, 1, 0, 0, 0, 1577, 1535, 1, 0, 0, 0, 1577, 1554, 1, 0, 0, 0, 1577, 1568, 1, 0, 0, 0, 1578, 97, 1, 0, 0, 0, 1579, 1592, 5, 7, 0, 0, 1580, 1581, 3, 184, 92, 0, 1581, 1582, 5, 2, 0, 0, 1582, 1583, 5, 7, 0, 0, 1583, 1592, 1, 0, 0, 0, 1584, 1589, 3, 68, 34, 0, 1585, 1587, 5, 35, 0, 0, 1586, 1585, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1588, 1, 0, 0, 0, 1588, 1590, 3, 172, 86, 0, 1589, 1586, 1, 0, 0, 0, 1589, 1590, 1, 0, 0, 0, 1590, 1592, 1, 0, 0, 0, 1591, 1579, 1, 0, 0, 0, 1591, 1580, 1, 0, 0, 0, 1591, 1584, 1, 0, 0, 0, 1592, 99, 1, 0, 0, 0, 1593, 1608, 5, 5, 0, 0, 1594, 1596, 5, 102, 0, 0, 1595, 1594, 1, 0, 0, 0, 1595, 1596, 1, 0, 0, 0, 1596, 1602, 1, 0, 0, 0, 1597, 1599, 7, 18, 0, 0, 1598, 1600, 5, 112, 0, 0, 1599, 1598, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1603, 1, 0, 0, 0, 1601, 1603, 5, 89, 0, 0, 1602, 1597, 1, 0, 0, 0, 1602, 1601, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1604, 1, 0, 0, 0, 1604, 1608, 5, 96, 0, 0, 1605, 1606, 5, 53, 0, 0, 1606, 1608, 5, 96, 0, 0, 1607, 1593, 1, 0, 0, 0, 1607, 1595, 1, 0, 0, 0, 1607, 1605, 1, 0, 0, 0, 1608, 101, 1, 0, 0, 0, 1609, 1610, 5, 109, 0, 0, 1610, 1624, 3, 68, 34, 0, 1611, 1612, 5, 145, 0, 0, 1612, 1613, 5, 3, 0, 0, 1613, 1618, 3, 190, 95, 0, 1614, 1615, 5, 5, 0, 0, 1615, 1617, 3, 190, 95, 0, 1616, 1614, 1, 0, 0, 0, 1617, 1620, 1, 0, 0, 0, 1618, 1616, 1, 0, 0, 0, 1618, 1619, 1, 0, 0, 0, 1619, 1621, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1621, 1622, 5, 4, 0, 0, 1622, 1624, 1, 0, 0, 0, 1623, 1609, 1, 0, 0, 0, 1623, 1611, 1, 0, 0, 0, 1623, 1624, 1, 0, 0, 0, 1624, 103, 1, 0, 0, 0, 1625, 1627, 5, 142, 0, 0, 1626, 1628, 5, 31, 0, 0, 1627, 1626, 1, 0, 0, 0, 1627, 1628, 1, 0, 0, 0, 1628, 1632, 1, 0, 0, 0, 1629, 1632, 5, 92, 0, 0, 1630, 1632, 5, 70, 0, 0, 1631, 1625, 1, 0, 0, 0, 1631, 1629, 1, 0, 0, 0, 1631, 1630, 1, 0, 0, 0, 1632, 105, 1, 0, 0, 0, 1633, 1635, 3, 50, 25, 0, 1634, 1633, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1636, 1, 0, 0, 0, 1636, 1639, 5, 144, 0, 0, 1637, 1638, 5, 110, 0, 0, 1638, 1640, 7, 8, 0, 0, 1639, 1637, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 1, 0, 0, 0, 1641, 1642, 3, 112, 56, 0, 1642, 1645, 5, 133, 0, 0, 1643, 1646, 3, 190, 95, 0, 1644, 1646, 3, 108, 54, 0, 1645, 1643, 1, 0, 0, 0, 1645, 1644, 1, 0, 0, 0, 1646, 1647, 1, 0, 0, 0, 1647, 1648, 5, 6, 0, 0, 1648, 1659, 3, 68, 34, 0, 1649, 1652, 5, 5, 0, 0, 1650, 1653, 3, 190, 95, 0, 1651, 1653, 3, 108, 54, 0, 1652, 1650, 1, 0, 0, 0, 1652, 1651, 1, 0, 0, 0, 1653, 1654, 1, 0, 0, 0, 1654, 1655, 5, 6, 0, 0, 1655, 1656, 3, 68, 34, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1649, 1, 0, 0, 0, 1658, 1661, 1, 0, 0, 0, 1659, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1664, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1662, 1663, 5, 151, 0, 0, 1663, 1665, 3, 68, 34, 0, 1664, 1662, 1, 0, 0, 0, 1664, 1665, 1, 0, 0, 0, 1665, 1667, 1, 0, 0, 0, 1666, 1668, 3, 58, 29, 0, 1667, 1666, 1, 0, 0, 0, 1667, 1668, 1, 0, 0, 0, 1668, 107, 1, 0, 0, 0, 1669, 1670, 5, 3, 0, 0, 1670, 1675, 3, 190, 95, 0, 1671, 1672, 5, 5, 0, 0, 1672, 1674, 3, 190, 95, 0, 1673, 1671, 1, 0, 0, 0, 1674, 1677, 1, 0, 0, 0, 1675, 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1678, 1679, 5, 4, 0, 0, 1679, 109, 1, 0, 0, 0, 1680, 1682, 3, 50, 25, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1683, 1, 0, 0, 0, 1683, 1686, 5, 144, 0, 0, 1684, 1685, 5, 110, 0, 0, 1685, 1687, 7, 8, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, 1, 0, 0, 0, 1688, 1689, 3, 112, 56, 0, 1689, 1692, 5, 133, 0, 0, 1690, 1693, 3, 190, 95, 0, 1691, 1693, 3, 108, 54, 0, 1692, 1690, 1, 0, 0, 0, 1692, 1691, 1, 0, 0, 0, 1693, 1694, 1, 0, 0, 0, 1694, 1695, 5, 6, 0, 0, 1695, 1706, 3, 68, 34, 0, 1696, 1699, 5, 5, 0, 0, 1697, 1700, 3, 190, 95, 0, 1698, 1700, 3, 108, 54, 0, 1699, 1697, 1, 0, 0, 0, 1699, 1698, 1, 0, 0, 0, 1700, 1701, 1, 0, 0, 0, 1701, 1702, 5, 6, 0, 0, 1702, 1703, 3, 68, 34, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1696, 1, 0, 0, 0, 1705, 1708, 1, 0, 0, 0, 1706, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1711, 1, 0, 0, 0, 1708, 1706, 1, 0, 0, 0, 1709, 1710, 5, 151, 0, 0, 1710, 1712, 3, 68, 34, 0, 1711, 1709, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1717, 1, 0, 0, 0, 1713, 1715, 3, 134, 67, 0, 1714, 1713, 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 1718, 3, 136, 68, 0, 1717, 1714, 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 111, 1, 0, 0, 0, 1719, 1720, 3, 182, 91, 0, 1720, 1721, 5, 2, 0, 0, 1721, 1723, 1, 0, 0, 0, 1722, 1719, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1724, 1, 0, 0, 0, 1724, 1727, 3, 184, 92, 0, 1725, 1726, 5, 35, 0, 0, 1726, 1728, 3, 216, 108, 0, 1727, 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1734, 1, 0, 0, 0, 1729, 1730, 5, 87, 0, 0, 1730, 1731, 5, 42, 0, 0, 1731, 1735, 3, 196, 98, 0, 1732, 1733, 5, 104, 0, 0, 1733, 1735, 5, 87, 0, 0, 1734, 1729, 1, 0, 0, 0, 1734, 1732, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 113, 1, 0, 0, 0, 1736, 1738, 5, 146, 0, 0, 1737, 1739, 3, 182, 91, 0, 1738, 1737, 1, 0, 0, 0, 1738, 1739, 1, 0, 0, 0, 1739, 1742, 1, 0, 0, 0, 1740, 1741, 5, 93, 0, 0, 1741, 1743, 3, 218, 109, 0, 1742, 1740, 1, 0, 0, 0, 1742, 1743, 1, 0, 0, 0, 1743, 115, 1, 0, 0, 0, 1744, 1745, 5, 181, 0, 0, 1745, 1746, 5, 3, 0, 0, 1746, 1747, 5, 151, 0, 0, 1747, 1748, 3, 68, 34, 0, 1748, 1749, 5, 4, 0, 0, 1749, 117, 1, 0, 0, 0, 1750, 1752, 5, 3, 0, 0, 1751, 1753, 3, 220, 110, 0, 1752, 1751, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 1764, 1, 0, 0, 0, 1754, 1755, 5, 156, 0, 0, 1755, 1756, 5, 42, 0, 0, 1756, 1761, 3, 68, 34, 0, 1757, 1758, 5, 5, 0, 0, 1758, 1760, 3, 68, 34, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1763, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1761, 1762, 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1764, 1754, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 1, 0, 0, 0, 1766, 1767, 5, 111, 0, 0, 1767, 1768, 5, 42, 0, 0, 1768, 1773, 3, 138, 69, 0, 1769, 1770, 5, 5, 0, 0, 1770, 1772, 3, 138, 69, 0, 1771, 1769, 1, 0, 0, 0, 1772, 1775, 1, 0, 0, 0, 1773, 1771, 1, 0, 0, 0, 1773, 1774, 1, 0, 0, 0, 1774, 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1776, 1778, 3, 122, 61, 0, 1777, 1776, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 1, 0, 0, 0, 1779, 1780, 5, 4, 0, 0, 1780, 119, 1, 0, 0, 0, 1781, 1815, 5, 155, 0, 0, 1782, 1816, 3, 214, 107, 0, 1783, 1785, 5, 3, 0, 0, 1784, 1786, 3, 220, 110, 0, 1785, 1784, 1, 0, 0, 0, 1785, 1786, 1, 0, 0, 0, 1786, 1797, 1, 0, 0, 0, 1787, 1788, 5, 156, 0, 0, 1788, 1789, 5, 42, 0, 0, 1789, 1794, 3, 68, 34, 0, 1790, 1791, 5, 5, 0, 0, 1791, 1793, 3, 68, 34, 0, 1792, 1790, 1, 0, 0, 0, 1793, 1796, 1, 0, 0, 0, 1794, 1792, 1, 0, 0, 0, 1794, 1795, 1, 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1797, 1787, 1, 0, 0, 0, 1797, 1798, 1, 0, 0, 0, 1798, 1809, 1, 0, 0, 0, 1799, 1800, 5, 111, 0, 0, 1800, 1801, 5, 42, 0, 0, 1801, 1806, 3, 138, 69, 0, 1802, 1803, 5, 5, 0, 0, 1803, 1805, 3, 138, 69, 0, 1804, 1802, 1, 0, 0, 0, 1805, 1808, 1, 0, 0, 0, 1806, 1804, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1810, 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1809, 1799, 1, 0, 0, 0, 1809, 1810, 1, 0, 0, 0, 1810, 1812, 1, 0, 0, 0, 1811, 1813, 3, 122, 61, 0, 1812, 1811, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1814, 1, 0, 0, 0, 1814, 1816, 5, 4, 0, 0, 1815, 1782, 1, 0, 0, 0, 1815, 1783, 1, 0, 0, 0, 1816, 121, 1, 0, 0, 0, 1817, 1825, 3, 124, 62, 0, 1818, 1819, 5, 183, 0, 0, 1819, 1820, 5, 103, 0, 0, 1820, 1826, 5, 185, 0, 0, 1821, 1822, 5, 160, 0, 0, 1822, 1826, 5, 129, 0, 0, 1823, 1826, 5, 80, 0, 0, 1824, 1826, 5, 184, 0, 0, 1825, 1818, 1, 0, 0, 0, 1825, 1821, 1, 0, 0, 0, 1825, 1823, 1, 0, 0, 0, 1825, 1824, 1, 0, 0, 0, 1825, 1826, 1, 0, 0, 0, 1826, 123, 1, 0, 0, 0, 1827, 1834, 7, 19, 0, 0, 1828, 1835, 3, 146, 73, 0, 1829, 1830, 5, 41, 0, 0, 1830, 1831, 3, 142, 71, 0, 1831, 1832, 5, 34, 0, 0, 1832, 1833, 3, 144, 72, 0, 1833, 1835, 1, 0, 0, 0, 1834, 1828, 1, 0, 0, 0, 1834, 1829, 1, 0, 0, 0, 1835, 125, 1, 0, 0, 0, 1836, 1837, 3, 222, 111, 0, 1837, 1847, 5, 3, 0, 0, 1838, 1843, 3, 68, 34, 0, 1839, 1840, 5, 5, 0, 0, 1840, 1842, 3, 68, 34, 0, 1841, 1839, 1, 0, 0, 0, 1842, 1845, 1, 0, 0, 0, 1843, 1841, 1, 0, 0, 0, 1843, 1844, 1, 0, 0, 0, 1844, 1848, 1, 0, 0, 0, 1845, 1843, 1, 0, 0, 0, 1846, 1848, 5, 7, 0, 0, 1847, 1838, 1, 0, 0, 0, 1847, 1846, 1, 0, 0, 0, 1848, 1849, 1, 0, 0, 0, 1849, 1850, 5, 4, 0, 0, 1850, 127, 1, 0, 0, 0, 1851, 1852, 3, 224, 112, 0, 1852, 1865, 5, 3, 0, 0, 1853, 1855, 5, 64, 0, 0, 1854, 1853, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1856, 1, 0, 0, 0, 1856, 1861, 3, 68, 34, 0, 1857, 1858, 5, 5, 0, 0, 1858, 1860, 3, 68, 34, 0, 1859, 1857, 1, 0, 0, 0, 1860, 1863, 1, 0, 0, 0, 1861, 1859, 1, 0, 0, 0, 1861, 1862, 1, 0, 0, 0, 1862, 1866, 1, 0, 0, 0, 1863, 1861, 1, 0, 0, 0, 1864, 1866, 5, 7, 0, 0, 1865, 1854, 1, 0, 0, 0, 1865, 1864, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, 1869, 5, 4, 0, 0, 1868, 1870, 3, 116, 58, 0, 1869, 1868, 1, 0, 0, 0, 1869, 1870, 1, 0, 0, 0, 1870, 129, 1, 0, 0, 0, 1871, 1872, 3, 148, 74, 0, 1872, 1882, 5, 3, 0, 0, 1873, 1878, 3, 68, 34, 0, 1874, 1875, 5, 5, 0, 0, 1875, 1877, 3, 68, 34, 0, 1876, 1874, 1, 0, 0, 0, 1877, 1880, 1, 0, 0, 0, 1878, 1876, 1, 0, 0, 0, 1878, 1879, 1, 0, 0, 0, 1879, 1883, 1, 0, 0, 0, 1880, 1878, 1, 0, 0, 0, 1881, 1883, 5, 7, 0, 0, 1882, 1873, 1, 0, 0, 0, 1882, 1881, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1886, 5, 4, 0, 0, 1885, 1887, 3, 116, 58, 0, 1886, 1885, 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1888, 1, 0, 0, 0, 1888, 1891, 5, 155, 0, 0, 1889, 1892, 3, 118, 59, 0, 1890, 1892, 3, 214, 107, 0, 1891, 1889, 1, 0, 0, 0, 1891, 1890, 1, 0, 0, 0, 1892, 131, 1, 0, 0, 0, 1893, 1895, 5, 152, 0, 0, 1894, 1896, 5, 118, 0, 0, 1895, 1894, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, 1897, 1, 0, 0, 0, 1897, 1902, 3, 56, 28, 0, 1898, 1899, 5, 5, 0, 0, 1899, 1901, 3, 56, 28, 0, 1900, 1898, 1, 0, 0, 0, 1901, 1904, 1, 0, 0, 0, 1902, 1900, 1, 0, 0, 0, 1902, 1903, 1, 0, 0, 0, 1903, 133, 1, 0, 0, 0, 1904, 1902, 1, 0, 0, 0, 1905, 1906, 5, 111, 0, 0, 1906, 1907, 5, 42, 0, 0, 1907, 1912, 3, 138, 69, 0, 1908, 1909, 5, 5, 0, 0, 1909, 1911, 3, 138, 69, 0, 1910, 1908, 1, 0, 0, 0, 1911, 1914, 1, 0, 0, 0, 1912, 1910, 1, 0, 0, 0, 1912, 1913, 1, 0, 0, 0, 1913, 135, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, 1915, 1916, 5, 100, 0, 0, 1916, 1919, 3, 68, 34, 0, 1917, 1918, 7, 20, 0, 0, 1918, 1920, 3, 68, 34, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1920, 1, 0, 0, 0, 1920, 137, 1, 0, 0, 0, 1921, 1924, 3, 68, 34, 0, 1922, 1923, 5, 47, 0, 0, 1923, 1925, 3, 192, 96, 0, 1924, 1922, 1, 0, 0, 0, 1924, 1925, 1, 0, 0, 0, 1925, 1927, 1, 0, 0, 0, 1926, 1928, 3, 140, 70, 0, 1927, 1926, 1, 0, 0, 0, 1927, 1928, 1, 0, 0, 0, 1928, 1931, 1, 0, 0, 0, 1929, 1930, 5, 178, 0, 0, 1930, 1932, 7, 21, 0, 0, 1931, 1929, 1, 0, 0, 0, 1931, 1932, 1, 0, 0, 0, 1932, 139, 1, 0, 0, 0, 1933, 1934, 7, 22, 0, 0, 1934, 141, 1, 0, 0, 0, 1935, 1936, 3, 68, 34, 0, 1936, 1937, 5, 158, 0, 0, 1937, 1946, 1, 0, 0, 0, 1938, 1939, 3, 68, 34, 0, 1939, 1940, 5, 161, 0, 0, 1940, 1946, 1, 0, 0, 0, 1941, 1942, 5, 160, 0, 0, 1942, 1946, 5, 129, 0, 0, 1943, 1944, 5, 159, 0, 0, 1944, 1946, 5, 158, 0, 0, 1945, 1935, 1, 0, 0, 0, 1945, 1938, 1, 0, 0, 0, 1945, 1941, 1, 0, 0, 0, 1945, 1943, 1, 0, 0, 0, 1946, 143, 1, 0, 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 158, 0, 0, 1949, 1958, 1, 0, 0, 0, 1950, 1951, 3, 68, 34, 0, 1951, 1952, 5, 161, 0, 0, 1952, 1958, 1, 0, 0, 0, 1953, 1954, 5, 160, 0, 0, 1954, 1958, 5, 129, 0, 0, 1955, 1956, 5, 159, 0, 0, 1956, 1958, 5, 161, 0, 0, 1957, 1947, 1, 0, 0, 0, 1957, 1950, 1, 0, 0, 0, 1957, 1953, 1, 0, 0, 0, 1957, 1955, 1, 0, 0, 0, 1958, 145, 1, 0, 0, 0, 1959, 1960, 3, 68, 34, 0, 1960, 1961, 5, 158, 0, 0, 1961, 1967, 1, 0, 0, 0, 1962, 1963, 5, 159, 0, 0, 1963, 1967, 5, 158, 0, 0, 1964, 1965, 5, 160, 0, 0, 1965, 1967, 5, 129, 0, 0, 1966, 1959, 1, 0, 0, 0, 1966, 1962, 1, 0, 0, 0, 1966, 1964, 1, 0, 0, 0, 1967, 147, 1, 0, 0, 0, 1968, 1969, 7, 23, 0, 0, 1969, 1970, 5, 3, 0, 0, 1970, 1971, 3, 68, 34, 0, 1971, 1972, 5, 4, 0, 0, 1972, 1973, 5, 155, 0, 0, 1973, 1975, 5, 3, 0, 0, 1974, 1976, 3, 154, 77, 0, 1975, 1974, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1977, 1, 0, 0, 0, 1977, 1979, 3, 158, 79, 0, 1978, 1980, 3, 124, 62, 0, 1979, 1978, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 1, 0, 0, 0, 1981, 1982, 5, 4, 0, 0, 1982, 2054, 1, 0, 0, 0, 1983, 1984, 7, 24, 0, 0, 1984, 1985, 5, 3, 0, 0, 1985, 1986, 5, 4, 0, 0, 1986, 1987, 5, 155, 0, 0, 1987, 1989, 5, 3, 0, 0, 1988, 1990, 3, 154, 77, 0, 1989, 1988, 1, 0, 0, 0, 1989, 1990, 1, 0, 0, 0, 1990, 1992, 1, 0, 0, 0, 1991, 1993, 3, 156, 78, 0, 1992, 1991, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 1994, 1, 0, 0, 0, 1994, 2054, 5, 4, 0, 0, 1995, 1996, 7, 25, 0, 0, 1996, 1997, 5, 3, 0, 0, 1997, 1998, 5, 4, 0, 0, 1998, 1999, 5, 155, 0, 0, 1999, 2001, 5, 3, 0, 0, 2000, 2002, 3, 154, 77, 0, 2001, 2000, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, 2003, 1, 0, 0, 0, 2003, 2004, 3, 158, 79, 0, 2004, 2005, 5, 4, 0, 0, 2005, 2054, 1, 0, 0, 0, 2006, 2007, 7, 26, 0, 0, 2007, 2008, 5, 3, 0, 0, 2008, 2010, 3, 68, 34, 0, 2009, 2011, 3, 150, 75, 0, 2010, 2009, 1, 0, 0, 0, 2010, 2011, 1, 0, 0, 0, 2011, 2013, 1, 0, 0, 0, 2012, 2014, 3, 152, 76, 0, 2013, 2012, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 1, 0, 0, 0, 2015, 2016, 5, 4, 0, 0, 2016, 2017, 5, 155, 0, 0, 2017, 2019, 5, 3, 0, 0, 2018, 2020, 3, 154, 77, 0, 2019, 2018, 1, 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 1, 0, 0, 0, 2021, 2022, 3, 158, 79, 0, 2022, 2023, 5, 4, 0, 0, 2023, 2054, 1, 0, 0, 0, 2024, 2025, 5, 167, 0, 0, 2025, 2026, 5, 3, 0, 0, 2026, 2027, 3, 68, 34, 0, 2027, 2028, 5, 5, 0, 0, 2028, 2029, 3, 36, 18, 0, 2029, 2030, 5, 4, 0, 0, 2030, 2031, 5, 155, 0, 0, 2031, 2033, 5, 3, 0, 0, 2032, 2034, 3, 154, 77, 0, 2033, 2032, 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2037, 3, 158, 79, 0, 2036, 2038, 3, 124, 62, 0, 2037, 2036, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, 1, 0, 0, 0, 2039, 2040, 5, 4, 0, 0, 2040, 2054, 1, 0, 0, 0, 2041, 2042, 5, 168, 0, 0, 2042, 2043, 5, 3, 0, 0, 2043, 2044, 3, 68, 34, 0, 2044, 2045, 5, 4, 0, 0, 2045, 2046, 5, 155, 0, 0, 2046, 2048, 5, 3, 0, 0, 2047, 2049, 3, 154, 77, 0, 2048, 2047, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, 1, 0, 0, 0, 2050, 2051, 3, 158, 79, 0, 2051, 2052, 5, 4, 0, 0, 2052, 2054, 1, 0, 0, 0, 2053, 1968, 1, 0, 0, 0, 2053, 1983, 1, 0, 0, 0, 2053, 1995, 1, 0, 0, 0, 2053, 2006, 1, 0, 0, 0, 2053, 2024, 1, 0, 0, 0, 2053, 2041, 1, 0, 0, 0, 2054, 149, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, 3, 36, 18, 0, 2057, 151, 1, 0, 0, 0, 2058, 2059, 5, 5, 0, 0, 2059, 2060, 3, 36, 18, 0, 2060, 153, 1, 0, 0, 0, 2061, 2062, 5, 156, 0, 0, 2062, 2064, 5, 42, 0, 0, 2063, 2065, 3, 68, 34, 0, 2064, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 2064, 1, 0, 0, 0, 2066, 2067, 1, 0, 0, 0, 2067, 155, 1, 0, 0, 0, 2068, 2069, 5, 111, 0, 0, 2069, 2071, 5, 42, 0, 0, 2070, 2072, 3, 68, 34, 0, 2071, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 2071, 1, 0, 0, 0, 2073, 2074, 1, 0, 0, 0, 2074, 157, 1, 0, 0, 0, 2075, 2076, 5, 111, 0, 0, 2076, 2077, 5, 42, 0, 0, 2077, 2078, 3, 158, 79, 0, 2078, 159, 1, 0, 0, 0, 2079, 2081, 3, 68, 34, 0, 2080, 2082, 3, 140, 70, 0, 2081, 2080, 1, 0, 0, 0, 2081, 2082, 1, 0, 0, 0, 2082, 2090, 1, 0, 0, 0, 2083, 2084, 5, 5, 0, 0, 2084, 2086, 3, 68, 34, 0, 2085, 2087, 3, 140, 70, 0, 2086, 2085, 1, 0, 0, 0, 2086, 2087, 1, 0, 0, 0, 2087, 2089, 1, 0, 0, 0, 2088, 2083, 1, 0, 0, 0, 2089, 2092, 1, 0, 0, 0, 2090, 2088, 1, 0, 0, 0, 2090, 2091, 1, 0, 0, 0, 2091, 161, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, 2093, 2094, 3, 84, 42, 0, 2094, 163, 1, 0, 0, 0, 2095, 2096, 3, 84, 42, 0, 2096, 165, 1, 0, 0, 0, 2097, 2098, 7, 27, 0, 0, 2098, 167, 1, 0, 0, 0, 2099, 2100, 5, 192, 0, 0, 2100, 169, 1, 0, 0, 0, 2101, 2104, 3, 68, 34, 0, 2102, 2104, 3, 30, 15, 0, 2103, 2101, 1, 0, 0, 0, 2103, 2102, 1, 0, 0, 0, 2104, 171, 1, 0, 0, 0, 2105, 2106, 7, 28, 0, 0, 2106, 173, 1, 0, 0, 0, 2107, 2108, 7, 29, 0, 0, 2108, 175, 1, 0, 0, 0, 2109, 2110, 3, 228, 114, 0, 2110, 177, 1, 0, 0, 0, 2111, 2112, 3, 228, 114, 0, 2112, 179, 1, 0, 0, 0, 2113, 2114, 3, 182, 91, 0, 2114, 2115, 5, 2, 0, 0, 2115, 2117, 1, 0, 0, 0, 2116, 2113, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, 1, 0, 0, 0, 2118, 2119, 3, 178, 89, 0, 2119, 181, 1, 0, 0, 0, 2120, 2121, 3, 228, 114, 0, 2121, 183, 1, 0, 0, 0, 2122, 2123, 3, 228, 114, 0, 2123, 185, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, 187, 1, 0, 0, 0, 2126, 2127, 3, 228, 114, 0, 2127, 189, 1, 0, 0, 0, 2128, 2129, 3, 228, 114, 0, 2129, 191, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, 2131, 193, 1, 0, 0, 0, 2132, 2133, 3, 228, 114, 0, 2133, 195, 1, 0, 0, 0, 2134, 2135, 3, 228, 114, 0, 2135, 197, 1, 0, 0, 0, 2136, 2137, 3, 228, 114, 0, 2137, 199, 1, 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 201, 1, 0, 0, 0, 2140, 2141, 3, 228, 114, 0, 2141, 203, 1, 0, 0, 0, 2142, 2143, 3, 228, 114, 0, 2143, 205, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, 207, 1, 0, 0, 0, 2146, 2147, 7, 28, 0, 0, 2147, 209, 1, 0, 0, 0, 2148, 2149, 3, 228, 114, 0, 2149, 211, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, 213, 1, 0, 0, 0, 2152, 2153, 3, 228, 114, 0, 2153, 215, 1, 0, 0, 0, 2154, 2155, 3, 228, 114, 0, 2155, 217, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, 2157, 219, 1, 0, 0, 0, 2158, 2159, 3, 228, 114, 0, 2159, 221, 1, 0, 0, 0, 2160, 2161, 3, 228, 114, 0, 2161, 223, 1, 0, 0, 0, 2162, 2163, 3, 228, 114, 0, 2163, 225, 1, 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 227, 1, 0, 0, 0, 2166, 2174, 5, 188, 0, 0, 2167, 2174, 3, 174, 87, 0, 2168, 2174, 5, 192, 0, 0, 2169, 2170, 5, 3, 0, 0, 2170, 2171, 3, 228, 114, 0, 2171, 2172, 5, 4, 0, 0, 2172, 2174, 1, 0, 0, 0, 2173, 2166, 1, 0, 0, 0, 2173, 2167, 1, 0, 0, 0, 2173, 2168, 1, 0, 0, 0, 2173, 2169, 1, 0, 0, 0, 2174, 229, 1, 0, 0, 0, 313, 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, 1034, 1041, 1052, 1061, 1071, 1074, 1080, 1086, 1095, 1098, 1102, 1109, 1115, 1122, 1124, 1126, 1135, 1142, 1149, 1155, 1160, 1168, 1173, 1182, 1193, 1200, 1206, 1209, 1212, 1222, 1228, 1230, 1238, 1245, 1252, 1257, 1259, 1265, 1274, 1279, 1286, 1290, 1292, 1295, 1303, 1307, 1310, 1319, 1324, 1331, 1340, 1344, 1346, 1350, 1359, 1364, 1366, 1379, 1382, 1391, 1402, 1409, 1412, 1417, 1421, 1424, 1427, 1432, 1436, 1441, 1444, 1447, 1452, 1456, 1459, 1466, 1471, 1480, 1485, 1488, 1496, 1500, 1508, 1511, 1516, 1520, 1523, 1530, 1535, 1544, 1549, 1552, 1560, 1564, 1572, 1575, 1577, 1586, 1589, 1591, 1595, 1599, 1602, 1607, 1618, 1623, 1627, 1631, 1634, 1639, 1645, 1652, 1659, 1664, 1667, 1675, 1681, 1686, 1692, 1699, 1706, 1711, 1714, 1717, 1722, 1727, 1734, 1738, 1742, 1752, 1761, 1764, 1773, 1777, 1785, 1794, 1797, 1806, 1809, 1812, 1815, 1825, 1834, 1843, 1847, 1854, 1861, 1865, 1869, 1878, 1882, 1886, 1891, 1895, 1902, 1912, 1919, 1924, 1927, 1931, 1945, 1957, 1966, 1975, 1979, 1989, 1992, 2001, 2010, 2013, 2019, 2033, 2037, 2048, 2053, 2066, 2073, 2081, 2086, 2090, 2103, 2116, 2173] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLiteParser.tokens b/internal/engine/sqlite/parser/SQLiteParser.tokens new file mode 100644 index 0000000000..6777c57bdc --- /dev/null +++ b/internal/engine/sqlite/parser/SQLiteParser.tokens @@ -0,0 +1,223 @@ +SCOL=1 +DOT=2 +OPEN_PAR=3 +CLOSE_PAR=4 +COMMA=5 +ASSIGN=6 +STAR=7 +PLUS=8 +PTR2=9 +PTR=10 +MINUS=11 +TILDE=12 +PIPE2=13 +DIV=14 +MOD=15 +LT2=16 +GT2=17 +AMP=18 +PIPE=19 +LT=20 +LT_EQ=21 +GT=22 +GT_EQ=23 +EQ=24 +NOT_EQ1=25 +NOT_EQ2=26 +ABORT_=27 +ACTION_=28 +ADD_=29 +AFTER_=30 +ALL_=31 +ALTER_=32 +ANALYZE_=33 +AND_=34 +AS_=35 +ASC_=36 +ATTACH_=37 +AUTOINCREMENT_=38 +BEFORE_=39 +BEGIN_=40 +BETWEEN_=41 +BY_=42 +CASCADE_=43 +CASE_=44 +CAST_=45 +CHECK_=46 +COLLATE_=47 +COLUMN_=48 +COMMIT_=49 +CONFLICT_=50 +CONSTRAINT_=51 +CREATE_=52 +CROSS_=53 +CURRENT_DATE_=54 +CURRENT_TIME_=55 +CURRENT_TIMESTAMP_=56 +DATABASE_=57 +DEFAULT_=58 +DEFERRABLE_=59 +DEFERRED_=60 +DELETE_=61 +DESC_=62 +DETACH_=63 +DISTINCT_=64 +DROP_=65 +EACH_=66 +ELSE_=67 +END_=68 +ESCAPE_=69 +EXCEPT_=70 +EXCLUSIVE_=71 +EXISTS_=72 +EXPLAIN_=73 +FAIL_=74 +FOR_=75 +FOREIGN_=76 +FROM_=77 +FULL_=78 +GLOB_=79 +GROUP_=80 +HAVING_=81 +IF_=82 +IGNORE_=83 +IMMEDIATE_=84 +IN_=85 +INDEX_=86 +INDEXED_=87 +INITIALLY_=88 +INNER_=89 +INSERT_=90 +INSTEAD_=91 +INTERSECT_=92 +INTO_=93 +IS_=94 +ISNULL_=95 +JOIN_=96 +KEY_=97 +LEFT_=98 +LIKE_=99 +LIMIT_=100 +MATCH_=101 +NATURAL_=102 +NO_=103 +NOT_=104 +NOTNULL_=105 +NULL_=106 +OF_=107 +OFFSET_=108 +ON_=109 +OR_=110 +ORDER_=111 +OUTER_=112 +PLAN_=113 +PRAGMA_=114 +PRIMARY_=115 +QUERY_=116 +RAISE_=117 +RECURSIVE_=118 +REFERENCES_=119 +REGEXP_=120 +REINDEX_=121 +RELEASE_=122 +RENAME_=123 +REPLACE_=124 +RESTRICT_=125 +RETURNING_=126 +RIGHT_=127 +ROLLBACK_=128 +ROW_=129 +ROWS_=130 +SAVEPOINT_=131 +SELECT_=132 +SET_=133 +STRICT_=134 +TABLE_=135 +TEMP_=136 +TEMPORARY_=137 +THEN_=138 +TO_=139 +TRANSACTION_=140 +TRIGGER_=141 +UNION_=142 +UNIQUE_=143 +UPDATE_=144 +USING_=145 +VACUUM_=146 +VALUES_=147 +VIEW_=148 +VIRTUAL_=149 +WHEN_=150 +WHERE_=151 +WITH_=152 +WITHOUT_=153 +FIRST_VALUE_=154 +OVER_=155 +PARTITION_=156 +RANGE_=157 +PRECEDING_=158 +UNBOUNDED_=159 +CURRENT_=160 +FOLLOWING_=161 +CUME_DIST_=162 +DENSE_RANK_=163 +LAG_=164 +LAST_VALUE_=165 +LEAD_=166 +NTH_VALUE_=167 +NTILE_=168 +PERCENT_RANK_=169 +RANK_=170 +ROW_NUMBER_=171 +GENERATED_=172 +ALWAYS_=173 +STORED_=174 +TRUE_=175 +FALSE_=176 +WINDOW_=177 +NULLS_=178 +FIRST_=179 +LAST_=180 +FILTER_=181 +GROUPS_=182 +EXCLUDE_=183 +TIES_=184 +OTHERS_=185 +DO_=186 +NOTHING_=187 +IDENTIFIER=188 +NUMERIC_LITERAL=189 +NUMBERED_BIND_PARAMETER=190 +NAMED_BIND_PARAMETER=191 +STRING_LITERAL=192 +BLOB_LITERAL=193 +SINGLE_LINE_COMMENT=194 +MULTILINE_COMMENT=195 +SPACES=196 +UNEXPECTED_CHAR=197 +';'=1 +'.'=2 +'('=3 +')'=4 +','=5 +'='=6 +'*'=7 +'+'=8 +'->>'=9 +'->'=10 +'-'=11 +'~'=12 +'||'=13 +'/'=14 +'%'=15 +'<<'=16 +'>>'=17 +'&'=18 +'|'=19 +'<'=20 +'<='=21 +'>'=22 +'>='=23 +'=='=24 +'!='=25 +'<>'=26 diff --git a/internal/engine/sqlite/parser/sqlite_base_listener.go b/internal/engine/sqlite/parser/sqlite_base_listener.go deleted file mode 100644 index c964d1ec07..0000000000 --- a/internal/engine/sqlite/parser/sqlite_base_listener.go +++ /dev/null @@ -1,520 +0,0 @@ -// Code generated from SQLite.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser // SQLite - -import "github.com/antlr/antlr4/runtime/Go/antlr" - -// BaseSQLiteListener is a complete listener for a parse tree produced by SQLiteParser. -type BaseSQLiteListener struct{} - -var _ SQLiteListener = &BaseSQLiteListener{} - -// VisitTerminal is called when a terminal node is visited. -func (s *BaseSQLiteListener) VisitTerminal(node antlr.TerminalNode) {} - -// VisitErrorNode is called when an error node is visited. -func (s *BaseSQLiteListener) VisitErrorNode(node antlr.ErrorNode) {} - -// EnterEveryRule is called when any rule is entered. -func (s *BaseSQLiteListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} - -// ExitEveryRule is called when any rule is exited. -func (s *BaseSQLiteListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} - -// EnterParse is called when production parse is entered. -func (s *BaseSQLiteListener) EnterParse(ctx *ParseContext) {} - -// ExitParse is called when production parse is exited. -func (s *BaseSQLiteListener) ExitParse(ctx *ParseContext) {} - -// EnterSql_stmt_list is called when production sql_stmt_list is entered. -func (s *BaseSQLiteListener) EnterSql_stmt_list(ctx *Sql_stmt_listContext) {} - -// ExitSql_stmt_list is called when production sql_stmt_list is exited. -func (s *BaseSQLiteListener) ExitSql_stmt_list(ctx *Sql_stmt_listContext) {} - -// EnterSql_stmt is called when production sql_stmt is entered. -func (s *BaseSQLiteListener) EnterSql_stmt(ctx *Sql_stmtContext) {} - -// ExitSql_stmt is called when production sql_stmt is exited. -func (s *BaseSQLiteListener) ExitSql_stmt(ctx *Sql_stmtContext) {} - -// EnterAlter_table_stmt is called when production alter_table_stmt is entered. -func (s *BaseSQLiteListener) EnterAlter_table_stmt(ctx *Alter_table_stmtContext) {} - -// ExitAlter_table_stmt is called when production alter_table_stmt is exited. -func (s *BaseSQLiteListener) ExitAlter_table_stmt(ctx *Alter_table_stmtContext) {} - -// EnterAnalyze_stmt is called when production analyze_stmt is entered. -func (s *BaseSQLiteListener) EnterAnalyze_stmt(ctx *Analyze_stmtContext) {} - -// ExitAnalyze_stmt is called when production analyze_stmt is exited. -func (s *BaseSQLiteListener) ExitAnalyze_stmt(ctx *Analyze_stmtContext) {} - -// EnterAttach_stmt is called when production attach_stmt is entered. -func (s *BaseSQLiteListener) EnterAttach_stmt(ctx *Attach_stmtContext) {} - -// ExitAttach_stmt is called when production attach_stmt is exited. -func (s *BaseSQLiteListener) ExitAttach_stmt(ctx *Attach_stmtContext) {} - -// EnterBegin_stmt is called when production begin_stmt is entered. -func (s *BaseSQLiteListener) EnterBegin_stmt(ctx *Begin_stmtContext) {} - -// ExitBegin_stmt is called when production begin_stmt is exited. -func (s *BaseSQLiteListener) ExitBegin_stmt(ctx *Begin_stmtContext) {} - -// EnterCommit_stmt is called when production commit_stmt is entered. -func (s *BaseSQLiteListener) EnterCommit_stmt(ctx *Commit_stmtContext) {} - -// ExitCommit_stmt is called when production commit_stmt is exited. -func (s *BaseSQLiteListener) ExitCommit_stmt(ctx *Commit_stmtContext) {} - -// EnterCompound_select_stmt is called when production compound_select_stmt is entered. -func (s *BaseSQLiteListener) EnterCompound_select_stmt(ctx *Compound_select_stmtContext) {} - -// ExitCompound_select_stmt is called when production compound_select_stmt is exited. -func (s *BaseSQLiteListener) ExitCompound_select_stmt(ctx *Compound_select_stmtContext) {} - -// EnterCreate_index_stmt is called when production create_index_stmt is entered. -func (s *BaseSQLiteListener) EnterCreate_index_stmt(ctx *Create_index_stmtContext) {} - -// ExitCreate_index_stmt is called when production create_index_stmt is exited. -func (s *BaseSQLiteListener) ExitCreate_index_stmt(ctx *Create_index_stmtContext) {} - -// EnterCreate_table_stmt is called when production create_table_stmt is entered. -func (s *BaseSQLiteListener) EnterCreate_table_stmt(ctx *Create_table_stmtContext) {} - -// ExitCreate_table_stmt is called when production create_table_stmt is exited. -func (s *BaseSQLiteListener) ExitCreate_table_stmt(ctx *Create_table_stmtContext) {} - -// EnterCreate_trigger_stmt is called when production create_trigger_stmt is entered. -func (s *BaseSQLiteListener) EnterCreate_trigger_stmt(ctx *Create_trigger_stmtContext) {} - -// ExitCreate_trigger_stmt is called when production create_trigger_stmt is exited. -func (s *BaseSQLiteListener) ExitCreate_trigger_stmt(ctx *Create_trigger_stmtContext) {} - -// EnterCreate_view_stmt is called when production create_view_stmt is entered. -func (s *BaseSQLiteListener) EnterCreate_view_stmt(ctx *Create_view_stmtContext) {} - -// ExitCreate_view_stmt is called when production create_view_stmt is exited. -func (s *BaseSQLiteListener) ExitCreate_view_stmt(ctx *Create_view_stmtContext) {} - -// EnterCreate_virtual_table_stmt is called when production create_virtual_table_stmt is entered. -func (s *BaseSQLiteListener) 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 *BaseSQLiteListener) ExitCreate_virtual_table_stmt(ctx *Create_virtual_table_stmtContext) {} - -// EnterDelete_stmt is called when production delete_stmt is entered. -func (s *BaseSQLiteListener) EnterDelete_stmt(ctx *Delete_stmtContext) {} - -// ExitDelete_stmt is called when production delete_stmt is exited. -func (s *BaseSQLiteListener) ExitDelete_stmt(ctx *Delete_stmtContext) {} - -// EnterDelete_stmt_limited is called when production delete_stmt_limited is entered. -func (s *BaseSQLiteListener) EnterDelete_stmt_limited(ctx *Delete_stmt_limitedContext) {} - -// ExitDelete_stmt_limited is called when production delete_stmt_limited is exited. -func (s *BaseSQLiteListener) ExitDelete_stmt_limited(ctx *Delete_stmt_limitedContext) {} - -// EnterDetach_stmt is called when production detach_stmt is entered. -func (s *BaseSQLiteListener) EnterDetach_stmt(ctx *Detach_stmtContext) {} - -// ExitDetach_stmt is called when production detach_stmt is exited. -func (s *BaseSQLiteListener) ExitDetach_stmt(ctx *Detach_stmtContext) {} - -// EnterDrop_index_stmt is called when production drop_index_stmt is entered. -func (s *BaseSQLiteListener) EnterDrop_index_stmt(ctx *Drop_index_stmtContext) {} - -// ExitDrop_index_stmt is called when production drop_index_stmt is exited. -func (s *BaseSQLiteListener) ExitDrop_index_stmt(ctx *Drop_index_stmtContext) {} - -// EnterDrop_table_stmt is called when production drop_table_stmt is entered. -func (s *BaseSQLiteListener) EnterDrop_table_stmt(ctx *Drop_table_stmtContext) {} - -// ExitDrop_table_stmt is called when production drop_table_stmt is exited. -func (s *BaseSQLiteListener) ExitDrop_table_stmt(ctx *Drop_table_stmtContext) {} - -// EnterDrop_trigger_stmt is called when production drop_trigger_stmt is entered. -func (s *BaseSQLiteListener) EnterDrop_trigger_stmt(ctx *Drop_trigger_stmtContext) {} - -// ExitDrop_trigger_stmt is called when production drop_trigger_stmt is exited. -func (s *BaseSQLiteListener) ExitDrop_trigger_stmt(ctx *Drop_trigger_stmtContext) {} - -// EnterDrop_view_stmt is called when production drop_view_stmt is entered. -func (s *BaseSQLiteListener) EnterDrop_view_stmt(ctx *Drop_view_stmtContext) {} - -// ExitDrop_view_stmt is called when production drop_view_stmt is exited. -func (s *BaseSQLiteListener) ExitDrop_view_stmt(ctx *Drop_view_stmtContext) {} - -// EnterFactored_select_stmt is called when production factored_select_stmt is entered. -func (s *BaseSQLiteListener) EnterFactored_select_stmt(ctx *Factored_select_stmtContext) {} - -// ExitFactored_select_stmt is called when production factored_select_stmt is exited. -func (s *BaseSQLiteListener) ExitFactored_select_stmt(ctx *Factored_select_stmtContext) {} - -// EnterInsert_stmt is called when production insert_stmt is entered. -func (s *BaseSQLiteListener) EnterInsert_stmt(ctx *Insert_stmtContext) {} - -// ExitInsert_stmt is called when production insert_stmt is exited. -func (s *BaseSQLiteListener) ExitInsert_stmt(ctx *Insert_stmtContext) {} - -// EnterPragma_stmt is called when production pragma_stmt is entered. -func (s *BaseSQLiteListener) EnterPragma_stmt(ctx *Pragma_stmtContext) {} - -// ExitPragma_stmt is called when production pragma_stmt is exited. -func (s *BaseSQLiteListener) ExitPragma_stmt(ctx *Pragma_stmtContext) {} - -// EnterReindex_stmt is called when production reindex_stmt is entered. -func (s *BaseSQLiteListener) EnterReindex_stmt(ctx *Reindex_stmtContext) {} - -// ExitReindex_stmt is called when production reindex_stmt is exited. -func (s *BaseSQLiteListener) ExitReindex_stmt(ctx *Reindex_stmtContext) {} - -// EnterRelease_stmt is called when production release_stmt is entered. -func (s *BaseSQLiteListener) EnterRelease_stmt(ctx *Release_stmtContext) {} - -// ExitRelease_stmt is called when production release_stmt is exited. -func (s *BaseSQLiteListener) ExitRelease_stmt(ctx *Release_stmtContext) {} - -// EnterRollback_stmt is called when production rollback_stmt is entered. -func (s *BaseSQLiteListener) EnterRollback_stmt(ctx *Rollback_stmtContext) {} - -// ExitRollback_stmt is called when production rollback_stmt is exited. -func (s *BaseSQLiteListener) ExitRollback_stmt(ctx *Rollback_stmtContext) {} - -// EnterSavepoint_stmt is called when production savepoint_stmt is entered. -func (s *BaseSQLiteListener) EnterSavepoint_stmt(ctx *Savepoint_stmtContext) {} - -// ExitSavepoint_stmt is called when production savepoint_stmt is exited. -func (s *BaseSQLiteListener) ExitSavepoint_stmt(ctx *Savepoint_stmtContext) {} - -// EnterSimple_select_stmt is called when production simple_select_stmt is entered. -func (s *BaseSQLiteListener) EnterSimple_select_stmt(ctx *Simple_select_stmtContext) {} - -// ExitSimple_select_stmt is called when production simple_select_stmt is exited. -func (s *BaseSQLiteListener) ExitSimple_select_stmt(ctx *Simple_select_stmtContext) {} - -// EnterSelect_stmt is called when production select_stmt is entered. -func (s *BaseSQLiteListener) EnterSelect_stmt(ctx *Select_stmtContext) {} - -// ExitSelect_stmt is called when production select_stmt is exited. -func (s *BaseSQLiteListener) ExitSelect_stmt(ctx *Select_stmtContext) {} - -// EnterSelect_or_values is called when production select_or_values is entered. -func (s *BaseSQLiteListener) EnterSelect_or_values(ctx *Select_or_valuesContext) {} - -// ExitSelect_or_values is called when production select_or_values is exited. -func (s *BaseSQLiteListener) ExitSelect_or_values(ctx *Select_or_valuesContext) {} - -// EnterUpdate_stmt is called when production update_stmt is entered. -func (s *BaseSQLiteListener) EnterUpdate_stmt(ctx *Update_stmtContext) {} - -// ExitUpdate_stmt is called when production update_stmt is exited. -func (s *BaseSQLiteListener) ExitUpdate_stmt(ctx *Update_stmtContext) {} - -// EnterUpdate_stmt_limited is called when production update_stmt_limited is entered. -func (s *BaseSQLiteListener) EnterUpdate_stmt_limited(ctx *Update_stmt_limitedContext) {} - -// ExitUpdate_stmt_limited is called when production update_stmt_limited is exited. -func (s *BaseSQLiteListener) ExitUpdate_stmt_limited(ctx *Update_stmt_limitedContext) {} - -// EnterVacuum_stmt is called when production vacuum_stmt is entered. -func (s *BaseSQLiteListener) EnterVacuum_stmt(ctx *Vacuum_stmtContext) {} - -// ExitVacuum_stmt is called when production vacuum_stmt is exited. -func (s *BaseSQLiteListener) ExitVacuum_stmt(ctx *Vacuum_stmtContext) {} - -// EnterColumn_def is called when production column_def is entered. -func (s *BaseSQLiteListener) EnterColumn_def(ctx *Column_defContext) {} - -// ExitColumn_def is called when production column_def is exited. -func (s *BaseSQLiteListener) ExitColumn_def(ctx *Column_defContext) {} - -// EnterType_name is called when production type_name is entered. -func (s *BaseSQLiteListener) EnterType_name(ctx *Type_nameContext) {} - -// ExitType_name is called when production type_name is exited. -func (s *BaseSQLiteListener) ExitType_name(ctx *Type_nameContext) {} - -// EnterColumn_constraint is called when production column_constraint is entered. -func (s *BaseSQLiteListener) EnterColumn_constraint(ctx *Column_constraintContext) {} - -// ExitColumn_constraint is called when production column_constraint is exited. -func (s *BaseSQLiteListener) ExitColumn_constraint(ctx *Column_constraintContext) {} - -// EnterConflict_clause is called when production conflict_clause is entered. -func (s *BaseSQLiteListener) EnterConflict_clause(ctx *Conflict_clauseContext) {} - -// ExitConflict_clause is called when production conflict_clause is exited. -func (s *BaseSQLiteListener) ExitConflict_clause(ctx *Conflict_clauseContext) {} - -// EnterExpr is called when production expr is entered. -func (s *BaseSQLiteListener) EnterExpr(ctx *ExprContext) {} - -// ExitExpr is called when production expr is exited. -func (s *BaseSQLiteListener) ExitExpr(ctx *ExprContext) {} - -// EnterForeign_key_clause is called when production foreign_key_clause is entered. -func (s *BaseSQLiteListener) EnterForeign_key_clause(ctx *Foreign_key_clauseContext) {} - -// ExitForeign_key_clause is called when production foreign_key_clause is exited. -func (s *BaseSQLiteListener) ExitForeign_key_clause(ctx *Foreign_key_clauseContext) {} - -// EnterRaise_function is called when production raise_function is entered. -func (s *BaseSQLiteListener) EnterRaise_function(ctx *Raise_functionContext) {} - -// ExitRaise_function is called when production raise_function is exited. -func (s *BaseSQLiteListener) ExitRaise_function(ctx *Raise_functionContext) {} - -// EnterIndexed_column is called when production indexed_column is entered. -func (s *BaseSQLiteListener) EnterIndexed_column(ctx *Indexed_columnContext) {} - -// ExitIndexed_column is called when production indexed_column is exited. -func (s *BaseSQLiteListener) ExitIndexed_column(ctx *Indexed_columnContext) {} - -// EnterTable_constraint is called when production table_constraint is entered. -func (s *BaseSQLiteListener) EnterTable_constraint(ctx *Table_constraintContext) {} - -// ExitTable_constraint is called when production table_constraint is exited. -func (s *BaseSQLiteListener) ExitTable_constraint(ctx *Table_constraintContext) {} - -// EnterWith_clause is called when production with_clause is entered. -func (s *BaseSQLiteListener) EnterWith_clause(ctx *With_clauseContext) {} - -// ExitWith_clause is called when production with_clause is exited. -func (s *BaseSQLiteListener) ExitWith_clause(ctx *With_clauseContext) {} - -// EnterQualified_table_name is called when production qualified_table_name is entered. -func (s *BaseSQLiteListener) EnterQualified_table_name(ctx *Qualified_table_nameContext) {} - -// ExitQualified_table_name is called when production qualified_table_name is exited. -func (s *BaseSQLiteListener) ExitQualified_table_name(ctx *Qualified_table_nameContext) {} - -// EnterOrdering_term is called when production ordering_term is entered. -func (s *BaseSQLiteListener) EnterOrdering_term(ctx *Ordering_termContext) {} - -// ExitOrdering_term is called when production ordering_term is exited. -func (s *BaseSQLiteListener) ExitOrdering_term(ctx *Ordering_termContext) {} - -// EnterPragma_value is called when production pragma_value is entered. -func (s *BaseSQLiteListener) EnterPragma_value(ctx *Pragma_valueContext) {} - -// ExitPragma_value is called when production pragma_value is exited. -func (s *BaseSQLiteListener) ExitPragma_value(ctx *Pragma_valueContext) {} - -// EnterCommon_table_expression is called when production common_table_expression is entered. -func (s *BaseSQLiteListener) EnterCommon_table_expression(ctx *Common_table_expressionContext) {} - -// ExitCommon_table_expression is called when production common_table_expression is exited. -func (s *BaseSQLiteListener) ExitCommon_table_expression(ctx *Common_table_expressionContext) {} - -// EnterResult_column is called when production result_column is entered. -func (s *BaseSQLiteListener) EnterResult_column(ctx *Result_columnContext) {} - -// ExitResult_column is called when production result_column is exited. -func (s *BaseSQLiteListener) ExitResult_column(ctx *Result_columnContext) {} - -// EnterTable_or_subquery is called when production table_or_subquery is entered. -func (s *BaseSQLiteListener) EnterTable_or_subquery(ctx *Table_or_subqueryContext) {} - -// ExitTable_or_subquery is called when production table_or_subquery is exited. -func (s *BaseSQLiteListener) ExitTable_or_subquery(ctx *Table_or_subqueryContext) {} - -// EnterJoin_clause is called when production join_clause is entered. -func (s *BaseSQLiteListener) EnterJoin_clause(ctx *Join_clauseContext) {} - -// ExitJoin_clause is called when production join_clause is exited. -func (s *BaseSQLiteListener) ExitJoin_clause(ctx *Join_clauseContext) {} - -// EnterJoin_operator is called when production join_operator is entered. -func (s *BaseSQLiteListener) EnterJoin_operator(ctx *Join_operatorContext) {} - -// ExitJoin_operator is called when production join_operator is exited. -func (s *BaseSQLiteListener) ExitJoin_operator(ctx *Join_operatorContext) {} - -// EnterJoin_constraint is called when production join_constraint is entered. -func (s *BaseSQLiteListener) EnterJoin_constraint(ctx *Join_constraintContext) {} - -// ExitJoin_constraint is called when production join_constraint is exited. -func (s *BaseSQLiteListener) ExitJoin_constraint(ctx *Join_constraintContext) {} - -// EnterSelect_core is called when production select_core is entered. -func (s *BaseSQLiteListener) EnterSelect_core(ctx *Select_coreContext) {} - -// ExitSelect_core is called when production select_core is exited. -func (s *BaseSQLiteListener) ExitSelect_core(ctx *Select_coreContext) {} - -// EnterCompound_operator is called when production compound_operator is entered. -func (s *BaseSQLiteListener) EnterCompound_operator(ctx *Compound_operatorContext) {} - -// ExitCompound_operator is called when production compound_operator is exited. -func (s *BaseSQLiteListener) ExitCompound_operator(ctx *Compound_operatorContext) {} - -// EnterSigned_number is called when production signed_number is entered. -func (s *BaseSQLiteListener) EnterSigned_number(ctx *Signed_numberContext) {} - -// ExitSigned_number is called when production signed_number is exited. -func (s *BaseSQLiteListener) ExitSigned_number(ctx *Signed_numberContext) {} - -// EnterLiteral_value is called when production literal_value is entered. -func (s *BaseSQLiteListener) EnterLiteral_value(ctx *Literal_valueContext) {} - -// ExitLiteral_value is called when production literal_value is exited. -func (s *BaseSQLiteListener) ExitLiteral_value(ctx *Literal_valueContext) {} - -// EnterUnary_operator is called when production unary_operator is entered. -func (s *BaseSQLiteListener) EnterUnary_operator(ctx *Unary_operatorContext) {} - -// ExitUnary_operator is called when production unary_operator is exited. -func (s *BaseSQLiteListener) ExitUnary_operator(ctx *Unary_operatorContext) {} - -// EnterError_message is called when production error_message is entered. -func (s *BaseSQLiteListener) EnterError_message(ctx *Error_messageContext) {} - -// ExitError_message is called when production error_message is exited. -func (s *BaseSQLiteListener) ExitError_message(ctx *Error_messageContext) {} - -// EnterModule_argument is called when production module_argument is entered. -func (s *BaseSQLiteListener) EnterModule_argument(ctx *Module_argumentContext) {} - -// ExitModule_argument is called when production module_argument is exited. -func (s *BaseSQLiteListener) ExitModule_argument(ctx *Module_argumentContext) {} - -// EnterColumn_alias is called when production column_alias is entered. -func (s *BaseSQLiteListener) EnterColumn_alias(ctx *Column_aliasContext) {} - -// ExitColumn_alias is called when production column_alias is exited. -func (s *BaseSQLiteListener) ExitColumn_alias(ctx *Column_aliasContext) {} - -// EnterKeyword is called when production keyword is entered. -func (s *BaseSQLiteListener) EnterKeyword(ctx *KeywordContext) {} - -// ExitKeyword is called when production keyword is exited. -func (s *BaseSQLiteListener) ExitKeyword(ctx *KeywordContext) {} - -// EnterName is called when production name is entered. -func (s *BaseSQLiteListener) EnterName(ctx *NameContext) {} - -// ExitName is called when production name is exited. -func (s *BaseSQLiteListener) ExitName(ctx *NameContext) {} - -// EnterFunction_name is called when production function_name is entered. -func (s *BaseSQLiteListener) EnterFunction_name(ctx *Function_nameContext) {} - -// ExitFunction_name is called when production function_name is exited. -func (s *BaseSQLiteListener) ExitFunction_name(ctx *Function_nameContext) {} - -// EnterDatabase_name is called when production database_name is entered. -func (s *BaseSQLiteListener) EnterDatabase_name(ctx *Database_nameContext) {} - -// ExitDatabase_name is called when production database_name is exited. -func (s *BaseSQLiteListener) ExitDatabase_name(ctx *Database_nameContext) {} - -// EnterSchema_name is called when production schema_name is entered. -func (s *BaseSQLiteListener) EnterSchema_name(ctx *Schema_nameContext) {} - -// ExitSchema_name is called when production schema_name is exited. -func (s *BaseSQLiteListener) ExitSchema_name(ctx *Schema_nameContext) {} - -// EnterTable_function_name is called when production table_function_name is entered. -func (s *BaseSQLiteListener) EnterTable_function_name(ctx *Table_function_nameContext) {} - -// ExitTable_function_name is called when production table_function_name is exited. -func (s *BaseSQLiteListener) ExitTable_function_name(ctx *Table_function_nameContext) {} - -// EnterTable_name is called when production table_name is entered. -func (s *BaseSQLiteListener) EnterTable_name(ctx *Table_nameContext) {} - -// ExitTable_name is called when production table_name is exited. -func (s *BaseSQLiteListener) ExitTable_name(ctx *Table_nameContext) {} - -// EnterTable_or_index_name is called when production table_or_index_name is entered. -func (s *BaseSQLiteListener) 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 *BaseSQLiteListener) ExitTable_or_index_name(ctx *Table_or_index_nameContext) {} - -// EnterNew_table_name is called when production new_table_name is entered. -func (s *BaseSQLiteListener) EnterNew_table_name(ctx *New_table_nameContext) {} - -// ExitNew_table_name is called when production new_table_name is exited. -func (s *BaseSQLiteListener) ExitNew_table_name(ctx *New_table_nameContext) {} - -// EnterColumn_name is called when production column_name is entered. -func (s *BaseSQLiteListener) EnterColumn_name(ctx *Column_nameContext) {} - -// ExitColumn_name is called when production column_name is exited. -func (s *BaseSQLiteListener) ExitColumn_name(ctx *Column_nameContext) {} - -// EnterNew_column_name is called when production new_column_name is entered. -func (s *BaseSQLiteListener) EnterNew_column_name(ctx *New_column_nameContext) {} - -// ExitNew_column_name is called when production new_column_name is exited. -func (s *BaseSQLiteListener) ExitNew_column_name(ctx *New_column_nameContext) {} - -// EnterCollation_name is called when production collation_name is entered. -func (s *BaseSQLiteListener) EnterCollation_name(ctx *Collation_nameContext) {} - -// ExitCollation_name is called when production collation_name is exited. -func (s *BaseSQLiteListener) ExitCollation_name(ctx *Collation_nameContext) {} - -// EnterForeign_table is called when production foreign_table is entered. -func (s *BaseSQLiteListener) EnterForeign_table(ctx *Foreign_tableContext) {} - -// ExitForeign_table is called when production foreign_table is exited. -func (s *BaseSQLiteListener) ExitForeign_table(ctx *Foreign_tableContext) {} - -// EnterIndex_name is called when production index_name is entered. -func (s *BaseSQLiteListener) EnterIndex_name(ctx *Index_nameContext) {} - -// ExitIndex_name is called when production index_name is exited. -func (s *BaseSQLiteListener) ExitIndex_name(ctx *Index_nameContext) {} - -// EnterTrigger_name is called when production trigger_name is entered. -func (s *BaseSQLiteListener) EnterTrigger_name(ctx *Trigger_nameContext) {} - -// ExitTrigger_name is called when production trigger_name is exited. -func (s *BaseSQLiteListener) ExitTrigger_name(ctx *Trigger_nameContext) {} - -// EnterView_name is called when production view_name is entered. -func (s *BaseSQLiteListener) EnterView_name(ctx *View_nameContext) {} - -// ExitView_name is called when production view_name is exited. -func (s *BaseSQLiteListener) ExitView_name(ctx *View_nameContext) {} - -// EnterModule_name is called when production module_name is entered. -func (s *BaseSQLiteListener) EnterModule_name(ctx *Module_nameContext) {} - -// ExitModule_name is called when production module_name is exited. -func (s *BaseSQLiteListener) ExitModule_name(ctx *Module_nameContext) {} - -// EnterPragma_name is called when production pragma_name is entered. -func (s *BaseSQLiteListener) EnterPragma_name(ctx *Pragma_nameContext) {} - -// ExitPragma_name is called when production pragma_name is exited. -func (s *BaseSQLiteListener) ExitPragma_name(ctx *Pragma_nameContext) {} - -// EnterSavepoint_name is called when production savepoint_name is entered. -func (s *BaseSQLiteListener) EnterSavepoint_name(ctx *Savepoint_nameContext) {} - -// ExitSavepoint_name is called when production savepoint_name is exited. -func (s *BaseSQLiteListener) ExitSavepoint_name(ctx *Savepoint_nameContext) {} - -// EnterTable_alias is called when production table_alias is entered. -func (s *BaseSQLiteListener) EnterTable_alias(ctx *Table_aliasContext) {} - -// ExitTable_alias is called when production table_alias is exited. -func (s *BaseSQLiteListener) ExitTable_alias(ctx *Table_aliasContext) {} - -// EnterTransaction_name is called when production transaction_name is entered. -func (s *BaseSQLiteListener) EnterTransaction_name(ctx *Transaction_nameContext) {} - -// ExitTransaction_name is called when production transaction_name is exited. -func (s *BaseSQLiteListener) ExitTransaction_name(ctx *Transaction_nameContext) {} - -// EnterAny_name is called when production any_name is entered. -func (s *BaseSQLiteListener) EnterAny_name(ctx *Any_nameContext) {} - -// ExitAny_name is called when production any_name is exited. -func (s *BaseSQLiteListener) ExitAny_name(ctx *Any_nameContext) {} diff --git a/internal/engine/sqlite/parser/sqlite_lexer.go b/internal/engine/sqlite/parser/sqlite_lexer.go index 000cc2697f..d3cfd14f1e 100644 --- a/internal/engine/sqlite/parser/sqlite_lexer.go +++ b/internal/engine/sqlite/parser/sqlite_lexer.go @@ -1,770 +1,19 @@ -// Code generated from SQLite.g4 by ANTLR 4.8. DO NOT EDIT. +// Code generated from SQLiteLexer.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser import ( "fmt" + "github.com/antlr4-go/antlr/v4" + "sync" "unicode" - - "github.com/antlr/antlr4/runtime/Go/antlr" ) // Suppress unused import error var _ = fmt.Printf +var _ = sync.Once{} var _ = unicode.IsLetter -var serializedLexerAtn = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 159, 1454, - 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, - 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, - 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, - 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, - 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, - 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, - 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, - 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, - 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, - 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, - 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, - 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, - 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, - 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, - 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, - 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, - 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, - 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, - 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101, - 4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106, - 9, 106, 4, 107, 9, 107, 4, 108, 9, 108, 4, 109, 9, 109, 4, 110, 9, 110, - 4, 111, 9, 111, 4, 112, 9, 112, 4, 113, 9, 113, 4, 114, 9, 114, 4, 115, - 9, 115, 4, 116, 9, 116, 4, 117, 9, 117, 4, 118, 9, 118, 4, 119, 9, 119, - 4, 120, 9, 120, 4, 121, 9, 121, 4, 122, 9, 122, 4, 123, 9, 123, 4, 124, - 9, 124, 4, 125, 9, 125, 4, 126, 9, 126, 4, 127, 9, 127, 4, 128, 9, 128, - 4, 129, 9, 129, 4, 130, 9, 130, 4, 131, 9, 131, 4, 132, 9, 132, 4, 133, - 9, 133, 4, 134, 9, 134, 4, 135, 9, 135, 4, 136, 9, 136, 4, 137, 9, 137, - 4, 138, 9, 138, 4, 139, 9, 139, 4, 140, 9, 140, 4, 141, 9, 141, 4, 142, - 9, 142, 4, 143, 9, 143, 4, 144, 9, 144, 4, 145, 9, 145, 4, 146, 9, 146, - 4, 147, 9, 147, 4, 148, 9, 148, 4, 149, 9, 149, 4, 150, 9, 150, 4, 151, - 9, 151, 4, 152, 9, 152, 4, 153, 9, 153, 4, 154, 9, 154, 4, 155, 9, 155, - 4, 156, 9, 156, 4, 157, 9, 157, 4, 158, 9, 158, 4, 159, 9, 159, 4, 160, - 9, 160, 4, 161, 9, 161, 4, 162, 9, 162, 4, 163, 9, 163, 4, 164, 9, 164, - 4, 165, 9, 165, 4, 166, 9, 166, 4, 167, 9, 167, 4, 168, 9, 168, 4, 169, - 9, 169, 4, 170, 9, 170, 4, 171, 9, 171, 4, 172, 9, 172, 4, 173, 9, 173, - 4, 174, 9, 174, 4, 175, 9, 175, 4, 176, 9, 176, 4, 177, 9, 177, 4, 178, - 9, 178, 4, 179, 9, 179, 4, 180, 9, 180, 4, 181, 9, 181, 4, 182, 9, 182, - 4, 183, 9, 183, 4, 184, 9, 184, 4, 185, 9, 185, 3, 2, 3, 2, 3, 3, 3, 3, - 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, - 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, - 14, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, - 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, - 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, - 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, - 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, - 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, - 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, - 3, 33, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, - 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, - 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, - 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, - 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, - 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, - 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, - 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, - 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, - 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, - 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, - 50, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, - 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 3, 53, 3, - 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, - 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, - 54, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, - 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, - 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, - 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, - 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, - 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, - 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, - 3, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, - 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 66, - 3, 66, 3, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, - 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, - 3, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, - 70, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, - 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, - 74, 3, 74, 3, 74, 3, 74, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, - 3, 75, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, - 77, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, - 3, 79, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 81, 3, 81, 3, - 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 83, 3, 83, 3, 83, - 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, - 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, - 3, 86, 3, 86, 3, 86, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, - 87, 3, 87, 3, 87, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 89, 3, 89, - 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, - 90, 3, 90, 3, 90, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, - 3, 91, 3, 91, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 93, 3, 93, 3, 93, 3, - 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 3, 95, 3, 95, 3, 95, 3, 95, - 3, 95, 3, 96, 3, 96, 3, 96, 3, 96, 3, 97, 3, 97, 3, 97, 3, 97, 3, 97, 3, - 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, - 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 101, 3, 101, 3, 101, - 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 102, 3, 102, 3, 102, 3, 103, - 3, 103, 3, 103, 3, 103, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, - 3, 104, 3, 104, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 106, 3, 106, - 3, 106, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 108, - 3, 108, 3, 108, 3, 109, 3, 109, 3, 109, 3, 110, 3, 110, 3, 110, 3, 110, - 3, 110, 3, 110, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 112, - 3, 112, 3, 112, 3, 112, 3, 112, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, - 3, 113, 3, 113, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, - 3, 114, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 116, 3, 116, - 3, 116, 3, 116, 3, 116, 3, 116, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, - 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 118, 3, 118, 3, 118, 3, 118, - 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 119, 3, 119, - 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 120, 3, 120, 3, 120, 3, 120, - 3, 120, 3, 120, 3, 120, 3, 120, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, - 3, 121, 3, 121, 3, 121, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, - 3, 122, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, - 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, - 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 126, 3, 126, 3, 126, - 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 127, 3, 127, 3, 127, - 3, 127, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, - 3, 128, 3, 128, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, - 3, 130, 3, 130, 3, 130, 3, 130, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, - 3, 131, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 3, 133, 3, 133, 3, 133, - 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 134, 3, 134, - 3, 134, 3, 134, 3, 134, 3, 135, 3, 135, 3, 135, 3, 136, 3, 136, 3, 136, - 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, - 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 138, - 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 139, 3, 139, 3, 139, 3, 139, - 3, 139, 3, 139, 3, 139, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, - 3, 140, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 142, 3, 142, - 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 143, 3, 143, 3, 143, 3, 143, - 3, 143, 3, 143, 3, 143, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 145, - 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 146, 3, 146, - 3, 146, 3, 146, 3, 146, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, - 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 149, 3, 149, 3, 149, 3, 149, - 3, 149, 3, 149, 3, 149, 3, 149, 3, 150, 3, 150, 3, 150, 3, 150, 7, 150, - 1266, 10, 150, 12, 150, 14, 150, 1269, 11, 150, 3, 150, 3, 150, 3, 150, - 3, 150, 3, 150, 7, 150, 1276, 10, 150, 12, 150, 14, 150, 1279, 11, 150, - 3, 150, 3, 150, 3, 150, 7, 150, 1284, 10, 150, 12, 150, 14, 150, 1287, - 11, 150, 3, 150, 3, 150, 3, 150, 7, 150, 1292, 10, 150, 12, 150, 14, 150, - 1295, 11, 150, 5, 150, 1297, 10, 150, 3, 151, 6, 151, 1300, 10, 151, 13, - 151, 14, 151, 1301, 3, 151, 3, 151, 7, 151, 1306, 10, 151, 12, 151, 14, - 151, 1309, 11, 151, 5, 151, 1311, 10, 151, 3, 151, 3, 151, 5, 151, 1315, - 10, 151, 3, 151, 6, 151, 1318, 10, 151, 13, 151, 14, 151, 1319, 5, 151, - 1322, 10, 151, 3, 151, 3, 151, 6, 151, 1326, 10, 151, 13, 151, 14, 151, - 1327, 3, 151, 3, 151, 5, 151, 1332, 10, 151, 3, 151, 6, 151, 1335, 10, - 151, 13, 151, 14, 151, 1336, 5, 151, 1339, 10, 151, 5, 151, 1341, 10, 151, - 3, 152, 3, 152, 7, 152, 1345, 10, 152, 12, 152, 14, 152, 1348, 11, 152, - 3, 152, 3, 152, 5, 152, 1352, 10, 152, 3, 153, 3, 153, 3, 153, 3, 153, - 7, 153, 1358, 10, 153, 12, 153, 14, 153, 1361, 11, 153, 3, 153, 3, 153, - 3, 154, 3, 154, 3, 154, 3, 155, 3, 155, 3, 155, 3, 155, 7, 155, 1372, 10, - 155, 12, 155, 14, 155, 1375, 11, 155, 3, 155, 3, 155, 3, 156, 3, 156, 3, - 156, 3, 156, 7, 156, 1383, 10, 156, 12, 156, 14, 156, 1386, 11, 156, 3, - 156, 3, 156, 3, 156, 5, 156, 1391, 10, 156, 3, 156, 3, 156, 3, 157, 3, - 157, 3, 157, 3, 157, 3, 158, 3, 158, 3, 159, 3, 159, 3, 160, 3, 160, 3, - 161, 3, 161, 3, 162, 3, 162, 3, 163, 3, 163, 3, 164, 3, 164, 3, 165, 3, - 165, 3, 166, 3, 166, 3, 167, 3, 167, 3, 168, 3, 168, 3, 169, 3, 169, 3, - 170, 3, 170, 3, 171, 3, 171, 3, 172, 3, 172, 3, 173, 3, 173, 3, 174, 3, - 174, 3, 175, 3, 175, 3, 176, 3, 176, 3, 177, 3, 177, 3, 178, 3, 178, 3, - 179, 3, 179, 3, 180, 3, 180, 3, 181, 3, 181, 3, 182, 3, 182, 3, 183, 3, - 183, 3, 184, 3, 184, 3, 185, 3, 185, 3, 1384, 2, 186, 3, 3, 5, 4, 7, 5, - 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, - 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, - 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, - 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, - 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, - 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, - 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, - 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145, 74, 147, - 75, 149, 76, 151, 77, 153, 78, 155, 79, 157, 80, 159, 81, 161, 82, 163, - 83, 165, 84, 167, 85, 169, 86, 171, 87, 173, 88, 175, 89, 177, 90, 179, - 91, 181, 92, 183, 93, 185, 94, 187, 95, 189, 96, 191, 97, 193, 98, 195, - 99, 197, 100, 199, 101, 201, 102, 203, 103, 205, 104, 207, 105, 209, 106, - 211, 107, 213, 108, 215, 109, 217, 110, 219, 111, 221, 112, 223, 113, 225, - 114, 227, 115, 229, 116, 231, 117, 233, 118, 235, 119, 237, 120, 239, 121, - 241, 122, 243, 123, 245, 124, 247, 125, 249, 126, 251, 127, 253, 128, 255, - 129, 257, 130, 259, 131, 261, 132, 263, 133, 265, 134, 267, 135, 269, 136, - 271, 137, 273, 138, 275, 139, 277, 140, 279, 141, 281, 142, 283, 143, 285, - 144, 287, 145, 289, 146, 291, 147, 293, 148, 295, 149, 297, 150, 299, 151, - 301, 152, 303, 153, 305, 154, 307, 155, 309, 156, 311, 157, 313, 158, 315, - 159, 317, 2, 319, 2, 321, 2, 323, 2, 325, 2, 327, 2, 329, 2, 331, 2, 333, - 2, 335, 2, 337, 2, 339, 2, 341, 2, 343, 2, 345, 2, 347, 2, 349, 2, 351, - 2, 353, 2, 355, 2, 357, 2, 359, 2, 361, 2, 363, 2, 365, 2, 367, 2, 369, - 2, 3, 2, 39, 3, 2, 36, 36, 3, 2, 98, 98, 3, 2, 95, 95, 5, 2, 67, 92, 97, - 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 4, 2, 45, 45, 47, 47, - 5, 2, 38, 38, 60, 60, 66, 66, 3, 2, 41, 41, 4, 2, 12, 12, 15, 15, 5, 2, - 11, 13, 15, 15, 34, 34, 3, 2, 50, 59, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, - 100, 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, - 103, 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, - 106, 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, - 109, 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, - 112, 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, - 115, 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, - 118, 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, - 121, 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, - 124, 124, 2, 1453, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, - 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, - 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, - 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, - 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, - 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, - 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, - 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, - 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, - 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, - 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, - 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, - 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, - 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, - 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, - 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, - 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, - 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, - 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, - 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, - 151, 3, 2, 2, 2, 2, 153, 3, 2, 2, 2, 2, 155, 3, 2, 2, 2, 2, 157, 3, 2, - 2, 2, 2, 159, 3, 2, 2, 2, 2, 161, 3, 2, 2, 2, 2, 163, 3, 2, 2, 2, 2, 165, - 3, 2, 2, 2, 2, 167, 3, 2, 2, 2, 2, 169, 3, 2, 2, 2, 2, 171, 3, 2, 2, 2, - 2, 173, 3, 2, 2, 2, 2, 175, 3, 2, 2, 2, 2, 177, 3, 2, 2, 2, 2, 179, 3, - 2, 2, 2, 2, 181, 3, 2, 2, 2, 2, 183, 3, 2, 2, 2, 2, 185, 3, 2, 2, 2, 2, - 187, 3, 2, 2, 2, 2, 189, 3, 2, 2, 2, 2, 191, 3, 2, 2, 2, 2, 193, 3, 2, - 2, 2, 2, 195, 3, 2, 2, 2, 2, 197, 3, 2, 2, 2, 2, 199, 3, 2, 2, 2, 2, 201, - 3, 2, 2, 2, 2, 203, 3, 2, 2, 2, 2, 205, 3, 2, 2, 2, 2, 207, 3, 2, 2, 2, - 2, 209, 3, 2, 2, 2, 2, 211, 3, 2, 2, 2, 2, 213, 3, 2, 2, 2, 2, 215, 3, - 2, 2, 2, 2, 217, 3, 2, 2, 2, 2, 219, 3, 2, 2, 2, 2, 221, 3, 2, 2, 2, 2, - 223, 3, 2, 2, 2, 2, 225, 3, 2, 2, 2, 2, 227, 3, 2, 2, 2, 2, 229, 3, 2, - 2, 2, 2, 231, 3, 2, 2, 2, 2, 233, 3, 2, 2, 2, 2, 235, 3, 2, 2, 2, 2, 237, - 3, 2, 2, 2, 2, 239, 3, 2, 2, 2, 2, 241, 3, 2, 2, 2, 2, 243, 3, 2, 2, 2, - 2, 245, 3, 2, 2, 2, 2, 247, 3, 2, 2, 2, 2, 249, 3, 2, 2, 2, 2, 251, 3, - 2, 2, 2, 2, 253, 3, 2, 2, 2, 2, 255, 3, 2, 2, 2, 2, 257, 3, 2, 2, 2, 2, - 259, 3, 2, 2, 2, 2, 261, 3, 2, 2, 2, 2, 263, 3, 2, 2, 2, 2, 265, 3, 2, - 2, 2, 2, 267, 3, 2, 2, 2, 2, 269, 3, 2, 2, 2, 2, 271, 3, 2, 2, 2, 2, 273, - 3, 2, 2, 2, 2, 275, 3, 2, 2, 2, 2, 277, 3, 2, 2, 2, 2, 279, 3, 2, 2, 2, - 2, 281, 3, 2, 2, 2, 2, 283, 3, 2, 2, 2, 2, 285, 3, 2, 2, 2, 2, 287, 3, - 2, 2, 2, 2, 289, 3, 2, 2, 2, 2, 291, 3, 2, 2, 2, 2, 293, 3, 2, 2, 2, 2, - 295, 3, 2, 2, 2, 2, 297, 3, 2, 2, 2, 2, 299, 3, 2, 2, 2, 2, 301, 3, 2, - 2, 2, 2, 303, 3, 2, 2, 2, 2, 305, 3, 2, 2, 2, 2, 307, 3, 2, 2, 2, 2, 309, - 3, 2, 2, 2, 2, 311, 3, 2, 2, 2, 2, 313, 3, 2, 2, 2, 2, 315, 3, 2, 2, 2, - 3, 371, 3, 2, 2, 2, 5, 373, 3, 2, 2, 2, 7, 375, 3, 2, 2, 2, 9, 377, 3, - 2, 2, 2, 11, 379, 3, 2, 2, 2, 13, 381, 3, 2, 2, 2, 15, 383, 3, 2, 2, 2, - 17, 385, 3, 2, 2, 2, 19, 387, 3, 2, 2, 2, 21, 389, 3, 2, 2, 2, 23, 391, - 3, 2, 2, 2, 25, 394, 3, 2, 2, 2, 27, 396, 3, 2, 2, 2, 29, 398, 3, 2, 2, - 2, 31, 401, 3, 2, 2, 2, 33, 404, 3, 2, 2, 2, 35, 406, 3, 2, 2, 2, 37, 408, - 3, 2, 2, 2, 39, 410, 3, 2, 2, 2, 41, 413, 3, 2, 2, 2, 43, 415, 3, 2, 2, - 2, 45, 418, 3, 2, 2, 2, 47, 421, 3, 2, 2, 2, 49, 424, 3, 2, 2, 2, 51, 427, - 3, 2, 2, 2, 53, 433, 3, 2, 2, 2, 55, 440, 3, 2, 2, 2, 57, 444, 3, 2, 2, - 2, 59, 450, 3, 2, 2, 2, 61, 454, 3, 2, 2, 2, 63, 460, 3, 2, 2, 2, 65, 468, - 3, 2, 2, 2, 67, 472, 3, 2, 2, 2, 69, 475, 3, 2, 2, 2, 71, 479, 3, 2, 2, - 2, 73, 486, 3, 2, 2, 2, 75, 500, 3, 2, 2, 2, 77, 507, 3, 2, 2, 2, 79, 513, - 3, 2, 2, 2, 81, 521, 3, 2, 2, 2, 83, 524, 3, 2, 2, 2, 85, 532, 3, 2, 2, - 2, 87, 537, 3, 2, 2, 2, 89, 542, 3, 2, 2, 2, 91, 548, 3, 2, 2, 2, 93, 556, - 3, 2, 2, 2, 95, 563, 3, 2, 2, 2, 97, 570, 3, 2, 2, 2, 99, 579, 3, 2, 2, - 2, 101, 590, 3, 2, 2, 2, 103, 597, 3, 2, 2, 2, 105, 603, 3, 2, 2, 2, 107, - 616, 3, 2, 2, 2, 109, 629, 3, 2, 2, 2, 111, 647, 3, 2, 2, 2, 113, 656, - 3, 2, 2, 2, 115, 664, 3, 2, 2, 2, 117, 675, 3, 2, 2, 2, 119, 684, 3, 2, - 2, 2, 121, 691, 3, 2, 2, 2, 123, 696, 3, 2, 2, 2, 125, 703, 3, 2, 2, 2, - 127, 712, 3, 2, 2, 2, 129, 717, 3, 2, 2, 2, 131, 722, 3, 2, 2, 2, 133, - 727, 3, 2, 2, 2, 135, 731, 3, 2, 2, 2, 137, 738, 3, 2, 2, 2, 139, 745, - 3, 2, 2, 2, 141, 755, 3, 2, 2, 2, 143, 762, 3, 2, 2, 2, 145, 770, 3, 2, - 2, 2, 147, 775, 3, 2, 2, 2, 149, 779, 3, 2, 2, 2, 151, 787, 3, 2, 2, 2, - 153, 792, 3, 2, 2, 2, 155, 797, 3, 2, 2, 2, 157, 802, 3, 2, 2, 2, 159, - 808, 3, 2, 2, 2, 161, 815, 3, 2, 2, 2, 163, 818, 3, 2, 2, 2, 165, 825, - 3, 2, 2, 2, 167, 835, 3, 2, 2, 2, 169, 838, 3, 2, 2, 2, 171, 844, 3, 2, - 2, 2, 173, 852, 3, 2, 2, 2, 175, 862, 3, 2, 2, 2, 177, 868, 3, 2, 2, 2, - 179, 875, 3, 2, 2, 2, 181, 883, 3, 2, 2, 2, 183, 893, 3, 2, 2, 2, 185, - 898, 3, 2, 2, 2, 187, 901, 3, 2, 2, 2, 189, 908, 3, 2, 2, 2, 191, 913, - 3, 2, 2, 2, 193, 917, 3, 2, 2, 2, 195, 922, 3, 2, 2, 2, 197, 927, 3, 2, - 2, 2, 199, 933, 3, 2, 2, 2, 201, 939, 3, 2, 2, 2, 203, 947, 3, 2, 2, 2, - 205, 950, 3, 2, 2, 2, 207, 954, 3, 2, 2, 2, 209, 962, 3, 2, 2, 2, 211, - 967, 3, 2, 2, 2, 213, 970, 3, 2, 2, 2, 215, 977, 3, 2, 2, 2, 217, 980, - 3, 2, 2, 2, 219, 983, 3, 2, 2, 2, 221, 989, 3, 2, 2, 2, 223, 995, 3, 2, - 2, 2, 225, 1000, 3, 2, 2, 2, 227, 1007, 3, 2, 2, 2, 229, 1015, 3, 2, 2, - 2, 231, 1021, 3, 2, 2, 2, 233, 1027, 3, 2, 2, 2, 235, 1037, 3, 2, 2, 2, - 237, 1048, 3, 2, 2, 2, 239, 1055, 3, 2, 2, 2, 241, 1063, 3, 2, 2, 2, 243, - 1071, 3, 2, 2, 2, 245, 1078, 3, 2, 2, 2, 247, 1086, 3, 2, 2, 2, 249, 1095, - 3, 2, 2, 2, 251, 1101, 3, 2, 2, 2, 253, 1110, 3, 2, 2, 2, 255, 1114, 3, - 2, 2, 2, 257, 1124, 3, 2, 2, 2, 259, 1131, 3, 2, 2, 2, 261, 1135, 3, 2, - 2, 2, 263, 1141, 3, 2, 2, 2, 265, 1146, 3, 2, 2, 2, 267, 1156, 3, 2, 2, - 2, 269, 1161, 3, 2, 2, 2, 271, 1164, 3, 2, 2, 2, 273, 1176, 3, 2, 2, 2, - 275, 1184, 3, 2, 2, 2, 277, 1190, 3, 2, 2, 2, 279, 1197, 3, 2, 2, 2, 281, - 1204, 3, 2, 2, 2, 283, 1210, 3, 2, 2, 2, 285, 1217, 3, 2, 2, 2, 287, 1224, - 3, 2, 2, 2, 289, 1229, 3, 2, 2, 2, 291, 1237, 3, 2, 2, 2, 293, 1242, 3, - 2, 2, 2, 295, 1248, 3, 2, 2, 2, 297, 1253, 3, 2, 2, 2, 299, 1296, 3, 2, - 2, 2, 301, 1340, 3, 2, 2, 2, 303, 1351, 3, 2, 2, 2, 305, 1353, 3, 2, 2, - 2, 307, 1364, 3, 2, 2, 2, 309, 1367, 3, 2, 2, 2, 311, 1378, 3, 2, 2, 2, - 313, 1394, 3, 2, 2, 2, 315, 1398, 3, 2, 2, 2, 317, 1400, 3, 2, 2, 2, 319, - 1402, 3, 2, 2, 2, 321, 1404, 3, 2, 2, 2, 323, 1406, 3, 2, 2, 2, 325, 1408, - 3, 2, 2, 2, 327, 1410, 3, 2, 2, 2, 329, 1412, 3, 2, 2, 2, 331, 1414, 3, - 2, 2, 2, 333, 1416, 3, 2, 2, 2, 335, 1418, 3, 2, 2, 2, 337, 1420, 3, 2, - 2, 2, 339, 1422, 3, 2, 2, 2, 341, 1424, 3, 2, 2, 2, 343, 1426, 3, 2, 2, - 2, 345, 1428, 3, 2, 2, 2, 347, 1430, 3, 2, 2, 2, 349, 1432, 3, 2, 2, 2, - 351, 1434, 3, 2, 2, 2, 353, 1436, 3, 2, 2, 2, 355, 1438, 3, 2, 2, 2, 357, - 1440, 3, 2, 2, 2, 359, 1442, 3, 2, 2, 2, 361, 1444, 3, 2, 2, 2, 363, 1446, - 3, 2, 2, 2, 365, 1448, 3, 2, 2, 2, 367, 1450, 3, 2, 2, 2, 369, 1452, 3, - 2, 2, 2, 371, 372, 7, 61, 2, 2, 372, 4, 3, 2, 2, 2, 373, 374, 7, 48, 2, - 2, 374, 6, 3, 2, 2, 2, 375, 376, 7, 42, 2, 2, 376, 8, 3, 2, 2, 2, 377, - 378, 7, 43, 2, 2, 378, 10, 3, 2, 2, 2, 379, 380, 7, 46, 2, 2, 380, 12, - 3, 2, 2, 2, 381, 382, 7, 63, 2, 2, 382, 14, 3, 2, 2, 2, 383, 384, 7, 44, - 2, 2, 384, 16, 3, 2, 2, 2, 385, 386, 7, 45, 2, 2, 386, 18, 3, 2, 2, 2, - 387, 388, 7, 47, 2, 2, 388, 20, 3, 2, 2, 2, 389, 390, 7, 128, 2, 2, 390, - 22, 3, 2, 2, 2, 391, 392, 7, 126, 2, 2, 392, 393, 7, 126, 2, 2, 393, 24, - 3, 2, 2, 2, 394, 395, 7, 49, 2, 2, 395, 26, 3, 2, 2, 2, 396, 397, 7, 39, - 2, 2, 397, 28, 3, 2, 2, 2, 398, 399, 7, 62, 2, 2, 399, 400, 7, 62, 2, 2, - 400, 30, 3, 2, 2, 2, 401, 402, 7, 64, 2, 2, 402, 403, 7, 64, 2, 2, 403, - 32, 3, 2, 2, 2, 404, 405, 7, 40, 2, 2, 405, 34, 3, 2, 2, 2, 406, 407, 7, - 126, 2, 2, 407, 36, 3, 2, 2, 2, 408, 409, 7, 62, 2, 2, 409, 38, 3, 2, 2, - 2, 410, 411, 7, 62, 2, 2, 411, 412, 7, 63, 2, 2, 412, 40, 3, 2, 2, 2, 413, - 414, 7, 64, 2, 2, 414, 42, 3, 2, 2, 2, 415, 416, 7, 64, 2, 2, 416, 417, - 7, 63, 2, 2, 417, 44, 3, 2, 2, 2, 418, 419, 7, 63, 2, 2, 419, 420, 7, 63, - 2, 2, 420, 46, 3, 2, 2, 2, 421, 422, 7, 35, 2, 2, 422, 423, 7, 63, 2, 2, - 423, 48, 3, 2, 2, 2, 424, 425, 7, 62, 2, 2, 425, 426, 7, 64, 2, 2, 426, - 50, 3, 2, 2, 2, 427, 428, 5, 319, 160, 2, 428, 429, 5, 321, 161, 2, 429, - 430, 5, 347, 174, 2, 430, 431, 5, 353, 177, 2, 431, 432, 5, 357, 179, 2, - 432, 52, 3, 2, 2, 2, 433, 434, 5, 319, 160, 2, 434, 435, 5, 323, 162, 2, - 435, 436, 5, 357, 179, 2, 436, 437, 5, 335, 168, 2, 437, 438, 5, 347, 174, - 2, 438, 439, 5, 345, 173, 2, 439, 54, 3, 2, 2, 2, 440, 441, 5, 319, 160, - 2, 441, 442, 5, 325, 163, 2, 442, 443, 5, 325, 163, 2, 443, 56, 3, 2, 2, - 2, 444, 445, 5, 319, 160, 2, 445, 446, 5, 329, 165, 2, 446, 447, 5, 357, - 179, 2, 447, 448, 5, 327, 164, 2, 448, 449, 5, 353, 177, 2, 449, 58, 3, - 2, 2, 2, 450, 451, 5, 319, 160, 2, 451, 452, 5, 341, 171, 2, 452, 453, - 5, 341, 171, 2, 453, 60, 3, 2, 2, 2, 454, 455, 5, 319, 160, 2, 455, 456, - 5, 341, 171, 2, 456, 457, 5, 357, 179, 2, 457, 458, 5, 327, 164, 2, 458, - 459, 5, 353, 177, 2, 459, 62, 3, 2, 2, 2, 460, 461, 5, 319, 160, 2, 461, - 462, 5, 345, 173, 2, 462, 463, 5, 319, 160, 2, 463, 464, 5, 341, 171, 2, - 464, 465, 5, 367, 184, 2, 465, 466, 5, 369, 185, 2, 466, 467, 5, 327, 164, - 2, 467, 64, 3, 2, 2, 2, 468, 469, 5, 319, 160, 2, 469, 470, 5, 345, 173, - 2, 470, 471, 5, 325, 163, 2, 471, 66, 3, 2, 2, 2, 472, 473, 5, 319, 160, - 2, 473, 474, 5, 355, 178, 2, 474, 68, 3, 2, 2, 2, 475, 476, 5, 319, 160, - 2, 476, 477, 5, 355, 178, 2, 477, 478, 5, 323, 162, 2, 478, 70, 3, 2, 2, - 2, 479, 480, 5, 319, 160, 2, 480, 481, 5, 357, 179, 2, 481, 482, 5, 357, - 179, 2, 482, 483, 5, 319, 160, 2, 483, 484, 5, 323, 162, 2, 484, 485, 5, - 333, 167, 2, 485, 72, 3, 2, 2, 2, 486, 487, 5, 319, 160, 2, 487, 488, 5, - 359, 180, 2, 488, 489, 5, 357, 179, 2, 489, 490, 5, 347, 174, 2, 490, 491, - 5, 335, 168, 2, 491, 492, 5, 345, 173, 2, 492, 493, 5, 323, 162, 2, 493, - 494, 5, 353, 177, 2, 494, 495, 5, 327, 164, 2, 495, 496, 5, 343, 172, 2, - 496, 497, 5, 327, 164, 2, 497, 498, 5, 345, 173, 2, 498, 499, 5, 357, 179, - 2, 499, 74, 3, 2, 2, 2, 500, 501, 5, 321, 161, 2, 501, 502, 5, 327, 164, - 2, 502, 503, 5, 329, 165, 2, 503, 504, 5, 347, 174, 2, 504, 505, 5, 353, - 177, 2, 505, 506, 5, 327, 164, 2, 506, 76, 3, 2, 2, 2, 507, 508, 5, 321, - 161, 2, 508, 509, 5, 327, 164, 2, 509, 510, 5, 331, 166, 2, 510, 511, 5, - 335, 168, 2, 511, 512, 5, 345, 173, 2, 512, 78, 3, 2, 2, 2, 513, 514, 5, - 321, 161, 2, 514, 515, 5, 327, 164, 2, 515, 516, 5, 357, 179, 2, 516, 517, - 5, 363, 182, 2, 517, 518, 5, 327, 164, 2, 518, 519, 5, 327, 164, 2, 519, - 520, 5, 345, 173, 2, 520, 80, 3, 2, 2, 2, 521, 522, 5, 321, 161, 2, 522, - 523, 5, 367, 184, 2, 523, 82, 3, 2, 2, 2, 524, 525, 5, 323, 162, 2, 525, - 526, 5, 319, 160, 2, 526, 527, 5, 355, 178, 2, 527, 528, 5, 323, 162, 2, - 528, 529, 5, 319, 160, 2, 529, 530, 5, 325, 163, 2, 530, 531, 5, 327, 164, - 2, 531, 84, 3, 2, 2, 2, 532, 533, 5, 323, 162, 2, 533, 534, 5, 319, 160, - 2, 534, 535, 5, 355, 178, 2, 535, 536, 5, 327, 164, 2, 536, 86, 3, 2, 2, - 2, 537, 538, 5, 323, 162, 2, 538, 539, 5, 319, 160, 2, 539, 540, 5, 355, - 178, 2, 540, 541, 5, 357, 179, 2, 541, 88, 3, 2, 2, 2, 542, 543, 5, 323, - 162, 2, 543, 544, 5, 333, 167, 2, 544, 545, 5, 327, 164, 2, 545, 546, 5, - 323, 162, 2, 546, 547, 5, 339, 170, 2, 547, 90, 3, 2, 2, 2, 548, 549, 5, - 323, 162, 2, 549, 550, 5, 347, 174, 2, 550, 551, 5, 341, 171, 2, 551, 552, - 5, 341, 171, 2, 552, 553, 5, 319, 160, 2, 553, 554, 5, 357, 179, 2, 554, - 555, 5, 327, 164, 2, 555, 92, 3, 2, 2, 2, 556, 557, 5, 323, 162, 2, 557, - 558, 5, 347, 174, 2, 558, 559, 5, 341, 171, 2, 559, 560, 5, 359, 180, 2, - 560, 561, 5, 343, 172, 2, 561, 562, 5, 345, 173, 2, 562, 94, 3, 2, 2, 2, - 563, 564, 5, 323, 162, 2, 564, 565, 5, 347, 174, 2, 565, 566, 5, 343, 172, - 2, 566, 567, 5, 343, 172, 2, 567, 568, 5, 335, 168, 2, 568, 569, 5, 357, - 179, 2, 569, 96, 3, 2, 2, 2, 570, 571, 5, 323, 162, 2, 571, 572, 5, 347, - 174, 2, 572, 573, 5, 345, 173, 2, 573, 574, 5, 329, 165, 2, 574, 575, 5, - 341, 171, 2, 575, 576, 5, 335, 168, 2, 576, 577, 5, 323, 162, 2, 577, 578, - 5, 357, 179, 2, 578, 98, 3, 2, 2, 2, 579, 580, 5, 323, 162, 2, 580, 581, - 5, 347, 174, 2, 581, 582, 5, 345, 173, 2, 582, 583, 5, 355, 178, 2, 583, - 584, 5, 357, 179, 2, 584, 585, 5, 353, 177, 2, 585, 586, 5, 319, 160, 2, - 586, 587, 5, 335, 168, 2, 587, 588, 5, 345, 173, 2, 588, 589, 5, 357, 179, - 2, 589, 100, 3, 2, 2, 2, 590, 591, 5, 323, 162, 2, 591, 592, 5, 353, 177, - 2, 592, 593, 5, 327, 164, 2, 593, 594, 5, 319, 160, 2, 594, 595, 5, 357, - 179, 2, 595, 596, 5, 327, 164, 2, 596, 102, 3, 2, 2, 2, 597, 598, 5, 323, - 162, 2, 598, 599, 5, 353, 177, 2, 599, 600, 5, 347, 174, 2, 600, 601, 5, - 355, 178, 2, 601, 602, 5, 355, 178, 2, 602, 104, 3, 2, 2, 2, 603, 604, - 5, 323, 162, 2, 604, 605, 5, 359, 180, 2, 605, 606, 5, 353, 177, 2, 606, - 607, 5, 353, 177, 2, 607, 608, 5, 327, 164, 2, 608, 609, 5, 345, 173, 2, - 609, 610, 5, 357, 179, 2, 610, 611, 7, 97, 2, 2, 611, 612, 5, 325, 163, - 2, 612, 613, 5, 319, 160, 2, 613, 614, 5, 357, 179, 2, 614, 615, 5, 327, - 164, 2, 615, 106, 3, 2, 2, 2, 616, 617, 5, 323, 162, 2, 617, 618, 5, 359, - 180, 2, 618, 619, 5, 353, 177, 2, 619, 620, 5, 353, 177, 2, 620, 621, 5, - 327, 164, 2, 621, 622, 5, 345, 173, 2, 622, 623, 5, 357, 179, 2, 623, 624, - 7, 97, 2, 2, 624, 625, 5, 357, 179, 2, 625, 626, 5, 335, 168, 2, 626, 627, - 5, 343, 172, 2, 627, 628, 5, 327, 164, 2, 628, 108, 3, 2, 2, 2, 629, 630, - 5, 323, 162, 2, 630, 631, 5, 359, 180, 2, 631, 632, 5, 353, 177, 2, 632, - 633, 5, 353, 177, 2, 633, 634, 5, 327, 164, 2, 634, 635, 5, 345, 173, 2, - 635, 636, 5, 357, 179, 2, 636, 637, 7, 97, 2, 2, 637, 638, 5, 357, 179, - 2, 638, 639, 5, 335, 168, 2, 639, 640, 5, 343, 172, 2, 640, 641, 5, 327, - 164, 2, 641, 642, 5, 355, 178, 2, 642, 643, 5, 357, 179, 2, 643, 644, 5, - 319, 160, 2, 644, 645, 5, 343, 172, 2, 645, 646, 5, 349, 175, 2, 646, 110, - 3, 2, 2, 2, 647, 648, 5, 325, 163, 2, 648, 649, 5, 319, 160, 2, 649, 650, - 5, 357, 179, 2, 650, 651, 5, 319, 160, 2, 651, 652, 5, 321, 161, 2, 652, - 653, 5, 319, 160, 2, 653, 654, 5, 355, 178, 2, 654, 655, 5, 327, 164, 2, - 655, 112, 3, 2, 2, 2, 656, 657, 5, 325, 163, 2, 657, 658, 5, 327, 164, - 2, 658, 659, 5, 329, 165, 2, 659, 660, 5, 319, 160, 2, 660, 661, 5, 359, - 180, 2, 661, 662, 5, 341, 171, 2, 662, 663, 5, 357, 179, 2, 663, 114, 3, - 2, 2, 2, 664, 665, 5, 325, 163, 2, 665, 666, 5, 327, 164, 2, 666, 667, - 5, 329, 165, 2, 667, 668, 5, 327, 164, 2, 668, 669, 5, 353, 177, 2, 669, - 670, 5, 353, 177, 2, 670, 671, 5, 319, 160, 2, 671, 672, 5, 321, 161, 2, - 672, 673, 5, 341, 171, 2, 673, 674, 5, 327, 164, 2, 674, 116, 3, 2, 2, - 2, 675, 676, 5, 325, 163, 2, 676, 677, 5, 327, 164, 2, 677, 678, 5, 329, - 165, 2, 678, 679, 5, 327, 164, 2, 679, 680, 5, 353, 177, 2, 680, 681, 5, - 353, 177, 2, 681, 682, 5, 327, 164, 2, 682, 683, 5, 325, 163, 2, 683, 118, - 3, 2, 2, 2, 684, 685, 5, 325, 163, 2, 685, 686, 5, 327, 164, 2, 686, 687, - 5, 341, 171, 2, 687, 688, 5, 327, 164, 2, 688, 689, 5, 357, 179, 2, 689, - 690, 5, 327, 164, 2, 690, 120, 3, 2, 2, 2, 691, 692, 5, 325, 163, 2, 692, - 693, 5, 327, 164, 2, 693, 694, 5, 355, 178, 2, 694, 695, 5, 323, 162, 2, - 695, 122, 3, 2, 2, 2, 696, 697, 5, 325, 163, 2, 697, 698, 5, 327, 164, - 2, 698, 699, 5, 357, 179, 2, 699, 700, 5, 319, 160, 2, 700, 701, 5, 323, - 162, 2, 701, 702, 5, 333, 167, 2, 702, 124, 3, 2, 2, 2, 703, 704, 5, 325, - 163, 2, 704, 705, 5, 335, 168, 2, 705, 706, 5, 355, 178, 2, 706, 707, 5, - 357, 179, 2, 707, 708, 5, 335, 168, 2, 708, 709, 5, 345, 173, 2, 709, 710, - 5, 323, 162, 2, 710, 711, 5, 357, 179, 2, 711, 126, 3, 2, 2, 2, 712, 713, - 5, 325, 163, 2, 713, 714, 5, 353, 177, 2, 714, 715, 5, 347, 174, 2, 715, - 716, 5, 349, 175, 2, 716, 128, 3, 2, 2, 2, 717, 718, 5, 327, 164, 2, 718, - 719, 5, 319, 160, 2, 719, 720, 5, 323, 162, 2, 720, 721, 5, 333, 167, 2, - 721, 130, 3, 2, 2, 2, 722, 723, 5, 327, 164, 2, 723, 724, 5, 341, 171, - 2, 724, 725, 5, 355, 178, 2, 725, 726, 5, 327, 164, 2, 726, 132, 3, 2, - 2, 2, 727, 728, 5, 327, 164, 2, 728, 729, 5, 345, 173, 2, 729, 730, 5, - 325, 163, 2, 730, 134, 3, 2, 2, 2, 731, 732, 5, 327, 164, 2, 732, 733, - 5, 355, 178, 2, 733, 734, 5, 323, 162, 2, 734, 735, 5, 319, 160, 2, 735, - 736, 5, 349, 175, 2, 736, 737, 5, 327, 164, 2, 737, 136, 3, 2, 2, 2, 738, - 739, 5, 327, 164, 2, 739, 740, 5, 365, 183, 2, 740, 741, 5, 323, 162, 2, - 741, 742, 5, 327, 164, 2, 742, 743, 5, 349, 175, 2, 743, 744, 5, 357, 179, - 2, 744, 138, 3, 2, 2, 2, 745, 746, 5, 327, 164, 2, 746, 747, 5, 365, 183, - 2, 747, 748, 5, 323, 162, 2, 748, 749, 5, 341, 171, 2, 749, 750, 5, 359, - 180, 2, 750, 751, 5, 355, 178, 2, 751, 752, 5, 335, 168, 2, 752, 753, 5, - 361, 181, 2, 753, 754, 5, 327, 164, 2, 754, 140, 3, 2, 2, 2, 755, 756, - 5, 327, 164, 2, 756, 757, 5, 365, 183, 2, 757, 758, 5, 335, 168, 2, 758, - 759, 5, 355, 178, 2, 759, 760, 5, 357, 179, 2, 760, 761, 5, 355, 178, 2, - 761, 142, 3, 2, 2, 2, 762, 763, 5, 327, 164, 2, 763, 764, 5, 365, 183, - 2, 764, 765, 5, 349, 175, 2, 765, 766, 5, 341, 171, 2, 766, 767, 5, 319, - 160, 2, 767, 768, 5, 335, 168, 2, 768, 769, 5, 345, 173, 2, 769, 144, 3, - 2, 2, 2, 770, 771, 5, 329, 165, 2, 771, 772, 5, 319, 160, 2, 772, 773, - 5, 335, 168, 2, 773, 774, 5, 341, 171, 2, 774, 146, 3, 2, 2, 2, 775, 776, - 5, 329, 165, 2, 776, 777, 5, 347, 174, 2, 777, 778, 5, 353, 177, 2, 778, - 148, 3, 2, 2, 2, 779, 780, 5, 329, 165, 2, 780, 781, 5, 347, 174, 2, 781, - 782, 5, 353, 177, 2, 782, 783, 5, 327, 164, 2, 783, 784, 5, 335, 168, 2, - 784, 785, 5, 331, 166, 2, 785, 786, 5, 345, 173, 2, 786, 150, 3, 2, 2, - 2, 787, 788, 5, 329, 165, 2, 788, 789, 5, 353, 177, 2, 789, 790, 5, 347, - 174, 2, 790, 791, 5, 343, 172, 2, 791, 152, 3, 2, 2, 2, 792, 793, 5, 329, - 165, 2, 793, 794, 5, 359, 180, 2, 794, 795, 5, 341, 171, 2, 795, 796, 5, - 341, 171, 2, 796, 154, 3, 2, 2, 2, 797, 798, 5, 331, 166, 2, 798, 799, - 5, 341, 171, 2, 799, 800, 5, 347, 174, 2, 800, 801, 5, 321, 161, 2, 801, - 156, 3, 2, 2, 2, 802, 803, 5, 331, 166, 2, 803, 804, 5, 353, 177, 2, 804, - 805, 5, 347, 174, 2, 805, 806, 5, 359, 180, 2, 806, 807, 5, 349, 175, 2, - 807, 158, 3, 2, 2, 2, 808, 809, 5, 333, 167, 2, 809, 810, 5, 319, 160, - 2, 810, 811, 5, 361, 181, 2, 811, 812, 5, 335, 168, 2, 812, 813, 5, 345, - 173, 2, 813, 814, 5, 331, 166, 2, 814, 160, 3, 2, 2, 2, 815, 816, 5, 335, - 168, 2, 816, 817, 5, 329, 165, 2, 817, 162, 3, 2, 2, 2, 818, 819, 5, 335, - 168, 2, 819, 820, 5, 331, 166, 2, 820, 821, 5, 345, 173, 2, 821, 822, 5, - 347, 174, 2, 822, 823, 5, 353, 177, 2, 823, 824, 5, 327, 164, 2, 824, 164, - 3, 2, 2, 2, 825, 826, 5, 335, 168, 2, 826, 827, 5, 343, 172, 2, 827, 828, - 5, 343, 172, 2, 828, 829, 5, 327, 164, 2, 829, 830, 5, 325, 163, 2, 830, - 831, 5, 335, 168, 2, 831, 832, 5, 319, 160, 2, 832, 833, 5, 357, 179, 2, - 833, 834, 5, 327, 164, 2, 834, 166, 3, 2, 2, 2, 835, 836, 5, 335, 168, - 2, 836, 837, 5, 345, 173, 2, 837, 168, 3, 2, 2, 2, 838, 839, 5, 335, 168, - 2, 839, 840, 5, 345, 173, 2, 840, 841, 5, 325, 163, 2, 841, 842, 5, 327, - 164, 2, 842, 843, 5, 365, 183, 2, 843, 170, 3, 2, 2, 2, 844, 845, 5, 335, - 168, 2, 845, 846, 5, 345, 173, 2, 846, 847, 5, 325, 163, 2, 847, 848, 5, - 327, 164, 2, 848, 849, 5, 365, 183, 2, 849, 850, 5, 327, 164, 2, 850, 851, - 5, 325, 163, 2, 851, 172, 3, 2, 2, 2, 852, 853, 5, 335, 168, 2, 853, 854, - 5, 345, 173, 2, 854, 855, 5, 335, 168, 2, 855, 856, 5, 357, 179, 2, 856, - 857, 5, 335, 168, 2, 857, 858, 5, 319, 160, 2, 858, 859, 5, 341, 171, 2, - 859, 860, 5, 341, 171, 2, 860, 861, 5, 367, 184, 2, 861, 174, 3, 2, 2, - 2, 862, 863, 5, 335, 168, 2, 863, 864, 5, 345, 173, 2, 864, 865, 5, 345, - 173, 2, 865, 866, 5, 327, 164, 2, 866, 867, 5, 353, 177, 2, 867, 176, 3, - 2, 2, 2, 868, 869, 5, 335, 168, 2, 869, 870, 5, 345, 173, 2, 870, 871, - 5, 355, 178, 2, 871, 872, 5, 327, 164, 2, 872, 873, 5, 353, 177, 2, 873, - 874, 5, 357, 179, 2, 874, 178, 3, 2, 2, 2, 875, 876, 5, 335, 168, 2, 876, - 877, 5, 345, 173, 2, 877, 878, 5, 355, 178, 2, 878, 879, 5, 357, 179, 2, - 879, 880, 5, 327, 164, 2, 880, 881, 5, 319, 160, 2, 881, 882, 5, 325, 163, - 2, 882, 180, 3, 2, 2, 2, 883, 884, 5, 335, 168, 2, 884, 885, 5, 345, 173, - 2, 885, 886, 5, 357, 179, 2, 886, 887, 5, 327, 164, 2, 887, 888, 5, 353, - 177, 2, 888, 889, 5, 355, 178, 2, 889, 890, 5, 327, 164, 2, 890, 891, 5, - 323, 162, 2, 891, 892, 5, 357, 179, 2, 892, 182, 3, 2, 2, 2, 893, 894, - 5, 335, 168, 2, 894, 895, 5, 345, 173, 2, 895, 896, 5, 357, 179, 2, 896, - 897, 5, 347, 174, 2, 897, 184, 3, 2, 2, 2, 898, 899, 5, 335, 168, 2, 899, - 900, 5, 355, 178, 2, 900, 186, 3, 2, 2, 2, 901, 902, 5, 335, 168, 2, 902, - 903, 5, 355, 178, 2, 903, 904, 5, 345, 173, 2, 904, 905, 5, 359, 180, 2, - 905, 906, 5, 341, 171, 2, 906, 907, 5, 341, 171, 2, 907, 188, 3, 2, 2, - 2, 908, 909, 5, 337, 169, 2, 909, 910, 5, 347, 174, 2, 910, 911, 5, 335, - 168, 2, 911, 912, 5, 345, 173, 2, 912, 190, 3, 2, 2, 2, 913, 914, 5, 339, - 170, 2, 914, 915, 5, 327, 164, 2, 915, 916, 5, 367, 184, 2, 916, 192, 3, - 2, 2, 2, 917, 918, 5, 341, 171, 2, 918, 919, 5, 327, 164, 2, 919, 920, - 5, 329, 165, 2, 920, 921, 5, 357, 179, 2, 921, 194, 3, 2, 2, 2, 922, 923, - 5, 341, 171, 2, 923, 924, 5, 335, 168, 2, 924, 925, 5, 339, 170, 2, 925, - 926, 5, 327, 164, 2, 926, 196, 3, 2, 2, 2, 927, 928, 5, 341, 171, 2, 928, - 929, 5, 335, 168, 2, 929, 930, 5, 343, 172, 2, 930, 931, 5, 335, 168, 2, - 931, 932, 5, 357, 179, 2, 932, 198, 3, 2, 2, 2, 933, 934, 5, 343, 172, - 2, 934, 935, 5, 319, 160, 2, 935, 936, 5, 357, 179, 2, 936, 937, 5, 323, - 162, 2, 937, 938, 5, 333, 167, 2, 938, 200, 3, 2, 2, 2, 939, 940, 5, 345, - 173, 2, 940, 941, 5, 319, 160, 2, 941, 942, 5, 357, 179, 2, 942, 943, 5, - 359, 180, 2, 943, 944, 5, 353, 177, 2, 944, 945, 5, 319, 160, 2, 945, 946, - 5, 341, 171, 2, 946, 202, 3, 2, 2, 2, 947, 948, 5, 345, 173, 2, 948, 949, - 5, 347, 174, 2, 949, 204, 3, 2, 2, 2, 950, 951, 5, 345, 173, 2, 951, 952, - 5, 347, 174, 2, 952, 953, 5, 357, 179, 2, 953, 206, 3, 2, 2, 2, 954, 955, - 5, 345, 173, 2, 955, 956, 5, 347, 174, 2, 956, 957, 5, 357, 179, 2, 957, - 958, 5, 345, 173, 2, 958, 959, 5, 359, 180, 2, 959, 960, 5, 341, 171, 2, - 960, 961, 5, 341, 171, 2, 961, 208, 3, 2, 2, 2, 962, 963, 5, 345, 173, - 2, 963, 964, 5, 359, 180, 2, 964, 965, 5, 341, 171, 2, 965, 966, 5, 341, - 171, 2, 966, 210, 3, 2, 2, 2, 967, 968, 5, 347, 174, 2, 968, 969, 5, 329, - 165, 2, 969, 212, 3, 2, 2, 2, 970, 971, 5, 347, 174, 2, 971, 972, 5, 329, - 165, 2, 972, 973, 5, 329, 165, 2, 973, 974, 5, 355, 178, 2, 974, 975, 5, - 327, 164, 2, 975, 976, 5, 357, 179, 2, 976, 214, 3, 2, 2, 2, 977, 978, - 5, 347, 174, 2, 978, 979, 5, 345, 173, 2, 979, 216, 3, 2, 2, 2, 980, 981, - 5, 347, 174, 2, 981, 982, 5, 353, 177, 2, 982, 218, 3, 2, 2, 2, 983, 984, - 5, 347, 174, 2, 984, 985, 5, 353, 177, 2, 985, 986, 5, 325, 163, 2, 986, - 987, 5, 327, 164, 2, 987, 988, 5, 353, 177, 2, 988, 220, 3, 2, 2, 2, 989, - 990, 5, 347, 174, 2, 990, 991, 5, 359, 180, 2, 991, 992, 5, 357, 179, 2, - 992, 993, 5, 327, 164, 2, 993, 994, 5, 353, 177, 2, 994, 222, 3, 2, 2, - 2, 995, 996, 5, 349, 175, 2, 996, 997, 5, 341, 171, 2, 997, 998, 5, 319, - 160, 2, 998, 999, 5, 345, 173, 2, 999, 224, 3, 2, 2, 2, 1000, 1001, 5, - 349, 175, 2, 1001, 1002, 5, 353, 177, 2, 1002, 1003, 5, 319, 160, 2, 1003, - 1004, 5, 331, 166, 2, 1004, 1005, 5, 343, 172, 2, 1005, 1006, 5, 319, 160, - 2, 1006, 226, 3, 2, 2, 2, 1007, 1008, 5, 349, 175, 2, 1008, 1009, 5, 353, - 177, 2, 1009, 1010, 5, 335, 168, 2, 1010, 1011, 5, 343, 172, 2, 1011, 1012, - 5, 319, 160, 2, 1012, 1013, 5, 353, 177, 2, 1013, 1014, 5, 367, 184, 2, - 1014, 228, 3, 2, 2, 2, 1015, 1016, 5, 351, 176, 2, 1016, 1017, 5, 359, - 180, 2, 1017, 1018, 5, 327, 164, 2, 1018, 1019, 5, 353, 177, 2, 1019, 1020, - 5, 367, 184, 2, 1020, 230, 3, 2, 2, 2, 1021, 1022, 5, 353, 177, 2, 1022, - 1023, 5, 319, 160, 2, 1023, 1024, 5, 335, 168, 2, 1024, 1025, 5, 355, 178, - 2, 1025, 1026, 5, 327, 164, 2, 1026, 232, 3, 2, 2, 2, 1027, 1028, 5, 353, - 177, 2, 1028, 1029, 5, 327, 164, 2, 1029, 1030, 5, 323, 162, 2, 1030, 1031, - 5, 359, 180, 2, 1031, 1032, 5, 353, 177, 2, 1032, 1033, 5, 355, 178, 2, - 1033, 1034, 5, 335, 168, 2, 1034, 1035, 5, 361, 181, 2, 1035, 1036, 5, - 327, 164, 2, 1036, 234, 3, 2, 2, 2, 1037, 1038, 5, 353, 177, 2, 1038, 1039, - 5, 327, 164, 2, 1039, 1040, 5, 329, 165, 2, 1040, 1041, 5, 327, 164, 2, - 1041, 1042, 5, 353, 177, 2, 1042, 1043, 5, 327, 164, 2, 1043, 1044, 5, - 345, 173, 2, 1044, 1045, 5, 323, 162, 2, 1045, 1046, 5, 327, 164, 2, 1046, - 1047, 5, 355, 178, 2, 1047, 236, 3, 2, 2, 2, 1048, 1049, 5, 353, 177, 2, - 1049, 1050, 5, 327, 164, 2, 1050, 1051, 5, 331, 166, 2, 1051, 1052, 5, - 327, 164, 2, 1052, 1053, 5, 365, 183, 2, 1053, 1054, 5, 349, 175, 2, 1054, - 238, 3, 2, 2, 2, 1055, 1056, 5, 353, 177, 2, 1056, 1057, 5, 327, 164, 2, - 1057, 1058, 5, 335, 168, 2, 1058, 1059, 5, 345, 173, 2, 1059, 1060, 5, - 325, 163, 2, 1060, 1061, 5, 327, 164, 2, 1061, 1062, 5, 365, 183, 2, 1062, - 240, 3, 2, 2, 2, 1063, 1064, 5, 353, 177, 2, 1064, 1065, 5, 327, 164, 2, - 1065, 1066, 5, 341, 171, 2, 1066, 1067, 5, 327, 164, 2, 1067, 1068, 5, - 319, 160, 2, 1068, 1069, 5, 355, 178, 2, 1069, 1070, 5, 327, 164, 2, 1070, - 242, 3, 2, 2, 2, 1071, 1072, 5, 353, 177, 2, 1072, 1073, 5, 327, 164, 2, - 1073, 1074, 5, 345, 173, 2, 1074, 1075, 5, 319, 160, 2, 1075, 1076, 5, - 343, 172, 2, 1076, 1077, 5, 327, 164, 2, 1077, 244, 3, 2, 2, 2, 1078, 1079, - 5, 353, 177, 2, 1079, 1080, 5, 327, 164, 2, 1080, 1081, 5, 349, 175, 2, - 1081, 1082, 5, 341, 171, 2, 1082, 1083, 5, 319, 160, 2, 1083, 1084, 5, - 323, 162, 2, 1084, 1085, 5, 327, 164, 2, 1085, 246, 3, 2, 2, 2, 1086, 1087, - 5, 353, 177, 2, 1087, 1088, 5, 327, 164, 2, 1088, 1089, 5, 355, 178, 2, - 1089, 1090, 5, 357, 179, 2, 1090, 1091, 5, 353, 177, 2, 1091, 1092, 5, - 335, 168, 2, 1092, 1093, 5, 323, 162, 2, 1093, 1094, 5, 357, 179, 2, 1094, - 248, 3, 2, 2, 2, 1095, 1096, 5, 353, 177, 2, 1096, 1097, 5, 335, 168, 2, - 1097, 1098, 5, 331, 166, 2, 1098, 1099, 5, 333, 167, 2, 1099, 1100, 5, - 357, 179, 2, 1100, 250, 3, 2, 2, 2, 1101, 1102, 5, 353, 177, 2, 1102, 1103, - 5, 347, 174, 2, 1103, 1104, 5, 341, 171, 2, 1104, 1105, 5, 341, 171, 2, - 1105, 1106, 5, 321, 161, 2, 1106, 1107, 5, 319, 160, 2, 1107, 1108, 5, - 323, 162, 2, 1108, 1109, 5, 339, 170, 2, 1109, 252, 3, 2, 2, 2, 1110, 1111, - 5, 353, 177, 2, 1111, 1112, 5, 347, 174, 2, 1112, 1113, 5, 363, 182, 2, - 1113, 254, 3, 2, 2, 2, 1114, 1115, 5, 355, 178, 2, 1115, 1116, 5, 319, - 160, 2, 1116, 1117, 5, 361, 181, 2, 1117, 1118, 5, 327, 164, 2, 1118, 1119, - 5, 349, 175, 2, 1119, 1120, 5, 347, 174, 2, 1120, 1121, 5, 335, 168, 2, - 1121, 1122, 5, 345, 173, 2, 1122, 1123, 5, 357, 179, 2, 1123, 256, 3, 2, - 2, 2, 1124, 1125, 5, 355, 178, 2, 1125, 1126, 5, 327, 164, 2, 1126, 1127, - 5, 341, 171, 2, 1127, 1128, 5, 327, 164, 2, 1128, 1129, 5, 323, 162, 2, - 1129, 1130, 5, 357, 179, 2, 1130, 258, 3, 2, 2, 2, 1131, 1132, 5, 355, - 178, 2, 1132, 1133, 5, 327, 164, 2, 1133, 1134, 5, 357, 179, 2, 1134, 260, - 3, 2, 2, 2, 1135, 1136, 5, 357, 179, 2, 1136, 1137, 5, 319, 160, 2, 1137, - 1138, 5, 321, 161, 2, 1138, 1139, 5, 341, 171, 2, 1139, 1140, 5, 327, 164, - 2, 1140, 262, 3, 2, 2, 2, 1141, 1142, 5, 357, 179, 2, 1142, 1143, 5, 327, - 164, 2, 1143, 1144, 5, 343, 172, 2, 1144, 1145, 5, 349, 175, 2, 1145, 264, - 3, 2, 2, 2, 1146, 1147, 5, 357, 179, 2, 1147, 1148, 5, 327, 164, 2, 1148, - 1149, 5, 343, 172, 2, 1149, 1150, 5, 349, 175, 2, 1150, 1151, 5, 347, 174, - 2, 1151, 1152, 5, 353, 177, 2, 1152, 1153, 5, 319, 160, 2, 1153, 1154, - 5, 353, 177, 2, 1154, 1155, 5, 367, 184, 2, 1155, 266, 3, 2, 2, 2, 1156, - 1157, 5, 357, 179, 2, 1157, 1158, 5, 333, 167, 2, 1158, 1159, 5, 327, 164, - 2, 1159, 1160, 5, 345, 173, 2, 1160, 268, 3, 2, 2, 2, 1161, 1162, 5, 357, - 179, 2, 1162, 1163, 5, 347, 174, 2, 1163, 270, 3, 2, 2, 2, 1164, 1165, - 5, 357, 179, 2, 1165, 1166, 5, 353, 177, 2, 1166, 1167, 5, 319, 160, 2, - 1167, 1168, 5, 345, 173, 2, 1168, 1169, 5, 355, 178, 2, 1169, 1170, 5, - 319, 160, 2, 1170, 1171, 5, 323, 162, 2, 1171, 1172, 5, 357, 179, 2, 1172, - 1173, 5, 335, 168, 2, 1173, 1174, 5, 347, 174, 2, 1174, 1175, 5, 345, 173, - 2, 1175, 272, 3, 2, 2, 2, 1176, 1177, 5, 357, 179, 2, 1177, 1178, 5, 353, - 177, 2, 1178, 1179, 5, 335, 168, 2, 1179, 1180, 5, 331, 166, 2, 1180, 1181, - 5, 331, 166, 2, 1181, 1182, 5, 327, 164, 2, 1182, 1183, 5, 353, 177, 2, - 1183, 274, 3, 2, 2, 2, 1184, 1185, 5, 359, 180, 2, 1185, 1186, 5, 345, - 173, 2, 1186, 1187, 5, 335, 168, 2, 1187, 1188, 5, 347, 174, 2, 1188, 1189, - 5, 345, 173, 2, 1189, 276, 3, 2, 2, 2, 1190, 1191, 5, 359, 180, 2, 1191, - 1192, 5, 345, 173, 2, 1192, 1193, 5, 335, 168, 2, 1193, 1194, 5, 351, 176, - 2, 1194, 1195, 5, 359, 180, 2, 1195, 1196, 5, 327, 164, 2, 1196, 278, 3, - 2, 2, 2, 1197, 1198, 5, 359, 180, 2, 1198, 1199, 5, 349, 175, 2, 1199, - 1200, 5, 325, 163, 2, 1200, 1201, 5, 319, 160, 2, 1201, 1202, 5, 357, 179, - 2, 1202, 1203, 5, 327, 164, 2, 1203, 280, 3, 2, 2, 2, 1204, 1205, 5, 359, - 180, 2, 1205, 1206, 5, 355, 178, 2, 1206, 1207, 5, 335, 168, 2, 1207, 1208, - 5, 345, 173, 2, 1208, 1209, 5, 331, 166, 2, 1209, 282, 3, 2, 2, 2, 1210, - 1211, 5, 361, 181, 2, 1211, 1212, 5, 319, 160, 2, 1212, 1213, 5, 323, 162, - 2, 1213, 1214, 5, 359, 180, 2, 1214, 1215, 5, 359, 180, 2, 1215, 1216, - 5, 343, 172, 2, 1216, 284, 3, 2, 2, 2, 1217, 1218, 5, 361, 181, 2, 1218, - 1219, 5, 319, 160, 2, 1219, 1220, 5, 341, 171, 2, 1220, 1221, 5, 359, 180, - 2, 1221, 1222, 5, 327, 164, 2, 1222, 1223, 5, 355, 178, 2, 1223, 286, 3, - 2, 2, 2, 1224, 1225, 5, 361, 181, 2, 1225, 1226, 5, 335, 168, 2, 1226, - 1227, 5, 327, 164, 2, 1227, 1228, 5, 363, 182, 2, 1228, 288, 3, 2, 2, 2, - 1229, 1230, 5, 361, 181, 2, 1230, 1231, 5, 335, 168, 2, 1231, 1232, 5, - 353, 177, 2, 1232, 1233, 5, 357, 179, 2, 1233, 1234, 5, 359, 180, 2, 1234, - 1235, 5, 319, 160, 2, 1235, 1236, 5, 341, 171, 2, 1236, 290, 3, 2, 2, 2, - 1237, 1238, 5, 363, 182, 2, 1238, 1239, 5, 333, 167, 2, 1239, 1240, 5, - 327, 164, 2, 1240, 1241, 5, 345, 173, 2, 1241, 292, 3, 2, 2, 2, 1242, 1243, - 5, 363, 182, 2, 1243, 1244, 5, 333, 167, 2, 1244, 1245, 5, 327, 164, 2, - 1245, 1246, 5, 353, 177, 2, 1246, 1247, 5, 327, 164, 2, 1247, 294, 3, 2, - 2, 2, 1248, 1249, 5, 363, 182, 2, 1249, 1250, 5, 335, 168, 2, 1250, 1251, - 5, 357, 179, 2, 1251, 1252, 5, 333, 167, 2, 1252, 296, 3, 2, 2, 2, 1253, - 1254, 5, 363, 182, 2, 1254, 1255, 5, 335, 168, 2, 1255, 1256, 5, 357, 179, - 2, 1256, 1257, 5, 333, 167, 2, 1257, 1258, 5, 347, 174, 2, 1258, 1259, - 5, 359, 180, 2, 1259, 1260, 5, 357, 179, 2, 1260, 298, 3, 2, 2, 2, 1261, - 1267, 7, 36, 2, 2, 1262, 1266, 10, 2, 2, 2, 1263, 1264, 7, 36, 2, 2, 1264, - 1266, 7, 36, 2, 2, 1265, 1262, 3, 2, 2, 2, 1265, 1263, 3, 2, 2, 2, 1266, - 1269, 3, 2, 2, 2, 1267, 1265, 3, 2, 2, 2, 1267, 1268, 3, 2, 2, 2, 1268, - 1270, 3, 2, 2, 2, 1269, 1267, 3, 2, 2, 2, 1270, 1297, 7, 36, 2, 2, 1271, - 1277, 7, 98, 2, 2, 1272, 1276, 10, 3, 2, 2, 1273, 1274, 7, 98, 2, 2, 1274, - 1276, 7, 98, 2, 2, 1275, 1272, 3, 2, 2, 2, 1275, 1273, 3, 2, 2, 2, 1276, - 1279, 3, 2, 2, 2, 1277, 1275, 3, 2, 2, 2, 1277, 1278, 3, 2, 2, 2, 1278, - 1280, 3, 2, 2, 2, 1279, 1277, 3, 2, 2, 2, 1280, 1297, 7, 98, 2, 2, 1281, - 1285, 7, 93, 2, 2, 1282, 1284, 10, 4, 2, 2, 1283, 1282, 3, 2, 2, 2, 1284, - 1287, 3, 2, 2, 2, 1285, 1283, 3, 2, 2, 2, 1285, 1286, 3, 2, 2, 2, 1286, - 1288, 3, 2, 2, 2, 1287, 1285, 3, 2, 2, 2, 1288, 1297, 7, 95, 2, 2, 1289, - 1293, 9, 5, 2, 2, 1290, 1292, 9, 6, 2, 2, 1291, 1290, 3, 2, 2, 2, 1292, - 1295, 3, 2, 2, 2, 1293, 1291, 3, 2, 2, 2, 1293, 1294, 3, 2, 2, 2, 1294, - 1297, 3, 2, 2, 2, 1295, 1293, 3, 2, 2, 2, 1296, 1261, 3, 2, 2, 2, 1296, - 1271, 3, 2, 2, 2, 1296, 1281, 3, 2, 2, 2, 1296, 1289, 3, 2, 2, 2, 1297, - 300, 3, 2, 2, 2, 1298, 1300, 5, 317, 159, 2, 1299, 1298, 3, 2, 2, 2, 1300, - 1301, 3, 2, 2, 2, 1301, 1299, 3, 2, 2, 2, 1301, 1302, 3, 2, 2, 2, 1302, - 1310, 3, 2, 2, 2, 1303, 1307, 7, 48, 2, 2, 1304, 1306, 5, 317, 159, 2, - 1305, 1304, 3, 2, 2, 2, 1306, 1309, 3, 2, 2, 2, 1307, 1305, 3, 2, 2, 2, - 1307, 1308, 3, 2, 2, 2, 1308, 1311, 3, 2, 2, 2, 1309, 1307, 3, 2, 2, 2, - 1310, 1303, 3, 2, 2, 2, 1310, 1311, 3, 2, 2, 2, 1311, 1321, 3, 2, 2, 2, - 1312, 1314, 5, 327, 164, 2, 1313, 1315, 9, 7, 2, 2, 1314, 1313, 3, 2, 2, - 2, 1314, 1315, 3, 2, 2, 2, 1315, 1317, 3, 2, 2, 2, 1316, 1318, 5, 317, - 159, 2, 1317, 1316, 3, 2, 2, 2, 1318, 1319, 3, 2, 2, 2, 1319, 1317, 3, - 2, 2, 2, 1319, 1320, 3, 2, 2, 2, 1320, 1322, 3, 2, 2, 2, 1321, 1312, 3, - 2, 2, 2, 1321, 1322, 3, 2, 2, 2, 1322, 1341, 3, 2, 2, 2, 1323, 1325, 7, - 48, 2, 2, 1324, 1326, 5, 317, 159, 2, 1325, 1324, 3, 2, 2, 2, 1326, 1327, - 3, 2, 2, 2, 1327, 1325, 3, 2, 2, 2, 1327, 1328, 3, 2, 2, 2, 1328, 1338, - 3, 2, 2, 2, 1329, 1331, 5, 327, 164, 2, 1330, 1332, 9, 7, 2, 2, 1331, 1330, - 3, 2, 2, 2, 1331, 1332, 3, 2, 2, 2, 1332, 1334, 3, 2, 2, 2, 1333, 1335, - 5, 317, 159, 2, 1334, 1333, 3, 2, 2, 2, 1335, 1336, 3, 2, 2, 2, 1336, 1334, - 3, 2, 2, 2, 1336, 1337, 3, 2, 2, 2, 1337, 1339, 3, 2, 2, 2, 1338, 1329, - 3, 2, 2, 2, 1338, 1339, 3, 2, 2, 2, 1339, 1341, 3, 2, 2, 2, 1340, 1299, - 3, 2, 2, 2, 1340, 1323, 3, 2, 2, 2, 1341, 302, 3, 2, 2, 2, 1342, 1346, - 7, 65, 2, 2, 1343, 1345, 5, 317, 159, 2, 1344, 1343, 3, 2, 2, 2, 1345, - 1348, 3, 2, 2, 2, 1346, 1344, 3, 2, 2, 2, 1346, 1347, 3, 2, 2, 2, 1347, - 1352, 3, 2, 2, 2, 1348, 1346, 3, 2, 2, 2, 1349, 1350, 9, 8, 2, 2, 1350, - 1352, 5, 299, 150, 2, 1351, 1342, 3, 2, 2, 2, 1351, 1349, 3, 2, 2, 2, 1352, - 304, 3, 2, 2, 2, 1353, 1359, 7, 41, 2, 2, 1354, 1358, 10, 9, 2, 2, 1355, - 1356, 7, 41, 2, 2, 1356, 1358, 7, 41, 2, 2, 1357, 1354, 3, 2, 2, 2, 1357, - 1355, 3, 2, 2, 2, 1358, 1361, 3, 2, 2, 2, 1359, 1357, 3, 2, 2, 2, 1359, - 1360, 3, 2, 2, 2, 1360, 1362, 3, 2, 2, 2, 1361, 1359, 3, 2, 2, 2, 1362, - 1363, 7, 41, 2, 2, 1363, 306, 3, 2, 2, 2, 1364, 1365, 5, 365, 183, 2, 1365, - 1366, 5, 305, 153, 2, 1366, 308, 3, 2, 2, 2, 1367, 1368, 7, 47, 2, 2, 1368, - 1369, 7, 47, 2, 2, 1369, 1373, 3, 2, 2, 2, 1370, 1372, 10, 10, 2, 2, 1371, - 1370, 3, 2, 2, 2, 1372, 1375, 3, 2, 2, 2, 1373, 1371, 3, 2, 2, 2, 1373, - 1374, 3, 2, 2, 2, 1374, 1376, 3, 2, 2, 2, 1375, 1373, 3, 2, 2, 2, 1376, - 1377, 8, 155, 2, 2, 1377, 310, 3, 2, 2, 2, 1378, 1379, 7, 49, 2, 2, 1379, - 1380, 7, 44, 2, 2, 1380, 1384, 3, 2, 2, 2, 1381, 1383, 11, 2, 2, 2, 1382, - 1381, 3, 2, 2, 2, 1383, 1386, 3, 2, 2, 2, 1384, 1385, 3, 2, 2, 2, 1384, - 1382, 3, 2, 2, 2, 1385, 1390, 3, 2, 2, 2, 1386, 1384, 3, 2, 2, 2, 1387, - 1388, 7, 44, 2, 2, 1388, 1391, 7, 49, 2, 2, 1389, 1391, 7, 2, 2, 3, 1390, - 1387, 3, 2, 2, 2, 1390, 1389, 3, 2, 2, 2, 1391, 1392, 3, 2, 2, 2, 1392, - 1393, 8, 156, 2, 2, 1393, 312, 3, 2, 2, 2, 1394, 1395, 9, 11, 2, 2, 1395, - 1396, 3, 2, 2, 2, 1396, 1397, 8, 157, 2, 2, 1397, 314, 3, 2, 2, 2, 1398, - 1399, 11, 2, 2, 2, 1399, 316, 3, 2, 2, 2, 1400, 1401, 9, 12, 2, 2, 1401, - 318, 3, 2, 2, 2, 1402, 1403, 9, 13, 2, 2, 1403, 320, 3, 2, 2, 2, 1404, - 1405, 9, 14, 2, 2, 1405, 322, 3, 2, 2, 2, 1406, 1407, 9, 15, 2, 2, 1407, - 324, 3, 2, 2, 2, 1408, 1409, 9, 16, 2, 2, 1409, 326, 3, 2, 2, 2, 1410, - 1411, 9, 17, 2, 2, 1411, 328, 3, 2, 2, 2, 1412, 1413, 9, 18, 2, 2, 1413, - 330, 3, 2, 2, 2, 1414, 1415, 9, 19, 2, 2, 1415, 332, 3, 2, 2, 2, 1416, - 1417, 9, 20, 2, 2, 1417, 334, 3, 2, 2, 2, 1418, 1419, 9, 21, 2, 2, 1419, - 336, 3, 2, 2, 2, 1420, 1421, 9, 22, 2, 2, 1421, 338, 3, 2, 2, 2, 1422, - 1423, 9, 23, 2, 2, 1423, 340, 3, 2, 2, 2, 1424, 1425, 9, 24, 2, 2, 1425, - 342, 3, 2, 2, 2, 1426, 1427, 9, 25, 2, 2, 1427, 344, 3, 2, 2, 2, 1428, - 1429, 9, 26, 2, 2, 1429, 346, 3, 2, 2, 2, 1430, 1431, 9, 27, 2, 2, 1431, - 348, 3, 2, 2, 2, 1432, 1433, 9, 28, 2, 2, 1433, 350, 3, 2, 2, 2, 1434, - 1435, 9, 29, 2, 2, 1435, 352, 3, 2, 2, 2, 1436, 1437, 9, 30, 2, 2, 1437, - 354, 3, 2, 2, 2, 1438, 1439, 9, 31, 2, 2, 1439, 356, 3, 2, 2, 2, 1440, - 1441, 9, 32, 2, 2, 1441, 358, 3, 2, 2, 2, 1442, 1443, 9, 33, 2, 2, 1443, - 360, 3, 2, 2, 2, 1444, 1445, 9, 34, 2, 2, 1445, 362, 3, 2, 2, 2, 1446, - 1447, 9, 35, 2, 2, 1447, 364, 3, 2, 2, 2, 1448, 1449, 9, 36, 2, 2, 1449, - 366, 3, 2, 2, 2, 1450, 1451, 9, 37, 2, 2, 1451, 368, 3, 2, 2, 2, 1452, - 1453, 9, 38, 2, 2, 1453, 370, 3, 2, 2, 2, 28, 2, 1265, 1267, 1275, 1277, - 1285, 1293, 1296, 1301, 1307, 1310, 1314, 1319, 1321, 1327, 1331, 1336, - 1338, 1340, 1346, 1351, 1357, 1359, 1373, 1384, 1390, 3, 2, 3, 2, -} - -var lexerDeserializer = antlr.NewATNDeserializer(nil) -var lexerAtn = lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn) - -var lexerChannelNames = []string{ - "DEFAULT_TOKEN_CHANNEL", "HIDDEN", -} - -var lexerModeNames = []string{ - "DEFAULT_MODE", -} - -var lexerLiteralNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", -} - -var lexerSymbolicNames = []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", "K_ABORT", "K_ACTION", - "K_ADD", "K_AFTER", "K_ALL", "K_ALTER", "K_ANALYZE", "K_AND", "K_AS", "K_ASC", - "K_ATTACH", "K_AUTOINCREMENT", "K_BEFORE", "K_BEGIN", "K_BETWEEN", "K_BY", - "K_CASCADE", "K_CASE", "K_CAST", "K_CHECK", "K_COLLATE", "K_COLUMN", "K_COMMIT", - "K_CONFLICT", "K_CONSTRAINT", "K_CREATE", "K_CROSS", "K_CURRENT_DATE", - "K_CURRENT_TIME", "K_CURRENT_TIMESTAMP", "K_DATABASE", "K_DEFAULT", "K_DEFERRABLE", - "K_DEFERRED", "K_DELETE", "K_DESC", "K_DETACH", "K_DISTINCT", "K_DROP", - "K_EACH", "K_ELSE", "K_END", "K_ESCAPE", "K_EXCEPT", "K_EXCLUSIVE", "K_EXISTS", - "K_EXPLAIN", "K_FAIL", "K_FOR", "K_FOREIGN", "K_FROM", "K_FULL", "K_GLOB", - "K_GROUP", "K_HAVING", "K_IF", "K_IGNORE", "K_IMMEDIATE", "K_IN", "K_INDEX", - "K_INDEXED", "K_INITIALLY", "K_INNER", "K_INSERT", "K_INSTEAD", "K_INTERSECT", - "K_INTO", "K_IS", "K_ISNULL", "K_JOIN", "K_KEY", "K_LEFT", "K_LIKE", "K_LIMIT", - "K_MATCH", "K_NATURAL", "K_NO", "K_NOT", "K_NOTNULL", "K_NULL", "K_OF", - "K_OFFSET", "K_ON", "K_OR", "K_ORDER", "K_OUTER", "K_PLAN", "K_PRAGMA", - "K_PRIMARY", "K_QUERY", "K_RAISE", "K_RECURSIVE", "K_REFERENCES", "K_REGEXP", - "K_REINDEX", "K_RELEASE", "K_RENAME", "K_REPLACE", "K_RESTRICT", "K_RIGHT", - "K_ROLLBACK", "K_ROW", "K_SAVEPOINT", "K_SELECT", "K_SET", "K_TABLE", "K_TEMP", - "K_TEMPORARY", "K_THEN", "K_TO", "K_TRANSACTION", "K_TRIGGER", "K_UNION", - "K_UNIQUE", "K_UPDATE", "K_USING", "K_VACUUM", "K_VALUES", "K_VIEW", "K_VIRTUAL", - "K_WHEN", "K_WHERE", "K_WITH", "K_WITHOUT", "IDENTIFIER", "NUMERIC_LITERAL", - "BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", - "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", -} - -var lexerRuleNames = []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", "K_ABORT", "K_ACTION", - "K_ADD", "K_AFTER", "K_ALL", "K_ALTER", "K_ANALYZE", "K_AND", "K_AS", "K_ASC", - "K_ATTACH", "K_AUTOINCREMENT", "K_BEFORE", "K_BEGIN", "K_BETWEEN", "K_BY", - "K_CASCADE", "K_CASE", "K_CAST", "K_CHECK", "K_COLLATE", "K_COLUMN", "K_COMMIT", - "K_CONFLICT", "K_CONSTRAINT", "K_CREATE", "K_CROSS", "K_CURRENT_DATE", - "K_CURRENT_TIME", "K_CURRENT_TIMESTAMP", "K_DATABASE", "K_DEFAULT", "K_DEFERRABLE", - "K_DEFERRED", "K_DELETE", "K_DESC", "K_DETACH", "K_DISTINCT", "K_DROP", - "K_EACH", "K_ELSE", "K_END", "K_ESCAPE", "K_EXCEPT", "K_EXCLUSIVE", "K_EXISTS", - "K_EXPLAIN", "K_FAIL", "K_FOR", "K_FOREIGN", "K_FROM", "K_FULL", "K_GLOB", - "K_GROUP", "K_HAVING", "K_IF", "K_IGNORE", "K_IMMEDIATE", "K_IN", "K_INDEX", - "K_INDEXED", "K_INITIALLY", "K_INNER", "K_INSERT", "K_INSTEAD", "K_INTERSECT", - "K_INTO", "K_IS", "K_ISNULL", "K_JOIN", "K_KEY", "K_LEFT", "K_LIKE", "K_LIMIT", - "K_MATCH", "K_NATURAL", "K_NO", "K_NOT", "K_NOTNULL", "K_NULL", "K_OF", - "K_OFFSET", "K_ON", "K_OR", "K_ORDER", "K_OUTER", "K_PLAN", "K_PRAGMA", - "K_PRIMARY", "K_QUERY", "K_RAISE", "K_RECURSIVE", "K_REFERENCES", "K_REGEXP", - "K_REINDEX", "K_RELEASE", "K_RENAME", "K_REPLACE", "K_RESTRICT", "K_RIGHT", - "K_ROLLBACK", "K_ROW", "K_SAVEPOINT", "K_SELECT", "K_SET", "K_TABLE", "K_TEMP", - "K_TEMPORARY", "K_THEN", "K_TO", "K_TRANSACTION", "K_TRIGGER", "K_UNION", - "K_UNIQUE", "K_UPDATE", "K_USING", "K_VACUUM", "K_VALUES", "K_VIEW", "K_VIRTUAL", - "K_WHEN", "K_WHERE", "K_WITH", "K_WITHOUT", "IDENTIFIER", "NUMERIC_LITERAL", - "BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", - "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", "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", -} - type SQLiteLexer struct { *antlr.BaseLexer channelNames []string @@ -772,27 +21,990 @@ type SQLiteLexer struct { // TODO: EOF string } -var lexerDecisionToDFA = make([]*antlr.DFA, len(lexerAtn.DecisionToState)) +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 init() { - for index, ds := range lexerAtn.DecisionToState { - lexerDecisionToDFA[index] = antlr.NewDFA(ds, index) +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", "PTR2", "PTR", "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", + "PTR2", "PTR", "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, 197, 1829, 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, 2, 223, 7, 223, 2, 224, 7, 224, 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, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, + 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, + 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, + 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, + 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, + 1, 26, 1, 26, 1, 27, 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, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, + 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, + 1, 34, 1, 34, 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, 37, 1, 37, + 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, 39, 1, 39, 1, 39, 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, 42, 1, + 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, + 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 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, 46, 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, 49, 1, 49, 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, 50, 1, 50, 1, 50, 1, + 50, 1, 50, 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, 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, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, + 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 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, 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, 58, 1, + 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 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, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, + 1, 63, 1, 63, 1, 63, 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, 65, 1, 66, 1, 66, 1, 66, + 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 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, 70, 1, 70, 1, 71, 1, + 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, + 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, + 74, 1, 74, 1, 75, 1, 75, 1, 75, 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, 78, 1, + 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 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, 82, 1, + 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, + 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 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, 86, + 1, 86, 1, 87, 1, 87, 1, 87, 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, 89, 1, 89, 1, 89, 1, 89, + 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, + 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, + 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, + 94, 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, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, + 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, + 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, + 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, + 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, + 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, + 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, + 108, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, + 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, + 112, 1, 112, 1, 112, 1, 113, 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, 114, 1, 114, 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, 117, 1, 117, 1, 117, 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, 118, 1, 118, 1, 118, 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, 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, + 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, 124, 1, 124, 1, 124, 1, 125, 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, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, + 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, + 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, + 130, 1, 130, 1, 130, 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, + 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 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, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, + 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, + 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 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, 140, 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, 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, 145, 1, 145, 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, 147, 1, 147, 1, 147, 1, + 147, 1, 147, 1, 148, 1, 148, 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, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, + 152, 1, 152, 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, 153, 1, + 153, 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, 157, 1, 157, 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, 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, 161, 1, 161, 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, 164, 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, 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, 167, 1, + 168, 1, 168, 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, + 170, 1, 170, 1, 170, 1, 170, 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, + 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, + 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 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, 176, 1, 177, 1, + 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, + 178, 1, 178, 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, 181, 1, 181, 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, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, + 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 186, 1, + 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, + 187, 1, 187, 5, 187, 1636, 8, 187, 10, 187, 12, 187, 1639, 9, 187, 1, 187, + 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1646, 8, 187, 10, 187, 12, 187, + 1649, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1654, 8, 187, 10, 187, 12, + 187, 1657, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1662, 8, 187, 10, 187, + 12, 187, 1665, 9, 187, 3, 187, 1667, 8, 187, 1, 188, 4, 188, 1670, 8, 188, + 11, 188, 12, 188, 1671, 1, 188, 1, 188, 5, 188, 1676, 8, 188, 10, 188, + 12, 188, 1679, 9, 188, 3, 188, 1681, 8, 188, 1, 188, 1, 188, 4, 188, 1685, + 8, 188, 11, 188, 12, 188, 1686, 3, 188, 1689, 8, 188, 1, 188, 1, 188, 3, + 188, 1693, 8, 188, 1, 188, 4, 188, 1696, 8, 188, 11, 188, 12, 188, 1697, + 3, 188, 1700, 8, 188, 1, 188, 1, 188, 1, 188, 1, 188, 4, 188, 1706, 8, + 188, 11, 188, 12, 188, 1707, 3, 188, 1710, 8, 188, 1, 189, 1, 189, 5, 189, + 1714, 8, 189, 10, 189, 12, 189, 1717, 9, 189, 1, 190, 1, 190, 1, 190, 1, + 191, 1, 191, 1, 191, 1, 191, 5, 191, 1726, 8, 191, 10, 191, 12, 191, 1729, + 9, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, + 1, 193, 5, 193, 1740, 8, 193, 10, 193, 12, 193, 1743, 9, 193, 1, 193, 3, + 193, 1746, 8, 193, 1, 193, 1, 193, 3, 193, 1750, 8, 193, 1, 193, 1, 193, + 1, 194, 1, 194, 1, 194, 1, 194, 5, 194, 1758, 8, 194, 10, 194, 12, 194, + 1761, 9, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 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, 223, 1, 223, 1, 224, 1, 224, 1, 1759, 0, 225, 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, 196, 393, 197, 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, 447, 0, 449, 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, + 1826, 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, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 1, 451, + 1, 0, 0, 0, 3, 453, 1, 0, 0, 0, 5, 455, 1, 0, 0, 0, 7, 457, 1, 0, 0, 0, + 9, 459, 1, 0, 0, 0, 11, 461, 1, 0, 0, 0, 13, 463, 1, 0, 0, 0, 15, 465, + 1, 0, 0, 0, 17, 467, 1, 0, 0, 0, 19, 471, 1, 0, 0, 0, 21, 474, 1, 0, 0, + 0, 23, 476, 1, 0, 0, 0, 25, 478, 1, 0, 0, 0, 27, 481, 1, 0, 0, 0, 29, 483, + 1, 0, 0, 0, 31, 485, 1, 0, 0, 0, 33, 488, 1, 0, 0, 0, 35, 491, 1, 0, 0, + 0, 37, 493, 1, 0, 0, 0, 39, 495, 1, 0, 0, 0, 41, 497, 1, 0, 0, 0, 43, 500, + 1, 0, 0, 0, 45, 502, 1, 0, 0, 0, 47, 505, 1, 0, 0, 0, 49, 508, 1, 0, 0, + 0, 51, 511, 1, 0, 0, 0, 53, 514, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 527, + 1, 0, 0, 0, 59, 531, 1, 0, 0, 0, 61, 537, 1, 0, 0, 0, 63, 541, 1, 0, 0, + 0, 65, 547, 1, 0, 0, 0, 67, 555, 1, 0, 0, 0, 69, 559, 1, 0, 0, 0, 71, 562, + 1, 0, 0, 0, 73, 566, 1, 0, 0, 0, 75, 573, 1, 0, 0, 0, 77, 587, 1, 0, 0, + 0, 79, 594, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 611, + 1, 0, 0, 0, 87, 619, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 629, 1, 0, 0, + 0, 93, 635, 1, 0, 0, 0, 95, 643, 1, 0, 0, 0, 97, 650, 1, 0, 0, 0, 99, 657, + 1, 0, 0, 0, 101, 666, 1, 0, 0, 0, 103, 677, 1, 0, 0, 0, 105, 684, 1, 0, + 0, 0, 107, 690, 1, 0, 0, 0, 109, 703, 1, 0, 0, 0, 111, 716, 1, 0, 0, 0, + 113, 734, 1, 0, 0, 0, 115, 743, 1, 0, 0, 0, 117, 751, 1, 0, 0, 0, 119, + 762, 1, 0, 0, 0, 121, 771, 1, 0, 0, 0, 123, 778, 1, 0, 0, 0, 125, 783, + 1, 0, 0, 0, 127, 790, 1, 0, 0, 0, 129, 799, 1, 0, 0, 0, 131, 804, 1, 0, + 0, 0, 133, 809, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 818, 1, 0, 0, 0, + 139, 825, 1, 0, 0, 0, 141, 832, 1, 0, 0, 0, 143, 842, 1, 0, 0, 0, 145, + 849, 1, 0, 0, 0, 147, 857, 1, 0, 0, 0, 149, 862, 1, 0, 0, 0, 151, 866, + 1, 0, 0, 0, 153, 874, 1, 0, 0, 0, 155, 879, 1, 0, 0, 0, 157, 884, 1, 0, + 0, 0, 159, 889, 1, 0, 0, 0, 161, 895, 1, 0, 0, 0, 163, 902, 1, 0, 0, 0, + 165, 905, 1, 0, 0, 0, 167, 912, 1, 0, 0, 0, 169, 922, 1, 0, 0, 0, 171, + 925, 1, 0, 0, 0, 173, 931, 1, 0, 0, 0, 175, 939, 1, 0, 0, 0, 177, 949, + 1, 0, 0, 0, 179, 955, 1, 0, 0, 0, 181, 962, 1, 0, 0, 0, 183, 970, 1, 0, + 0, 0, 185, 980, 1, 0, 0, 0, 187, 985, 1, 0, 0, 0, 189, 988, 1, 0, 0, 0, + 191, 995, 1, 0, 0, 0, 193, 1000, 1, 0, 0, 0, 195, 1004, 1, 0, 0, 0, 197, + 1009, 1, 0, 0, 0, 199, 1014, 1, 0, 0, 0, 201, 1020, 1, 0, 0, 0, 203, 1026, + 1, 0, 0, 0, 205, 1034, 1, 0, 0, 0, 207, 1037, 1, 0, 0, 0, 209, 1041, 1, + 0, 0, 0, 211, 1049, 1, 0, 0, 0, 213, 1054, 1, 0, 0, 0, 215, 1057, 1, 0, + 0, 0, 217, 1064, 1, 0, 0, 0, 219, 1067, 1, 0, 0, 0, 221, 1070, 1, 0, 0, + 0, 223, 1076, 1, 0, 0, 0, 225, 1082, 1, 0, 0, 0, 227, 1087, 1, 0, 0, 0, + 229, 1094, 1, 0, 0, 0, 231, 1102, 1, 0, 0, 0, 233, 1108, 1, 0, 0, 0, 235, + 1114, 1, 0, 0, 0, 237, 1124, 1, 0, 0, 0, 239, 1135, 1, 0, 0, 0, 241, 1142, + 1, 0, 0, 0, 243, 1150, 1, 0, 0, 0, 245, 1158, 1, 0, 0, 0, 247, 1165, 1, + 0, 0, 0, 249, 1173, 1, 0, 0, 0, 251, 1182, 1, 0, 0, 0, 253, 1192, 1, 0, + 0, 0, 255, 1198, 1, 0, 0, 0, 257, 1207, 1, 0, 0, 0, 259, 1211, 1, 0, 0, + 0, 261, 1216, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, + 267, 1237, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1250, 1, 0, 0, 0, 273, + 1255, 1, 0, 0, 0, 275, 1265, 1, 0, 0, 0, 277, 1270, 1, 0, 0, 0, 279, 1273, + 1, 0, 0, 0, 281, 1285, 1, 0, 0, 0, 283, 1293, 1, 0, 0, 0, 285, 1299, 1, + 0, 0, 0, 287, 1306, 1, 0, 0, 0, 289, 1313, 1, 0, 0, 0, 291, 1319, 1, 0, + 0, 0, 293, 1326, 1, 0, 0, 0, 295, 1333, 1, 0, 0, 0, 297, 1338, 1, 0, 0, + 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1357, 1, 0, 0, 0, + 305, 1362, 1, 0, 0, 0, 307, 1370, 1, 0, 0, 0, 309, 1382, 1, 0, 0, 0, 311, + 1387, 1, 0, 0, 0, 313, 1397, 1, 0, 0, 0, 315, 1403, 1, 0, 0, 0, 317, 1413, + 1, 0, 0, 0, 319, 1423, 1, 0, 0, 0, 321, 1431, 1, 0, 0, 0, 323, 1441, 1, + 0, 0, 0, 325, 1451, 1, 0, 0, 0, 327, 1462, 1, 0, 0, 0, 329, 1466, 1, 0, + 0, 0, 331, 1477, 1, 0, 0, 0, 333, 1482, 1, 0, 0, 0, 335, 1492, 1, 0, 0, + 0, 337, 1498, 1, 0, 0, 0, 339, 1511, 1, 0, 0, 0, 341, 1516, 1, 0, 0, 0, + 343, 1527, 1, 0, 0, 0, 345, 1537, 1, 0, 0, 0, 347, 1544, 1, 0, 0, 0, 349, + 1551, 1, 0, 0, 0, 351, 1556, 1, 0, 0, 0, 353, 1562, 1, 0, 0, 0, 355, 1569, + 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1581, 1, 0, 0, 0, 361, 1586, 1, + 0, 0, 0, 363, 1593, 1, 0, 0, 0, 365, 1600, 1, 0, 0, 0, 367, 1608, 1, 0, + 0, 0, 369, 1613, 1, 0, 0, 0, 371, 1620, 1, 0, 0, 0, 373, 1623, 1, 0, 0, + 0, 375, 1666, 1, 0, 0, 0, 377, 1709, 1, 0, 0, 0, 379, 1711, 1, 0, 0, 0, + 381, 1718, 1, 0, 0, 0, 383, 1721, 1, 0, 0, 0, 385, 1732, 1, 0, 0, 0, 387, + 1735, 1, 0, 0, 0, 389, 1753, 1, 0, 0, 0, 391, 1767, 1, 0, 0, 0, 393, 1771, + 1, 0, 0, 0, 395, 1773, 1, 0, 0, 0, 397, 1775, 1, 0, 0, 0, 399, 1777, 1, + 0, 0, 0, 401, 1779, 1, 0, 0, 0, 403, 1781, 1, 0, 0, 0, 405, 1783, 1, 0, + 0, 0, 407, 1785, 1, 0, 0, 0, 409, 1787, 1, 0, 0, 0, 411, 1789, 1, 0, 0, + 0, 413, 1791, 1, 0, 0, 0, 415, 1793, 1, 0, 0, 0, 417, 1795, 1, 0, 0, 0, + 419, 1797, 1, 0, 0, 0, 421, 1799, 1, 0, 0, 0, 423, 1801, 1, 0, 0, 0, 425, + 1803, 1, 0, 0, 0, 427, 1805, 1, 0, 0, 0, 429, 1807, 1, 0, 0, 0, 431, 1809, + 1, 0, 0, 0, 433, 1811, 1, 0, 0, 0, 435, 1813, 1, 0, 0, 0, 437, 1815, 1, + 0, 0, 0, 439, 1817, 1, 0, 0, 0, 441, 1819, 1, 0, 0, 0, 443, 1821, 1, 0, + 0, 0, 445, 1823, 1, 0, 0, 0, 447, 1825, 1, 0, 0, 0, 449, 1827, 1, 0, 0, + 0, 451, 452, 5, 59, 0, 0, 452, 2, 1, 0, 0, 0, 453, 454, 5, 46, 0, 0, 454, + 4, 1, 0, 0, 0, 455, 456, 5, 40, 0, 0, 456, 6, 1, 0, 0, 0, 457, 458, 5, + 41, 0, 0, 458, 8, 1, 0, 0, 0, 459, 460, 5, 44, 0, 0, 460, 10, 1, 0, 0, + 0, 461, 462, 5, 61, 0, 0, 462, 12, 1, 0, 0, 0, 463, 464, 5, 42, 0, 0, 464, + 14, 1, 0, 0, 0, 465, 466, 5, 43, 0, 0, 466, 16, 1, 0, 0, 0, 467, 468, 5, + 45, 0, 0, 468, 469, 5, 62, 0, 0, 469, 470, 5, 62, 0, 0, 470, 18, 1, 0, + 0, 0, 471, 472, 5, 45, 0, 0, 472, 473, 5, 62, 0, 0, 473, 20, 1, 0, 0, 0, + 474, 475, 5, 45, 0, 0, 475, 22, 1, 0, 0, 0, 476, 477, 5, 126, 0, 0, 477, + 24, 1, 0, 0, 0, 478, 479, 5, 124, 0, 0, 479, 480, 5, 124, 0, 0, 480, 26, + 1, 0, 0, 0, 481, 482, 5, 47, 0, 0, 482, 28, 1, 0, 0, 0, 483, 484, 5, 37, + 0, 0, 484, 30, 1, 0, 0, 0, 485, 486, 5, 60, 0, 0, 486, 487, 5, 60, 0, 0, + 487, 32, 1, 0, 0, 0, 488, 489, 5, 62, 0, 0, 489, 490, 5, 62, 0, 0, 490, + 34, 1, 0, 0, 0, 491, 492, 5, 38, 0, 0, 492, 36, 1, 0, 0, 0, 493, 494, 5, + 124, 0, 0, 494, 38, 1, 0, 0, 0, 495, 496, 5, 60, 0, 0, 496, 40, 1, 0, 0, + 0, 497, 498, 5, 60, 0, 0, 498, 499, 5, 61, 0, 0, 499, 42, 1, 0, 0, 0, 500, + 501, 5, 62, 0, 0, 501, 44, 1, 0, 0, 0, 502, 503, 5, 62, 0, 0, 503, 504, + 5, 61, 0, 0, 504, 46, 1, 0, 0, 0, 505, 506, 5, 61, 0, 0, 506, 507, 5, 61, + 0, 0, 507, 48, 1, 0, 0, 0, 508, 509, 5, 33, 0, 0, 509, 510, 5, 61, 0, 0, + 510, 50, 1, 0, 0, 0, 511, 512, 5, 60, 0, 0, 512, 513, 5, 62, 0, 0, 513, + 52, 1, 0, 0, 0, 514, 515, 3, 399, 199, 0, 515, 516, 3, 401, 200, 0, 516, + 517, 3, 427, 213, 0, 517, 518, 3, 433, 216, 0, 518, 519, 3, 437, 218, 0, + 519, 54, 1, 0, 0, 0, 520, 521, 3, 399, 199, 0, 521, 522, 3, 403, 201, 0, + 522, 523, 3, 437, 218, 0, 523, 524, 3, 415, 207, 0, 524, 525, 3, 427, 213, + 0, 525, 526, 3, 425, 212, 0, 526, 56, 1, 0, 0, 0, 527, 528, 3, 399, 199, + 0, 528, 529, 3, 405, 202, 0, 529, 530, 3, 405, 202, 0, 530, 58, 1, 0, 0, + 0, 531, 532, 3, 399, 199, 0, 532, 533, 3, 409, 204, 0, 533, 534, 3, 437, + 218, 0, 534, 535, 3, 407, 203, 0, 535, 536, 3, 433, 216, 0, 536, 60, 1, + 0, 0, 0, 537, 538, 3, 399, 199, 0, 538, 539, 3, 421, 210, 0, 539, 540, + 3, 421, 210, 0, 540, 62, 1, 0, 0, 0, 541, 542, 3, 399, 199, 0, 542, 543, + 3, 421, 210, 0, 543, 544, 3, 437, 218, 0, 544, 545, 3, 407, 203, 0, 545, + 546, 3, 433, 216, 0, 546, 64, 1, 0, 0, 0, 547, 548, 3, 399, 199, 0, 548, + 549, 3, 425, 212, 0, 549, 550, 3, 399, 199, 0, 550, 551, 3, 421, 210, 0, + 551, 552, 3, 447, 223, 0, 552, 553, 3, 449, 224, 0, 553, 554, 3, 407, 203, + 0, 554, 66, 1, 0, 0, 0, 555, 556, 3, 399, 199, 0, 556, 557, 3, 425, 212, + 0, 557, 558, 3, 405, 202, 0, 558, 68, 1, 0, 0, 0, 559, 560, 3, 399, 199, + 0, 560, 561, 3, 435, 217, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 399, 199, + 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 403, 201, 0, 565, 72, 1, 0, 0, + 0, 566, 567, 3, 399, 199, 0, 567, 568, 3, 437, 218, 0, 568, 569, 3, 437, + 218, 0, 569, 570, 3, 399, 199, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, + 413, 206, 0, 572, 74, 1, 0, 0, 0, 573, 574, 3, 399, 199, 0, 574, 575, 3, + 439, 219, 0, 575, 576, 3, 437, 218, 0, 576, 577, 3, 427, 213, 0, 577, 578, + 3, 415, 207, 0, 578, 579, 3, 425, 212, 0, 579, 580, 3, 403, 201, 0, 580, + 581, 3, 433, 216, 0, 581, 582, 3, 407, 203, 0, 582, 583, 3, 423, 211, 0, + 583, 584, 3, 407, 203, 0, 584, 585, 3, 425, 212, 0, 585, 586, 3, 437, 218, + 0, 586, 76, 1, 0, 0, 0, 587, 588, 3, 401, 200, 0, 588, 589, 3, 407, 203, + 0, 589, 590, 3, 409, 204, 0, 590, 591, 3, 427, 213, 0, 591, 592, 3, 433, + 216, 0, 592, 593, 3, 407, 203, 0, 593, 78, 1, 0, 0, 0, 594, 595, 3, 401, + 200, 0, 595, 596, 3, 407, 203, 0, 596, 597, 3, 411, 205, 0, 597, 598, 3, + 415, 207, 0, 598, 599, 3, 425, 212, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, + 401, 200, 0, 601, 602, 3, 407, 203, 0, 602, 603, 3, 437, 218, 0, 603, 604, + 3, 443, 221, 0, 604, 605, 3, 407, 203, 0, 605, 606, 3, 407, 203, 0, 606, + 607, 3, 425, 212, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 401, 200, 0, 609, + 610, 3, 447, 223, 0, 610, 84, 1, 0, 0, 0, 611, 612, 3, 403, 201, 0, 612, + 613, 3, 399, 199, 0, 613, 614, 3, 435, 217, 0, 614, 615, 3, 403, 201, 0, + 615, 616, 3, 399, 199, 0, 616, 617, 3, 405, 202, 0, 617, 618, 3, 407, 203, + 0, 618, 86, 1, 0, 0, 0, 619, 620, 3, 403, 201, 0, 620, 621, 3, 399, 199, + 0, 621, 622, 3, 435, 217, 0, 622, 623, 3, 407, 203, 0, 623, 88, 1, 0, 0, + 0, 624, 625, 3, 403, 201, 0, 625, 626, 3, 399, 199, 0, 626, 627, 3, 435, + 217, 0, 627, 628, 3, 437, 218, 0, 628, 90, 1, 0, 0, 0, 629, 630, 3, 403, + 201, 0, 630, 631, 3, 413, 206, 0, 631, 632, 3, 407, 203, 0, 632, 633, 3, + 403, 201, 0, 633, 634, 3, 419, 209, 0, 634, 92, 1, 0, 0, 0, 635, 636, 3, + 403, 201, 0, 636, 637, 3, 427, 213, 0, 637, 638, 3, 421, 210, 0, 638, 639, + 3, 421, 210, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 437, 218, 0, 641, + 642, 3, 407, 203, 0, 642, 94, 1, 0, 0, 0, 643, 644, 3, 403, 201, 0, 644, + 645, 3, 427, 213, 0, 645, 646, 3, 421, 210, 0, 646, 647, 3, 439, 219, 0, + 647, 648, 3, 423, 211, 0, 648, 649, 3, 425, 212, 0, 649, 96, 1, 0, 0, 0, + 650, 651, 3, 403, 201, 0, 651, 652, 3, 427, 213, 0, 652, 653, 3, 423, 211, + 0, 653, 654, 3, 423, 211, 0, 654, 655, 3, 415, 207, 0, 655, 656, 3, 437, + 218, 0, 656, 98, 1, 0, 0, 0, 657, 658, 3, 403, 201, 0, 658, 659, 3, 427, + 213, 0, 659, 660, 3, 425, 212, 0, 660, 661, 3, 409, 204, 0, 661, 662, 3, + 421, 210, 0, 662, 663, 3, 415, 207, 0, 663, 664, 3, 403, 201, 0, 664, 665, + 3, 437, 218, 0, 665, 100, 1, 0, 0, 0, 666, 667, 3, 403, 201, 0, 667, 668, + 3, 427, 213, 0, 668, 669, 3, 425, 212, 0, 669, 670, 3, 435, 217, 0, 670, + 671, 3, 437, 218, 0, 671, 672, 3, 433, 216, 0, 672, 673, 3, 399, 199, 0, + 673, 674, 3, 415, 207, 0, 674, 675, 3, 425, 212, 0, 675, 676, 3, 437, 218, + 0, 676, 102, 1, 0, 0, 0, 677, 678, 3, 403, 201, 0, 678, 679, 3, 433, 216, + 0, 679, 680, 3, 407, 203, 0, 680, 681, 3, 399, 199, 0, 681, 682, 3, 437, + 218, 0, 682, 683, 3, 407, 203, 0, 683, 104, 1, 0, 0, 0, 684, 685, 3, 403, + 201, 0, 685, 686, 3, 433, 216, 0, 686, 687, 3, 427, 213, 0, 687, 688, 3, + 435, 217, 0, 688, 689, 3, 435, 217, 0, 689, 106, 1, 0, 0, 0, 690, 691, + 3, 403, 201, 0, 691, 692, 3, 439, 219, 0, 692, 693, 3, 433, 216, 0, 693, + 694, 3, 433, 216, 0, 694, 695, 3, 407, 203, 0, 695, 696, 3, 425, 212, 0, + 696, 697, 3, 437, 218, 0, 697, 698, 5, 95, 0, 0, 698, 699, 3, 405, 202, + 0, 699, 700, 3, 399, 199, 0, 700, 701, 3, 437, 218, 0, 701, 702, 3, 407, + 203, 0, 702, 108, 1, 0, 0, 0, 703, 704, 3, 403, 201, 0, 704, 705, 3, 439, + 219, 0, 705, 706, 3, 433, 216, 0, 706, 707, 3, 433, 216, 0, 707, 708, 3, + 407, 203, 0, 708, 709, 3, 425, 212, 0, 709, 710, 3, 437, 218, 0, 710, 711, + 5, 95, 0, 0, 711, 712, 3, 437, 218, 0, 712, 713, 3, 415, 207, 0, 713, 714, + 3, 423, 211, 0, 714, 715, 3, 407, 203, 0, 715, 110, 1, 0, 0, 0, 716, 717, + 3, 403, 201, 0, 717, 718, 3, 439, 219, 0, 718, 719, 3, 433, 216, 0, 719, + 720, 3, 433, 216, 0, 720, 721, 3, 407, 203, 0, 721, 722, 3, 425, 212, 0, + 722, 723, 3, 437, 218, 0, 723, 724, 5, 95, 0, 0, 724, 725, 3, 437, 218, + 0, 725, 726, 3, 415, 207, 0, 726, 727, 3, 423, 211, 0, 727, 728, 3, 407, + 203, 0, 728, 729, 3, 435, 217, 0, 729, 730, 3, 437, 218, 0, 730, 731, 3, + 399, 199, 0, 731, 732, 3, 423, 211, 0, 732, 733, 3, 429, 214, 0, 733, 112, + 1, 0, 0, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 399, 199, 0, 736, 737, + 3, 437, 218, 0, 737, 738, 3, 399, 199, 0, 738, 739, 3, 401, 200, 0, 739, + 740, 3, 399, 199, 0, 740, 741, 3, 435, 217, 0, 741, 742, 3, 407, 203, 0, + 742, 114, 1, 0, 0, 0, 743, 744, 3, 405, 202, 0, 744, 745, 3, 407, 203, + 0, 745, 746, 3, 409, 204, 0, 746, 747, 3, 399, 199, 0, 747, 748, 3, 439, + 219, 0, 748, 749, 3, 421, 210, 0, 749, 750, 3, 437, 218, 0, 750, 116, 1, + 0, 0, 0, 751, 752, 3, 405, 202, 0, 752, 753, 3, 407, 203, 0, 753, 754, + 3, 409, 204, 0, 754, 755, 3, 407, 203, 0, 755, 756, 3, 433, 216, 0, 756, + 757, 3, 433, 216, 0, 757, 758, 3, 399, 199, 0, 758, 759, 3, 401, 200, 0, + 759, 760, 3, 421, 210, 0, 760, 761, 3, 407, 203, 0, 761, 118, 1, 0, 0, + 0, 762, 763, 3, 405, 202, 0, 763, 764, 3, 407, 203, 0, 764, 765, 3, 409, + 204, 0, 765, 766, 3, 407, 203, 0, 766, 767, 3, 433, 216, 0, 767, 768, 3, + 433, 216, 0, 768, 769, 3, 407, 203, 0, 769, 770, 3, 405, 202, 0, 770, 120, + 1, 0, 0, 0, 771, 772, 3, 405, 202, 0, 772, 773, 3, 407, 203, 0, 773, 774, + 3, 421, 210, 0, 774, 775, 3, 407, 203, 0, 775, 776, 3, 437, 218, 0, 776, + 777, 3, 407, 203, 0, 777, 122, 1, 0, 0, 0, 778, 779, 3, 405, 202, 0, 779, + 780, 3, 407, 203, 0, 780, 781, 3, 435, 217, 0, 781, 782, 3, 403, 201, 0, + 782, 124, 1, 0, 0, 0, 783, 784, 3, 405, 202, 0, 784, 785, 3, 407, 203, + 0, 785, 786, 3, 437, 218, 0, 786, 787, 3, 399, 199, 0, 787, 788, 3, 403, + 201, 0, 788, 789, 3, 413, 206, 0, 789, 126, 1, 0, 0, 0, 790, 791, 3, 405, + 202, 0, 791, 792, 3, 415, 207, 0, 792, 793, 3, 435, 217, 0, 793, 794, 3, + 437, 218, 0, 794, 795, 3, 415, 207, 0, 795, 796, 3, 425, 212, 0, 796, 797, + 3, 403, 201, 0, 797, 798, 3, 437, 218, 0, 798, 128, 1, 0, 0, 0, 799, 800, + 3, 405, 202, 0, 800, 801, 3, 433, 216, 0, 801, 802, 3, 427, 213, 0, 802, + 803, 3, 429, 214, 0, 803, 130, 1, 0, 0, 0, 804, 805, 3, 407, 203, 0, 805, + 806, 3, 399, 199, 0, 806, 807, 3, 403, 201, 0, 807, 808, 3, 413, 206, 0, + 808, 132, 1, 0, 0, 0, 809, 810, 3, 407, 203, 0, 810, 811, 3, 421, 210, + 0, 811, 812, 3, 435, 217, 0, 812, 813, 3, 407, 203, 0, 813, 134, 1, 0, + 0, 0, 814, 815, 3, 407, 203, 0, 815, 816, 3, 425, 212, 0, 816, 817, 3, + 405, 202, 0, 817, 136, 1, 0, 0, 0, 818, 819, 3, 407, 203, 0, 819, 820, + 3, 435, 217, 0, 820, 821, 3, 403, 201, 0, 821, 822, 3, 399, 199, 0, 822, + 823, 3, 429, 214, 0, 823, 824, 3, 407, 203, 0, 824, 138, 1, 0, 0, 0, 825, + 826, 3, 407, 203, 0, 826, 827, 3, 445, 222, 0, 827, 828, 3, 403, 201, 0, + 828, 829, 3, 407, 203, 0, 829, 830, 3, 429, 214, 0, 830, 831, 3, 437, 218, + 0, 831, 140, 1, 0, 0, 0, 832, 833, 3, 407, 203, 0, 833, 834, 3, 445, 222, + 0, 834, 835, 3, 403, 201, 0, 835, 836, 3, 421, 210, 0, 836, 837, 3, 439, + 219, 0, 837, 838, 3, 435, 217, 0, 838, 839, 3, 415, 207, 0, 839, 840, 3, + 441, 220, 0, 840, 841, 3, 407, 203, 0, 841, 142, 1, 0, 0, 0, 842, 843, + 3, 407, 203, 0, 843, 844, 3, 445, 222, 0, 844, 845, 3, 415, 207, 0, 845, + 846, 3, 435, 217, 0, 846, 847, 3, 437, 218, 0, 847, 848, 3, 435, 217, 0, + 848, 144, 1, 0, 0, 0, 849, 850, 3, 407, 203, 0, 850, 851, 3, 445, 222, + 0, 851, 852, 3, 429, 214, 0, 852, 853, 3, 421, 210, 0, 853, 854, 3, 399, + 199, 0, 854, 855, 3, 415, 207, 0, 855, 856, 3, 425, 212, 0, 856, 146, 1, + 0, 0, 0, 857, 858, 3, 409, 204, 0, 858, 859, 3, 399, 199, 0, 859, 860, + 3, 415, 207, 0, 860, 861, 3, 421, 210, 0, 861, 148, 1, 0, 0, 0, 862, 863, + 3, 409, 204, 0, 863, 864, 3, 427, 213, 0, 864, 865, 3, 433, 216, 0, 865, + 150, 1, 0, 0, 0, 866, 867, 3, 409, 204, 0, 867, 868, 3, 427, 213, 0, 868, + 869, 3, 433, 216, 0, 869, 870, 3, 407, 203, 0, 870, 871, 3, 415, 207, 0, + 871, 872, 3, 411, 205, 0, 872, 873, 3, 425, 212, 0, 873, 152, 1, 0, 0, + 0, 874, 875, 3, 409, 204, 0, 875, 876, 3, 433, 216, 0, 876, 877, 3, 427, + 213, 0, 877, 878, 3, 423, 211, 0, 878, 154, 1, 0, 0, 0, 879, 880, 3, 409, + 204, 0, 880, 881, 3, 439, 219, 0, 881, 882, 3, 421, 210, 0, 882, 883, 3, + 421, 210, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 411, 205, 0, 885, 886, + 3, 421, 210, 0, 886, 887, 3, 427, 213, 0, 887, 888, 3, 401, 200, 0, 888, + 158, 1, 0, 0, 0, 889, 890, 3, 411, 205, 0, 890, 891, 3, 433, 216, 0, 891, + 892, 3, 427, 213, 0, 892, 893, 3, 439, 219, 0, 893, 894, 3, 429, 214, 0, + 894, 160, 1, 0, 0, 0, 895, 896, 3, 413, 206, 0, 896, 897, 3, 399, 199, + 0, 897, 898, 3, 441, 220, 0, 898, 899, 3, 415, 207, 0, 899, 900, 3, 425, + 212, 0, 900, 901, 3, 411, 205, 0, 901, 162, 1, 0, 0, 0, 902, 903, 3, 415, + 207, 0, 903, 904, 3, 409, 204, 0, 904, 164, 1, 0, 0, 0, 905, 906, 3, 415, + 207, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 425, 212, 0, 908, 909, 3, + 427, 213, 0, 909, 910, 3, 433, 216, 0, 910, 911, 3, 407, 203, 0, 911, 166, + 1, 0, 0, 0, 912, 913, 3, 415, 207, 0, 913, 914, 3, 423, 211, 0, 914, 915, + 3, 423, 211, 0, 915, 916, 3, 407, 203, 0, 916, 917, 3, 405, 202, 0, 917, + 918, 3, 415, 207, 0, 918, 919, 3, 399, 199, 0, 919, 920, 3, 437, 218, 0, + 920, 921, 3, 407, 203, 0, 921, 168, 1, 0, 0, 0, 922, 923, 3, 415, 207, + 0, 923, 924, 3, 425, 212, 0, 924, 170, 1, 0, 0, 0, 925, 926, 3, 415, 207, + 0, 926, 927, 3, 425, 212, 0, 927, 928, 3, 405, 202, 0, 928, 929, 3, 407, + 203, 0, 929, 930, 3, 445, 222, 0, 930, 172, 1, 0, 0, 0, 931, 932, 3, 415, + 207, 0, 932, 933, 3, 425, 212, 0, 933, 934, 3, 405, 202, 0, 934, 935, 3, + 407, 203, 0, 935, 936, 3, 445, 222, 0, 936, 937, 3, 407, 203, 0, 937, 938, + 3, 405, 202, 0, 938, 174, 1, 0, 0, 0, 939, 940, 3, 415, 207, 0, 940, 941, + 3, 425, 212, 0, 941, 942, 3, 415, 207, 0, 942, 943, 3, 437, 218, 0, 943, + 944, 3, 415, 207, 0, 944, 945, 3, 399, 199, 0, 945, 946, 3, 421, 210, 0, + 946, 947, 3, 421, 210, 0, 947, 948, 3, 447, 223, 0, 948, 176, 1, 0, 0, + 0, 949, 950, 3, 415, 207, 0, 950, 951, 3, 425, 212, 0, 951, 952, 3, 425, + 212, 0, 952, 953, 3, 407, 203, 0, 953, 954, 3, 433, 216, 0, 954, 178, 1, + 0, 0, 0, 955, 956, 3, 415, 207, 0, 956, 957, 3, 425, 212, 0, 957, 958, + 3, 435, 217, 0, 958, 959, 3, 407, 203, 0, 959, 960, 3, 433, 216, 0, 960, + 961, 3, 437, 218, 0, 961, 180, 1, 0, 0, 0, 962, 963, 3, 415, 207, 0, 963, + 964, 3, 425, 212, 0, 964, 965, 3, 435, 217, 0, 965, 966, 3, 437, 218, 0, + 966, 967, 3, 407, 203, 0, 967, 968, 3, 399, 199, 0, 968, 969, 3, 405, 202, + 0, 969, 182, 1, 0, 0, 0, 970, 971, 3, 415, 207, 0, 971, 972, 3, 425, 212, + 0, 972, 973, 3, 437, 218, 0, 973, 974, 3, 407, 203, 0, 974, 975, 3, 433, + 216, 0, 975, 976, 3, 435, 217, 0, 976, 977, 3, 407, 203, 0, 977, 978, 3, + 403, 201, 0, 978, 979, 3, 437, 218, 0, 979, 184, 1, 0, 0, 0, 980, 981, + 3, 415, 207, 0, 981, 982, 3, 425, 212, 0, 982, 983, 3, 437, 218, 0, 983, + 984, 3, 427, 213, 0, 984, 186, 1, 0, 0, 0, 985, 986, 3, 415, 207, 0, 986, + 987, 3, 435, 217, 0, 987, 188, 1, 0, 0, 0, 988, 989, 3, 415, 207, 0, 989, + 990, 3, 435, 217, 0, 990, 991, 3, 425, 212, 0, 991, 992, 3, 439, 219, 0, + 992, 993, 3, 421, 210, 0, 993, 994, 3, 421, 210, 0, 994, 190, 1, 0, 0, + 0, 995, 996, 3, 417, 208, 0, 996, 997, 3, 427, 213, 0, 997, 998, 3, 415, + 207, 0, 998, 999, 3, 425, 212, 0, 999, 192, 1, 0, 0, 0, 1000, 1001, 3, + 419, 209, 0, 1001, 1002, 3, 407, 203, 0, 1002, 1003, 3, 447, 223, 0, 1003, + 194, 1, 0, 0, 0, 1004, 1005, 3, 421, 210, 0, 1005, 1006, 3, 407, 203, 0, + 1006, 1007, 3, 409, 204, 0, 1007, 1008, 3, 437, 218, 0, 1008, 196, 1, 0, + 0, 0, 1009, 1010, 3, 421, 210, 0, 1010, 1011, 3, 415, 207, 0, 1011, 1012, + 3, 419, 209, 0, 1012, 1013, 3, 407, 203, 0, 1013, 198, 1, 0, 0, 0, 1014, + 1015, 3, 421, 210, 0, 1015, 1016, 3, 415, 207, 0, 1016, 1017, 3, 423, 211, + 0, 1017, 1018, 3, 415, 207, 0, 1018, 1019, 3, 437, 218, 0, 1019, 200, 1, + 0, 0, 0, 1020, 1021, 3, 423, 211, 0, 1021, 1022, 3, 399, 199, 0, 1022, + 1023, 3, 437, 218, 0, 1023, 1024, 3, 403, 201, 0, 1024, 1025, 3, 413, 206, + 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 425, 212, 0, 1027, 1028, 3, 399, + 199, 0, 1028, 1029, 3, 437, 218, 0, 1029, 1030, 3, 439, 219, 0, 1030, 1031, + 3, 433, 216, 0, 1031, 1032, 3, 399, 199, 0, 1032, 1033, 3, 421, 210, 0, + 1033, 204, 1, 0, 0, 0, 1034, 1035, 3, 425, 212, 0, 1035, 1036, 3, 427, + 213, 0, 1036, 206, 1, 0, 0, 0, 1037, 1038, 3, 425, 212, 0, 1038, 1039, + 3, 427, 213, 0, 1039, 1040, 3, 437, 218, 0, 1040, 208, 1, 0, 0, 0, 1041, + 1042, 3, 425, 212, 0, 1042, 1043, 3, 427, 213, 0, 1043, 1044, 3, 437, 218, + 0, 1044, 1045, 3, 425, 212, 0, 1045, 1046, 3, 439, 219, 0, 1046, 1047, + 3, 421, 210, 0, 1047, 1048, 3, 421, 210, 0, 1048, 210, 1, 0, 0, 0, 1049, + 1050, 3, 425, 212, 0, 1050, 1051, 3, 439, 219, 0, 1051, 1052, 3, 421, 210, + 0, 1052, 1053, 3, 421, 210, 0, 1053, 212, 1, 0, 0, 0, 1054, 1055, 3, 427, + 213, 0, 1055, 1056, 3, 409, 204, 0, 1056, 214, 1, 0, 0, 0, 1057, 1058, + 3, 427, 213, 0, 1058, 1059, 3, 409, 204, 0, 1059, 1060, 3, 409, 204, 0, + 1060, 1061, 3, 435, 217, 0, 1061, 1062, 3, 407, 203, 0, 1062, 1063, 3, + 437, 218, 0, 1063, 216, 1, 0, 0, 0, 1064, 1065, 3, 427, 213, 0, 1065, 1066, + 3, 425, 212, 0, 1066, 218, 1, 0, 0, 0, 1067, 1068, 3, 427, 213, 0, 1068, + 1069, 3, 433, 216, 0, 1069, 220, 1, 0, 0, 0, 1070, 1071, 3, 427, 213, 0, + 1071, 1072, 3, 433, 216, 0, 1072, 1073, 3, 405, 202, 0, 1073, 1074, 3, + 407, 203, 0, 1074, 1075, 3, 433, 216, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, + 3, 427, 213, 0, 1077, 1078, 3, 439, 219, 0, 1078, 1079, 3, 437, 218, 0, + 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 433, 216, 0, 1081, 224, 1, 0, + 0, 0, 1082, 1083, 3, 429, 214, 0, 1083, 1084, 3, 421, 210, 0, 1084, 1085, + 3, 399, 199, 0, 1085, 1086, 3, 425, 212, 0, 1086, 226, 1, 0, 0, 0, 1087, + 1088, 3, 429, 214, 0, 1088, 1089, 3, 433, 216, 0, 1089, 1090, 3, 399, 199, + 0, 1090, 1091, 3, 411, 205, 0, 1091, 1092, 3, 423, 211, 0, 1092, 1093, + 3, 399, 199, 0, 1093, 228, 1, 0, 0, 0, 1094, 1095, 3, 429, 214, 0, 1095, + 1096, 3, 433, 216, 0, 1096, 1097, 3, 415, 207, 0, 1097, 1098, 3, 423, 211, + 0, 1098, 1099, 3, 399, 199, 0, 1099, 1100, 3, 433, 216, 0, 1100, 1101, + 3, 447, 223, 0, 1101, 230, 1, 0, 0, 0, 1102, 1103, 3, 431, 215, 0, 1103, + 1104, 3, 439, 219, 0, 1104, 1105, 3, 407, 203, 0, 1105, 1106, 3, 433, 216, + 0, 1106, 1107, 3, 447, 223, 0, 1107, 232, 1, 0, 0, 0, 1108, 1109, 3, 433, + 216, 0, 1109, 1110, 3, 399, 199, 0, 1110, 1111, 3, 415, 207, 0, 1111, 1112, + 3, 435, 217, 0, 1112, 1113, 3, 407, 203, 0, 1113, 234, 1, 0, 0, 0, 1114, + 1115, 3, 433, 216, 0, 1115, 1116, 3, 407, 203, 0, 1116, 1117, 3, 403, 201, + 0, 1117, 1118, 3, 439, 219, 0, 1118, 1119, 3, 433, 216, 0, 1119, 1120, + 3, 435, 217, 0, 1120, 1121, 3, 415, 207, 0, 1121, 1122, 3, 441, 220, 0, + 1122, 1123, 3, 407, 203, 0, 1123, 236, 1, 0, 0, 0, 1124, 1125, 3, 433, + 216, 0, 1125, 1126, 3, 407, 203, 0, 1126, 1127, 3, 409, 204, 0, 1127, 1128, + 3, 407, 203, 0, 1128, 1129, 3, 433, 216, 0, 1129, 1130, 3, 407, 203, 0, + 1130, 1131, 3, 425, 212, 0, 1131, 1132, 3, 403, 201, 0, 1132, 1133, 3, + 407, 203, 0, 1133, 1134, 3, 435, 217, 0, 1134, 238, 1, 0, 0, 0, 1135, 1136, + 3, 433, 216, 0, 1136, 1137, 3, 407, 203, 0, 1137, 1138, 3, 411, 205, 0, + 1138, 1139, 3, 407, 203, 0, 1139, 1140, 3, 445, 222, 0, 1140, 1141, 3, + 429, 214, 0, 1141, 240, 1, 0, 0, 0, 1142, 1143, 3, 433, 216, 0, 1143, 1144, + 3, 407, 203, 0, 1144, 1145, 3, 415, 207, 0, 1145, 1146, 3, 425, 212, 0, + 1146, 1147, 3, 405, 202, 0, 1147, 1148, 3, 407, 203, 0, 1148, 1149, 3, + 445, 222, 0, 1149, 242, 1, 0, 0, 0, 1150, 1151, 3, 433, 216, 0, 1151, 1152, + 3, 407, 203, 0, 1152, 1153, 3, 421, 210, 0, 1153, 1154, 3, 407, 203, 0, + 1154, 1155, 3, 399, 199, 0, 1155, 1156, 3, 435, 217, 0, 1156, 1157, 3, + 407, 203, 0, 1157, 244, 1, 0, 0, 0, 1158, 1159, 3, 433, 216, 0, 1159, 1160, + 3, 407, 203, 0, 1160, 1161, 3, 425, 212, 0, 1161, 1162, 3, 399, 199, 0, + 1162, 1163, 3, 423, 211, 0, 1163, 1164, 3, 407, 203, 0, 1164, 246, 1, 0, + 0, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 407, 203, 0, 1167, 1168, + 3, 429, 214, 0, 1168, 1169, 3, 421, 210, 0, 1169, 1170, 3, 399, 199, 0, + 1170, 1171, 3, 403, 201, 0, 1171, 1172, 3, 407, 203, 0, 1172, 248, 1, 0, + 0, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 407, 203, 0, 1175, 1176, + 3, 435, 217, 0, 1176, 1177, 3, 437, 218, 0, 1177, 1178, 3, 433, 216, 0, + 1178, 1179, 3, 415, 207, 0, 1179, 1180, 3, 403, 201, 0, 1180, 1181, 3, + 437, 218, 0, 1181, 250, 1, 0, 0, 0, 1182, 1183, 3, 433, 216, 0, 1183, 1184, + 3, 407, 203, 0, 1184, 1185, 3, 437, 218, 0, 1185, 1186, 3, 439, 219, 0, + 1186, 1187, 3, 433, 216, 0, 1187, 1188, 3, 425, 212, 0, 1188, 1189, 3, + 415, 207, 0, 1189, 1190, 3, 425, 212, 0, 1190, 1191, 3, 411, 205, 0, 1191, + 252, 1, 0, 0, 0, 1192, 1193, 3, 433, 216, 0, 1193, 1194, 3, 415, 207, 0, + 1194, 1195, 3, 411, 205, 0, 1195, 1196, 3, 413, 206, 0, 1196, 1197, 3, + 437, 218, 0, 1197, 254, 1, 0, 0, 0, 1198, 1199, 3, 433, 216, 0, 1199, 1200, + 3, 427, 213, 0, 1200, 1201, 3, 421, 210, 0, 1201, 1202, 3, 421, 210, 0, + 1202, 1203, 3, 401, 200, 0, 1203, 1204, 3, 399, 199, 0, 1204, 1205, 3, + 403, 201, 0, 1205, 1206, 3, 419, 209, 0, 1206, 256, 1, 0, 0, 0, 1207, 1208, + 3, 433, 216, 0, 1208, 1209, 3, 427, 213, 0, 1209, 1210, 3, 443, 221, 0, + 1210, 258, 1, 0, 0, 0, 1211, 1212, 3, 433, 216, 0, 1212, 1213, 3, 427, + 213, 0, 1213, 1214, 3, 443, 221, 0, 1214, 1215, 3, 435, 217, 0, 1215, 260, + 1, 0, 0, 0, 1216, 1217, 3, 435, 217, 0, 1217, 1218, 3, 399, 199, 0, 1218, + 1219, 3, 441, 220, 0, 1219, 1220, 3, 407, 203, 0, 1220, 1221, 3, 429, 214, + 0, 1221, 1222, 3, 427, 213, 0, 1222, 1223, 3, 415, 207, 0, 1223, 1224, + 3, 425, 212, 0, 1224, 1225, 3, 437, 218, 0, 1225, 262, 1, 0, 0, 0, 1226, + 1227, 3, 435, 217, 0, 1227, 1228, 3, 407, 203, 0, 1228, 1229, 3, 421, 210, + 0, 1229, 1230, 3, 407, 203, 0, 1230, 1231, 3, 403, 201, 0, 1231, 1232, + 3, 437, 218, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 435, 217, 0, 1234, + 1235, 3, 407, 203, 0, 1235, 1236, 3, 437, 218, 0, 1236, 266, 1, 0, 0, 0, + 1237, 1238, 3, 435, 217, 0, 1238, 1239, 3, 437, 218, 0, 1239, 1240, 3, + 433, 216, 0, 1240, 1241, 3, 415, 207, 0, 1241, 1242, 3, 403, 201, 0, 1242, + 1243, 3, 437, 218, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 437, 218, 0, + 1245, 1246, 3, 399, 199, 0, 1246, 1247, 3, 401, 200, 0, 1247, 1248, 3, + 421, 210, 0, 1248, 1249, 3, 407, 203, 0, 1249, 270, 1, 0, 0, 0, 1250, 1251, + 3, 437, 218, 0, 1251, 1252, 3, 407, 203, 0, 1252, 1253, 3, 423, 211, 0, + 1253, 1254, 3, 429, 214, 0, 1254, 272, 1, 0, 0, 0, 1255, 1256, 3, 437, + 218, 0, 1256, 1257, 3, 407, 203, 0, 1257, 1258, 3, 423, 211, 0, 1258, 1259, + 3, 429, 214, 0, 1259, 1260, 3, 427, 213, 0, 1260, 1261, 3, 433, 216, 0, + 1261, 1262, 3, 399, 199, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, + 447, 223, 0, 1264, 274, 1, 0, 0, 0, 1265, 1266, 3, 437, 218, 0, 1266, 1267, + 3, 413, 206, 0, 1267, 1268, 3, 407, 203, 0, 1268, 1269, 3, 425, 212, 0, + 1269, 276, 1, 0, 0, 0, 1270, 1271, 3, 437, 218, 0, 1271, 1272, 3, 427, + 213, 0, 1272, 278, 1, 0, 0, 0, 1273, 1274, 3, 437, 218, 0, 1274, 1275, + 3, 433, 216, 0, 1275, 1276, 3, 399, 199, 0, 1276, 1277, 3, 425, 212, 0, + 1277, 1278, 3, 435, 217, 0, 1278, 1279, 3, 399, 199, 0, 1279, 1280, 3, + 403, 201, 0, 1280, 1281, 3, 437, 218, 0, 1281, 1282, 3, 415, 207, 0, 1282, + 1283, 3, 427, 213, 0, 1283, 1284, 3, 425, 212, 0, 1284, 280, 1, 0, 0, 0, + 1285, 1286, 3, 437, 218, 0, 1286, 1287, 3, 433, 216, 0, 1287, 1288, 3, + 415, 207, 0, 1288, 1289, 3, 411, 205, 0, 1289, 1290, 3, 411, 205, 0, 1290, + 1291, 3, 407, 203, 0, 1291, 1292, 3, 433, 216, 0, 1292, 282, 1, 0, 0, 0, + 1293, 1294, 3, 439, 219, 0, 1294, 1295, 3, 425, 212, 0, 1295, 1296, 3, + 415, 207, 0, 1296, 1297, 3, 427, 213, 0, 1297, 1298, 3, 425, 212, 0, 1298, + 284, 1, 0, 0, 0, 1299, 1300, 3, 439, 219, 0, 1300, 1301, 3, 425, 212, 0, + 1301, 1302, 3, 415, 207, 0, 1302, 1303, 3, 431, 215, 0, 1303, 1304, 3, + 439, 219, 0, 1304, 1305, 3, 407, 203, 0, 1305, 286, 1, 0, 0, 0, 1306, 1307, + 3, 439, 219, 0, 1307, 1308, 3, 429, 214, 0, 1308, 1309, 3, 405, 202, 0, + 1309, 1310, 3, 399, 199, 0, 1310, 1311, 3, 437, 218, 0, 1311, 1312, 3, + 407, 203, 0, 1312, 288, 1, 0, 0, 0, 1313, 1314, 3, 439, 219, 0, 1314, 1315, + 3, 435, 217, 0, 1315, 1316, 3, 415, 207, 0, 1316, 1317, 3, 425, 212, 0, + 1317, 1318, 3, 411, 205, 0, 1318, 290, 1, 0, 0, 0, 1319, 1320, 3, 441, + 220, 0, 1320, 1321, 3, 399, 199, 0, 1321, 1322, 3, 403, 201, 0, 1322, 1323, + 3, 439, 219, 0, 1323, 1324, 3, 439, 219, 0, 1324, 1325, 3, 423, 211, 0, + 1325, 292, 1, 0, 0, 0, 1326, 1327, 3, 441, 220, 0, 1327, 1328, 3, 399, + 199, 0, 1328, 1329, 3, 421, 210, 0, 1329, 1330, 3, 439, 219, 0, 1330, 1331, + 3, 407, 203, 0, 1331, 1332, 3, 435, 217, 0, 1332, 294, 1, 0, 0, 0, 1333, + 1334, 3, 441, 220, 0, 1334, 1335, 3, 415, 207, 0, 1335, 1336, 3, 407, 203, + 0, 1336, 1337, 3, 443, 221, 0, 1337, 296, 1, 0, 0, 0, 1338, 1339, 3, 441, + 220, 0, 1339, 1340, 3, 415, 207, 0, 1340, 1341, 3, 433, 216, 0, 1341, 1342, + 3, 437, 218, 0, 1342, 1343, 3, 439, 219, 0, 1343, 1344, 3, 399, 199, 0, + 1344, 1345, 3, 421, 210, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 443, + 221, 0, 1347, 1348, 3, 413, 206, 0, 1348, 1349, 3, 407, 203, 0, 1349, 1350, + 3, 425, 212, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 443, 221, 0, 1352, + 1353, 3, 413, 206, 0, 1353, 1354, 3, 407, 203, 0, 1354, 1355, 3, 433, 216, + 0, 1355, 1356, 3, 407, 203, 0, 1356, 302, 1, 0, 0, 0, 1357, 1358, 3, 443, + 221, 0, 1358, 1359, 3, 415, 207, 0, 1359, 1360, 3, 437, 218, 0, 1360, 1361, + 3, 413, 206, 0, 1361, 304, 1, 0, 0, 0, 1362, 1363, 3, 443, 221, 0, 1363, + 1364, 3, 415, 207, 0, 1364, 1365, 3, 437, 218, 0, 1365, 1366, 3, 413, 206, + 0, 1366, 1367, 3, 427, 213, 0, 1367, 1368, 3, 439, 219, 0, 1368, 1369, + 3, 437, 218, 0, 1369, 306, 1, 0, 0, 0, 1370, 1371, 3, 409, 204, 0, 1371, + 1372, 3, 415, 207, 0, 1372, 1373, 3, 433, 216, 0, 1373, 1374, 3, 435, 217, + 0, 1374, 1375, 3, 437, 218, 0, 1375, 1376, 5, 95, 0, 0, 1376, 1377, 3, + 441, 220, 0, 1377, 1378, 3, 399, 199, 0, 1378, 1379, 3, 421, 210, 0, 1379, + 1380, 3, 439, 219, 0, 1380, 1381, 3, 407, 203, 0, 1381, 308, 1, 0, 0, 0, + 1382, 1383, 3, 427, 213, 0, 1383, 1384, 3, 441, 220, 0, 1384, 1385, 3, + 407, 203, 0, 1385, 1386, 3, 433, 216, 0, 1386, 310, 1, 0, 0, 0, 1387, 1388, + 3, 429, 214, 0, 1388, 1389, 3, 399, 199, 0, 1389, 1390, 3, 433, 216, 0, + 1390, 1391, 3, 437, 218, 0, 1391, 1392, 3, 415, 207, 0, 1392, 1393, 3, + 437, 218, 0, 1393, 1394, 3, 415, 207, 0, 1394, 1395, 3, 427, 213, 0, 1395, + 1396, 3, 425, 212, 0, 1396, 312, 1, 0, 0, 0, 1397, 1398, 3, 433, 216, 0, + 1398, 1399, 3, 399, 199, 0, 1399, 1400, 3, 425, 212, 0, 1400, 1401, 3, + 411, 205, 0, 1401, 1402, 3, 407, 203, 0, 1402, 314, 1, 0, 0, 0, 1403, 1404, + 3, 429, 214, 0, 1404, 1405, 3, 433, 216, 0, 1405, 1406, 3, 407, 203, 0, + 1406, 1407, 3, 403, 201, 0, 1407, 1408, 3, 407, 203, 0, 1408, 1409, 3, + 405, 202, 0, 1409, 1410, 3, 415, 207, 0, 1410, 1411, 3, 425, 212, 0, 1411, + 1412, 3, 411, 205, 0, 1412, 316, 1, 0, 0, 0, 1413, 1414, 3, 439, 219, 0, + 1414, 1415, 3, 425, 212, 0, 1415, 1416, 3, 401, 200, 0, 1416, 1417, 3, + 427, 213, 0, 1417, 1418, 3, 439, 219, 0, 1418, 1419, 3, 425, 212, 0, 1419, + 1420, 3, 405, 202, 0, 1420, 1421, 3, 407, 203, 0, 1421, 1422, 3, 405, 202, + 0, 1422, 318, 1, 0, 0, 0, 1423, 1424, 3, 403, 201, 0, 1424, 1425, 3, 439, + 219, 0, 1425, 1426, 3, 433, 216, 0, 1426, 1427, 3, 433, 216, 0, 1427, 1428, + 3, 407, 203, 0, 1428, 1429, 3, 425, 212, 0, 1429, 1430, 3, 437, 218, 0, + 1430, 320, 1, 0, 0, 0, 1431, 1432, 3, 409, 204, 0, 1432, 1433, 3, 427, + 213, 0, 1433, 1434, 3, 421, 210, 0, 1434, 1435, 3, 421, 210, 0, 1435, 1436, + 3, 427, 213, 0, 1436, 1437, 3, 443, 221, 0, 1437, 1438, 3, 415, 207, 0, + 1438, 1439, 3, 425, 212, 0, 1439, 1440, 3, 411, 205, 0, 1440, 322, 1, 0, + 0, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 439, 219, 0, 1443, 1444, + 3, 423, 211, 0, 1444, 1445, 3, 407, 203, 0, 1445, 1446, 5, 95, 0, 0, 1446, + 1447, 3, 405, 202, 0, 1447, 1448, 3, 415, 207, 0, 1448, 1449, 3, 435, 217, + 0, 1449, 1450, 3, 437, 218, 0, 1450, 324, 1, 0, 0, 0, 1451, 1452, 3, 405, + 202, 0, 1452, 1453, 3, 407, 203, 0, 1453, 1454, 3, 425, 212, 0, 1454, 1455, + 3, 435, 217, 0, 1455, 1456, 3, 407, 203, 0, 1456, 1457, 5, 95, 0, 0, 1457, + 1458, 3, 433, 216, 0, 1458, 1459, 3, 399, 199, 0, 1459, 1460, 3, 425, 212, + 0, 1460, 1461, 3, 419, 209, 0, 1461, 326, 1, 0, 0, 0, 1462, 1463, 3, 421, + 210, 0, 1463, 1464, 3, 399, 199, 0, 1464, 1465, 3, 411, 205, 0, 1465, 328, + 1, 0, 0, 0, 1466, 1467, 3, 421, 210, 0, 1467, 1468, 3, 399, 199, 0, 1468, + 1469, 3, 435, 217, 0, 1469, 1470, 3, 437, 218, 0, 1470, 1471, 5, 95, 0, + 0, 1471, 1472, 3, 441, 220, 0, 1472, 1473, 3, 399, 199, 0, 1473, 1474, + 3, 421, 210, 0, 1474, 1475, 3, 439, 219, 0, 1475, 1476, 3, 407, 203, 0, + 1476, 330, 1, 0, 0, 0, 1477, 1478, 3, 421, 210, 0, 1478, 1479, 3, 407, + 203, 0, 1479, 1480, 3, 399, 199, 0, 1480, 1481, 3, 405, 202, 0, 1481, 332, + 1, 0, 0, 0, 1482, 1483, 3, 425, 212, 0, 1483, 1484, 3, 437, 218, 0, 1484, + 1485, 3, 413, 206, 0, 1485, 1486, 5, 95, 0, 0, 1486, 1487, 3, 441, 220, + 0, 1487, 1488, 3, 399, 199, 0, 1488, 1489, 3, 421, 210, 0, 1489, 1490, + 3, 439, 219, 0, 1490, 1491, 3, 407, 203, 0, 1491, 334, 1, 0, 0, 0, 1492, + 1493, 3, 425, 212, 0, 1493, 1494, 3, 437, 218, 0, 1494, 1495, 3, 415, 207, + 0, 1495, 1496, 3, 421, 210, 0, 1496, 1497, 3, 407, 203, 0, 1497, 336, 1, + 0, 0, 0, 1498, 1499, 3, 429, 214, 0, 1499, 1500, 3, 407, 203, 0, 1500, + 1501, 3, 433, 216, 0, 1501, 1502, 3, 403, 201, 0, 1502, 1503, 3, 407, 203, + 0, 1503, 1504, 3, 425, 212, 0, 1504, 1505, 3, 437, 218, 0, 1505, 1506, + 5, 95, 0, 0, 1506, 1507, 3, 433, 216, 0, 1507, 1508, 3, 399, 199, 0, 1508, + 1509, 3, 425, 212, 0, 1509, 1510, 3, 419, 209, 0, 1510, 338, 1, 0, 0, 0, + 1511, 1512, 3, 433, 216, 0, 1512, 1513, 3, 399, 199, 0, 1513, 1514, 3, + 425, 212, 0, 1514, 1515, 3, 419, 209, 0, 1515, 340, 1, 0, 0, 0, 1516, 1517, + 3, 433, 216, 0, 1517, 1518, 3, 427, 213, 0, 1518, 1519, 3, 443, 221, 0, + 1519, 1520, 5, 95, 0, 0, 1520, 1521, 3, 425, 212, 0, 1521, 1522, 3, 439, + 219, 0, 1522, 1523, 3, 423, 211, 0, 1523, 1524, 3, 401, 200, 0, 1524, 1525, + 3, 407, 203, 0, 1525, 1526, 3, 433, 216, 0, 1526, 342, 1, 0, 0, 0, 1527, + 1528, 3, 411, 205, 0, 1528, 1529, 3, 407, 203, 0, 1529, 1530, 3, 425, 212, + 0, 1530, 1531, 3, 407, 203, 0, 1531, 1532, 3, 433, 216, 0, 1532, 1533, + 3, 399, 199, 0, 1533, 1534, 3, 437, 218, 0, 1534, 1535, 3, 407, 203, 0, + 1535, 1536, 3, 405, 202, 0, 1536, 344, 1, 0, 0, 0, 1537, 1538, 3, 399, + 199, 0, 1538, 1539, 3, 421, 210, 0, 1539, 1540, 3, 443, 221, 0, 1540, 1541, + 3, 399, 199, 0, 1541, 1542, 3, 447, 223, 0, 1542, 1543, 3, 435, 217, 0, + 1543, 346, 1, 0, 0, 0, 1544, 1545, 3, 435, 217, 0, 1545, 1546, 3, 437, + 218, 0, 1546, 1547, 3, 427, 213, 0, 1547, 1548, 3, 433, 216, 0, 1548, 1549, + 3, 407, 203, 0, 1549, 1550, 3, 405, 202, 0, 1550, 348, 1, 0, 0, 0, 1551, + 1552, 3, 437, 218, 0, 1552, 1553, 3, 433, 216, 0, 1553, 1554, 3, 439, 219, + 0, 1554, 1555, 3, 407, 203, 0, 1555, 350, 1, 0, 0, 0, 1556, 1557, 3, 409, + 204, 0, 1557, 1558, 3, 399, 199, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, + 3, 435, 217, 0, 1560, 1561, 3, 407, 203, 0, 1561, 352, 1, 0, 0, 0, 1562, + 1563, 3, 443, 221, 0, 1563, 1564, 3, 415, 207, 0, 1564, 1565, 3, 425, 212, + 0, 1565, 1566, 3, 405, 202, 0, 1566, 1567, 3, 427, 213, 0, 1567, 1568, + 3, 443, 221, 0, 1568, 354, 1, 0, 0, 0, 1569, 1570, 3, 425, 212, 0, 1570, + 1571, 3, 439, 219, 0, 1571, 1572, 3, 421, 210, 0, 1572, 1573, 3, 421, 210, + 0, 1573, 1574, 3, 435, 217, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 409, + 204, 0, 1576, 1577, 3, 415, 207, 0, 1577, 1578, 3, 433, 216, 0, 1578, 1579, + 3, 435, 217, 0, 1579, 1580, 3, 437, 218, 0, 1580, 358, 1, 0, 0, 0, 1581, + 1582, 3, 421, 210, 0, 1582, 1583, 3, 399, 199, 0, 1583, 1584, 3, 435, 217, + 0, 1584, 1585, 3, 437, 218, 0, 1585, 360, 1, 0, 0, 0, 1586, 1587, 3, 409, + 204, 0, 1587, 1588, 3, 415, 207, 0, 1588, 1589, 3, 421, 210, 0, 1589, 1590, + 3, 437, 218, 0, 1590, 1591, 3, 407, 203, 0, 1591, 1592, 3, 433, 216, 0, + 1592, 362, 1, 0, 0, 0, 1593, 1594, 3, 411, 205, 0, 1594, 1595, 3, 433, + 216, 0, 1595, 1596, 3, 427, 213, 0, 1596, 1597, 3, 439, 219, 0, 1597, 1598, + 3, 429, 214, 0, 1598, 1599, 3, 435, 217, 0, 1599, 364, 1, 0, 0, 0, 1600, + 1601, 3, 407, 203, 0, 1601, 1602, 3, 445, 222, 0, 1602, 1603, 3, 403, 201, + 0, 1603, 1604, 3, 421, 210, 0, 1604, 1605, 3, 439, 219, 0, 1605, 1606, + 3, 405, 202, 0, 1606, 1607, 3, 407, 203, 0, 1607, 366, 1, 0, 0, 0, 1608, + 1609, 3, 437, 218, 0, 1609, 1610, 3, 415, 207, 0, 1610, 1611, 3, 407, 203, + 0, 1611, 1612, 3, 435, 217, 0, 1612, 368, 1, 0, 0, 0, 1613, 1614, 3, 427, + 213, 0, 1614, 1615, 3, 437, 218, 0, 1615, 1616, 3, 413, 206, 0, 1616, 1617, + 3, 407, 203, 0, 1617, 1618, 3, 433, 216, 0, 1618, 1619, 3, 435, 217, 0, + 1619, 370, 1, 0, 0, 0, 1620, 1621, 3, 405, 202, 0, 1621, 1622, 3, 427, + 213, 0, 1622, 372, 1, 0, 0, 0, 1623, 1624, 3, 425, 212, 0, 1624, 1625, + 3, 427, 213, 0, 1625, 1626, 3, 437, 218, 0, 1626, 1627, 3, 413, 206, 0, + 1627, 1628, 3, 415, 207, 0, 1628, 1629, 3, 425, 212, 0, 1629, 1630, 3, + 411, 205, 0, 1630, 374, 1, 0, 0, 0, 1631, 1637, 5, 34, 0, 0, 1632, 1636, + 8, 0, 0, 0, 1633, 1634, 5, 34, 0, 0, 1634, 1636, 5, 34, 0, 0, 1635, 1632, + 1, 0, 0, 0, 1635, 1633, 1, 0, 0, 0, 1636, 1639, 1, 0, 0, 0, 1637, 1635, + 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1640, 1, 0, 0, 0, 1639, 1637, + 1, 0, 0, 0, 1640, 1667, 5, 34, 0, 0, 1641, 1647, 5, 96, 0, 0, 1642, 1646, + 8, 1, 0, 0, 1643, 1644, 5, 96, 0, 0, 1644, 1646, 5, 96, 0, 0, 1645, 1642, + 1, 0, 0, 0, 1645, 1643, 1, 0, 0, 0, 1646, 1649, 1, 0, 0, 0, 1647, 1645, + 1, 0, 0, 0, 1647, 1648, 1, 0, 0, 0, 1648, 1650, 1, 0, 0, 0, 1649, 1647, + 1, 0, 0, 0, 1650, 1667, 5, 96, 0, 0, 1651, 1655, 5, 91, 0, 0, 1652, 1654, + 8, 2, 0, 0, 1653, 1652, 1, 0, 0, 0, 1654, 1657, 1, 0, 0, 0, 1655, 1653, + 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1655, + 1, 0, 0, 0, 1658, 1667, 5, 93, 0, 0, 1659, 1663, 7, 3, 0, 0, 1660, 1662, + 7, 4, 0, 0, 1661, 1660, 1, 0, 0, 0, 1662, 1665, 1, 0, 0, 0, 1663, 1661, + 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1667, 1, 0, 0, 0, 1665, 1663, + 1, 0, 0, 0, 1666, 1631, 1, 0, 0, 0, 1666, 1641, 1, 0, 0, 0, 1666, 1651, + 1, 0, 0, 0, 1666, 1659, 1, 0, 0, 0, 1667, 376, 1, 0, 0, 0, 1668, 1670, + 3, 397, 198, 0, 1669, 1668, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1669, + 1, 0, 0, 0, 1671, 1672, 1, 0, 0, 0, 1672, 1680, 1, 0, 0, 0, 1673, 1677, + 5, 46, 0, 0, 1674, 1676, 3, 397, 198, 0, 1675, 1674, 1, 0, 0, 0, 1676, + 1679, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, + 1681, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1680, 1673, 1, 0, 0, 0, 1680, + 1681, 1, 0, 0, 0, 1681, 1689, 1, 0, 0, 0, 1682, 1684, 5, 46, 0, 0, 1683, + 1685, 3, 397, 198, 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, + 1669, 1, 0, 0, 0, 1688, 1682, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, + 1692, 3, 407, 203, 0, 1691, 1693, 7, 5, 0, 0, 1692, 1691, 1, 0, 0, 0, 1692, + 1693, 1, 0, 0, 0, 1693, 1695, 1, 0, 0, 0, 1694, 1696, 3, 397, 198, 0, 1695, + 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1695, 1, 0, 0, 0, 1697, + 1698, 1, 0, 0, 0, 1698, 1700, 1, 0, 0, 0, 1699, 1690, 1, 0, 0, 0, 1699, + 1700, 1, 0, 0, 0, 1700, 1710, 1, 0, 0, 0, 1701, 1702, 5, 48, 0, 0, 1702, + 1703, 5, 120, 0, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1706, 3, 395, 197, 0, + 1705, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, + 1707, 1708, 1, 0, 0, 0, 1708, 1710, 1, 0, 0, 0, 1709, 1688, 1, 0, 0, 0, + 1709, 1701, 1, 0, 0, 0, 1710, 378, 1, 0, 0, 0, 1711, 1715, 5, 63, 0, 0, + 1712, 1714, 3, 397, 198, 0, 1713, 1712, 1, 0, 0, 0, 1714, 1717, 1, 0, 0, + 0, 1715, 1713, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 380, 1, 0, 0, + 0, 1717, 1715, 1, 0, 0, 0, 1718, 1719, 7, 6, 0, 0, 1719, 1720, 3, 375, + 187, 0, 1720, 382, 1, 0, 0, 0, 1721, 1727, 5, 39, 0, 0, 1722, 1726, 8, + 7, 0, 0, 1723, 1724, 5, 39, 0, 0, 1724, 1726, 5, 39, 0, 0, 1725, 1722, + 1, 0, 0, 0, 1725, 1723, 1, 0, 0, 0, 1726, 1729, 1, 0, 0, 0, 1727, 1725, + 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1730, 1, 0, 0, 0, 1729, 1727, + 1, 0, 0, 0, 1730, 1731, 5, 39, 0, 0, 1731, 384, 1, 0, 0, 0, 1732, 1733, + 3, 445, 222, 0, 1733, 1734, 3, 383, 191, 0, 1734, 386, 1, 0, 0, 0, 1735, + 1736, 5, 45, 0, 0, 1736, 1737, 5, 45, 0, 0, 1737, 1741, 1, 0, 0, 0, 1738, + 1740, 8, 8, 0, 0, 1739, 1738, 1, 0, 0, 0, 1740, 1743, 1, 0, 0, 0, 1741, + 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 1749, 1, 0, 0, 0, 1743, + 1741, 1, 0, 0, 0, 1744, 1746, 5, 13, 0, 0, 1745, 1744, 1, 0, 0, 0, 1745, + 1746, 1, 0, 0, 0, 1746, 1747, 1, 0, 0, 0, 1747, 1750, 5, 10, 0, 0, 1748, + 1750, 5, 0, 0, 1, 1749, 1745, 1, 0, 0, 0, 1749, 1748, 1, 0, 0, 0, 1750, + 1751, 1, 0, 0, 0, 1751, 1752, 6, 193, 0, 0, 1752, 388, 1, 0, 0, 0, 1753, + 1754, 5, 47, 0, 0, 1754, 1755, 5, 42, 0, 0, 1755, 1759, 1, 0, 0, 0, 1756, + 1758, 9, 0, 0, 0, 1757, 1756, 1, 0, 0, 0, 1758, 1761, 1, 0, 0, 0, 1759, + 1760, 1, 0, 0, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1762, 1, 0, 0, 0, 1761, + 1759, 1, 0, 0, 0, 1762, 1763, 5, 42, 0, 0, 1763, 1764, 5, 47, 0, 0, 1764, + 1765, 1, 0, 0, 0, 1765, 1766, 6, 194, 0, 0, 1766, 390, 1, 0, 0, 0, 1767, + 1768, 7, 9, 0, 0, 1768, 1769, 1, 0, 0, 0, 1769, 1770, 6, 195, 0, 0, 1770, + 392, 1, 0, 0, 0, 1771, 1772, 9, 0, 0, 0, 1772, 394, 1, 0, 0, 0, 1773, 1774, + 7, 10, 0, 0, 1774, 396, 1, 0, 0, 0, 1775, 1776, 7, 11, 0, 0, 1776, 398, + 1, 0, 0, 0, 1777, 1778, 7, 12, 0, 0, 1778, 400, 1, 0, 0, 0, 1779, 1780, + 7, 13, 0, 0, 1780, 402, 1, 0, 0, 0, 1781, 1782, 7, 14, 0, 0, 1782, 404, + 1, 0, 0, 0, 1783, 1784, 7, 15, 0, 0, 1784, 406, 1, 0, 0, 0, 1785, 1786, + 7, 16, 0, 0, 1786, 408, 1, 0, 0, 0, 1787, 1788, 7, 17, 0, 0, 1788, 410, + 1, 0, 0, 0, 1789, 1790, 7, 18, 0, 0, 1790, 412, 1, 0, 0, 0, 1791, 1792, + 7, 19, 0, 0, 1792, 414, 1, 0, 0, 0, 1793, 1794, 7, 20, 0, 0, 1794, 416, + 1, 0, 0, 0, 1795, 1796, 7, 21, 0, 0, 1796, 418, 1, 0, 0, 0, 1797, 1798, + 7, 22, 0, 0, 1798, 420, 1, 0, 0, 0, 1799, 1800, 7, 23, 0, 0, 1800, 422, + 1, 0, 0, 0, 1801, 1802, 7, 24, 0, 0, 1802, 424, 1, 0, 0, 0, 1803, 1804, + 7, 25, 0, 0, 1804, 426, 1, 0, 0, 0, 1805, 1806, 7, 26, 0, 0, 1806, 428, + 1, 0, 0, 0, 1807, 1808, 7, 27, 0, 0, 1808, 430, 1, 0, 0, 0, 1809, 1810, + 7, 28, 0, 0, 1810, 432, 1, 0, 0, 0, 1811, 1812, 7, 29, 0, 0, 1812, 434, + 1, 0, 0, 0, 1813, 1814, 7, 30, 0, 0, 1814, 436, 1, 0, 0, 0, 1815, 1816, + 7, 31, 0, 0, 1816, 438, 1, 0, 0, 0, 1817, 1818, 7, 32, 0, 0, 1818, 440, + 1, 0, 0, 0, 1819, 1820, 7, 33, 0, 0, 1820, 442, 1, 0, 0, 0, 1821, 1822, + 7, 34, 0, 0, 1822, 444, 1, 0, 0, 0, 1823, 1824, 7, 35, 0, 0, 1824, 446, + 1, 0, 0, 0, 1825, 1826, 7, 36, 0, 0, 1826, 448, 1, 0, 0, 0, 1827, 1828, + 7, 37, 0, 0, 1828, 450, 1, 0, 0, 0, 25, 0, 1635, 1637, 1645, 1647, 1655, + 1663, 1666, 1671, 1677, 1680, 1686, 1688, 1692, 1697, 1699, 1707, 1709, + 1715, 1725, 1727, 1741, 1745, 1749, 1759, 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) } } -func NewSQLiteLexer(input antlr.CharStream) *SQLiteLexer { +// 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) - l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache()) - - l.channelNames = lexerChannelNames - l.modeNames = lexerModeNames - l.RuleNames = lexerRuleNames - l.LiteralNames = lexerLiteralNames - l.SymbolicNames = lexerSymbolicNames - l.GrammarFileName = "SQLite.g4" + 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 @@ -800,161 +1012,201 @@ func NewSQLiteLexer(input antlr.CharStream) *SQLiteLexer { // 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 - SQLiteLexerK_ABORT = 25 - SQLiteLexerK_ACTION = 26 - SQLiteLexerK_ADD = 27 - SQLiteLexerK_AFTER = 28 - SQLiteLexerK_ALL = 29 - SQLiteLexerK_ALTER = 30 - SQLiteLexerK_ANALYZE = 31 - SQLiteLexerK_AND = 32 - SQLiteLexerK_AS = 33 - SQLiteLexerK_ASC = 34 - SQLiteLexerK_ATTACH = 35 - SQLiteLexerK_AUTOINCREMENT = 36 - SQLiteLexerK_BEFORE = 37 - SQLiteLexerK_BEGIN = 38 - SQLiteLexerK_BETWEEN = 39 - SQLiteLexerK_BY = 40 - SQLiteLexerK_CASCADE = 41 - SQLiteLexerK_CASE = 42 - SQLiteLexerK_CAST = 43 - SQLiteLexerK_CHECK = 44 - SQLiteLexerK_COLLATE = 45 - SQLiteLexerK_COLUMN = 46 - SQLiteLexerK_COMMIT = 47 - SQLiteLexerK_CONFLICT = 48 - SQLiteLexerK_CONSTRAINT = 49 - SQLiteLexerK_CREATE = 50 - SQLiteLexerK_CROSS = 51 - SQLiteLexerK_CURRENT_DATE = 52 - SQLiteLexerK_CURRENT_TIME = 53 - SQLiteLexerK_CURRENT_TIMESTAMP = 54 - SQLiteLexerK_DATABASE = 55 - SQLiteLexerK_DEFAULT = 56 - SQLiteLexerK_DEFERRABLE = 57 - SQLiteLexerK_DEFERRED = 58 - SQLiteLexerK_DELETE = 59 - SQLiteLexerK_DESC = 60 - SQLiteLexerK_DETACH = 61 - SQLiteLexerK_DISTINCT = 62 - SQLiteLexerK_DROP = 63 - SQLiteLexerK_EACH = 64 - SQLiteLexerK_ELSE = 65 - SQLiteLexerK_END = 66 - SQLiteLexerK_ESCAPE = 67 - SQLiteLexerK_EXCEPT = 68 - SQLiteLexerK_EXCLUSIVE = 69 - SQLiteLexerK_EXISTS = 70 - SQLiteLexerK_EXPLAIN = 71 - SQLiteLexerK_FAIL = 72 - SQLiteLexerK_FOR = 73 - SQLiteLexerK_FOREIGN = 74 - SQLiteLexerK_FROM = 75 - SQLiteLexerK_FULL = 76 - SQLiteLexerK_GLOB = 77 - SQLiteLexerK_GROUP = 78 - SQLiteLexerK_HAVING = 79 - SQLiteLexerK_IF = 80 - SQLiteLexerK_IGNORE = 81 - SQLiteLexerK_IMMEDIATE = 82 - SQLiteLexerK_IN = 83 - SQLiteLexerK_INDEX = 84 - SQLiteLexerK_INDEXED = 85 - SQLiteLexerK_INITIALLY = 86 - SQLiteLexerK_INNER = 87 - SQLiteLexerK_INSERT = 88 - SQLiteLexerK_INSTEAD = 89 - SQLiteLexerK_INTERSECT = 90 - SQLiteLexerK_INTO = 91 - SQLiteLexerK_IS = 92 - SQLiteLexerK_ISNULL = 93 - SQLiteLexerK_JOIN = 94 - SQLiteLexerK_KEY = 95 - SQLiteLexerK_LEFT = 96 - SQLiteLexerK_LIKE = 97 - SQLiteLexerK_LIMIT = 98 - SQLiteLexerK_MATCH = 99 - SQLiteLexerK_NATURAL = 100 - SQLiteLexerK_NO = 101 - SQLiteLexerK_NOT = 102 - SQLiteLexerK_NOTNULL = 103 - SQLiteLexerK_NULL = 104 - SQLiteLexerK_OF = 105 - SQLiteLexerK_OFFSET = 106 - SQLiteLexerK_ON = 107 - SQLiteLexerK_OR = 108 - SQLiteLexerK_ORDER = 109 - SQLiteLexerK_OUTER = 110 - SQLiteLexerK_PLAN = 111 - SQLiteLexerK_PRAGMA = 112 - SQLiteLexerK_PRIMARY = 113 - SQLiteLexerK_QUERY = 114 - SQLiteLexerK_RAISE = 115 - SQLiteLexerK_RECURSIVE = 116 - SQLiteLexerK_REFERENCES = 117 - SQLiteLexerK_REGEXP = 118 - SQLiteLexerK_REINDEX = 119 - SQLiteLexerK_RELEASE = 120 - SQLiteLexerK_RENAME = 121 - SQLiteLexerK_REPLACE = 122 - SQLiteLexerK_RESTRICT = 123 - SQLiteLexerK_RIGHT = 124 - SQLiteLexerK_ROLLBACK = 125 - SQLiteLexerK_ROW = 126 - SQLiteLexerK_SAVEPOINT = 127 - SQLiteLexerK_SELECT = 128 - SQLiteLexerK_SET = 129 - SQLiteLexerK_TABLE = 130 - SQLiteLexerK_TEMP = 131 - SQLiteLexerK_TEMPORARY = 132 - SQLiteLexerK_THEN = 133 - SQLiteLexerK_TO = 134 - SQLiteLexerK_TRANSACTION = 135 - SQLiteLexerK_TRIGGER = 136 - SQLiteLexerK_UNION = 137 - SQLiteLexerK_UNIQUE = 138 - SQLiteLexerK_UPDATE = 139 - SQLiteLexerK_USING = 140 - SQLiteLexerK_VACUUM = 141 - SQLiteLexerK_VALUES = 142 - SQLiteLexerK_VIEW = 143 - SQLiteLexerK_VIRTUAL = 144 - SQLiteLexerK_WHEN = 145 - SQLiteLexerK_WHERE = 146 - SQLiteLexerK_WITH = 147 - SQLiteLexerK_WITHOUT = 148 - SQLiteLexerIDENTIFIER = 149 - SQLiteLexerNUMERIC_LITERAL = 150 - SQLiteLexerBIND_PARAMETER = 151 - SQLiteLexerSTRING_LITERAL = 152 - SQLiteLexerBLOB_LITERAL = 153 - SQLiteLexerSINGLE_LINE_COMMENT = 154 - SQLiteLexerMULTILINE_COMMENT = 155 - SQLiteLexerSPACES = 156 - SQLiteLexerUNEXPECTED_CHAR = 157 + SQLiteLexerSCOL = 1 + SQLiteLexerDOT = 2 + SQLiteLexerOPEN_PAR = 3 + SQLiteLexerCLOSE_PAR = 4 + SQLiteLexerCOMMA = 5 + SQLiteLexerASSIGN = 6 + SQLiteLexerSTAR = 7 + SQLiteLexerPLUS = 8 + SQLiteLexerPTR2 = 9 + SQLiteLexerPTR = 10 + SQLiteLexerMINUS = 11 + SQLiteLexerTILDE = 12 + SQLiteLexerPIPE2 = 13 + SQLiteLexerDIV = 14 + SQLiteLexerMOD = 15 + SQLiteLexerLT2 = 16 + SQLiteLexerGT2 = 17 + SQLiteLexerAMP = 18 + SQLiteLexerPIPE = 19 + SQLiteLexerLT = 20 + SQLiteLexerLT_EQ = 21 + SQLiteLexerGT = 22 + SQLiteLexerGT_EQ = 23 + SQLiteLexerEQ = 24 + SQLiteLexerNOT_EQ1 = 25 + SQLiteLexerNOT_EQ2 = 26 + SQLiteLexerABORT_ = 27 + SQLiteLexerACTION_ = 28 + SQLiteLexerADD_ = 29 + SQLiteLexerAFTER_ = 30 + SQLiteLexerALL_ = 31 + SQLiteLexerALTER_ = 32 + SQLiteLexerANALYZE_ = 33 + SQLiteLexerAND_ = 34 + SQLiteLexerAS_ = 35 + SQLiteLexerASC_ = 36 + SQLiteLexerATTACH_ = 37 + SQLiteLexerAUTOINCREMENT_ = 38 + SQLiteLexerBEFORE_ = 39 + SQLiteLexerBEGIN_ = 40 + SQLiteLexerBETWEEN_ = 41 + SQLiteLexerBY_ = 42 + SQLiteLexerCASCADE_ = 43 + SQLiteLexerCASE_ = 44 + SQLiteLexerCAST_ = 45 + SQLiteLexerCHECK_ = 46 + SQLiteLexerCOLLATE_ = 47 + SQLiteLexerCOLUMN_ = 48 + SQLiteLexerCOMMIT_ = 49 + SQLiteLexerCONFLICT_ = 50 + SQLiteLexerCONSTRAINT_ = 51 + SQLiteLexerCREATE_ = 52 + SQLiteLexerCROSS_ = 53 + SQLiteLexerCURRENT_DATE_ = 54 + SQLiteLexerCURRENT_TIME_ = 55 + SQLiteLexerCURRENT_TIMESTAMP_ = 56 + SQLiteLexerDATABASE_ = 57 + SQLiteLexerDEFAULT_ = 58 + SQLiteLexerDEFERRABLE_ = 59 + SQLiteLexerDEFERRED_ = 60 + SQLiteLexerDELETE_ = 61 + SQLiteLexerDESC_ = 62 + SQLiteLexerDETACH_ = 63 + SQLiteLexerDISTINCT_ = 64 + SQLiteLexerDROP_ = 65 + SQLiteLexerEACH_ = 66 + SQLiteLexerELSE_ = 67 + SQLiteLexerEND_ = 68 + SQLiteLexerESCAPE_ = 69 + SQLiteLexerEXCEPT_ = 70 + SQLiteLexerEXCLUSIVE_ = 71 + SQLiteLexerEXISTS_ = 72 + SQLiteLexerEXPLAIN_ = 73 + SQLiteLexerFAIL_ = 74 + SQLiteLexerFOR_ = 75 + SQLiteLexerFOREIGN_ = 76 + SQLiteLexerFROM_ = 77 + SQLiteLexerFULL_ = 78 + SQLiteLexerGLOB_ = 79 + SQLiteLexerGROUP_ = 80 + SQLiteLexerHAVING_ = 81 + SQLiteLexerIF_ = 82 + SQLiteLexerIGNORE_ = 83 + SQLiteLexerIMMEDIATE_ = 84 + SQLiteLexerIN_ = 85 + SQLiteLexerINDEX_ = 86 + SQLiteLexerINDEXED_ = 87 + SQLiteLexerINITIALLY_ = 88 + SQLiteLexerINNER_ = 89 + SQLiteLexerINSERT_ = 90 + SQLiteLexerINSTEAD_ = 91 + SQLiteLexerINTERSECT_ = 92 + SQLiteLexerINTO_ = 93 + SQLiteLexerIS_ = 94 + SQLiteLexerISNULL_ = 95 + SQLiteLexerJOIN_ = 96 + SQLiteLexerKEY_ = 97 + SQLiteLexerLEFT_ = 98 + SQLiteLexerLIKE_ = 99 + SQLiteLexerLIMIT_ = 100 + SQLiteLexerMATCH_ = 101 + SQLiteLexerNATURAL_ = 102 + SQLiteLexerNO_ = 103 + SQLiteLexerNOT_ = 104 + SQLiteLexerNOTNULL_ = 105 + SQLiteLexerNULL_ = 106 + SQLiteLexerOF_ = 107 + SQLiteLexerOFFSET_ = 108 + SQLiteLexerON_ = 109 + SQLiteLexerOR_ = 110 + SQLiteLexerORDER_ = 111 + SQLiteLexerOUTER_ = 112 + SQLiteLexerPLAN_ = 113 + SQLiteLexerPRAGMA_ = 114 + SQLiteLexerPRIMARY_ = 115 + SQLiteLexerQUERY_ = 116 + SQLiteLexerRAISE_ = 117 + SQLiteLexerRECURSIVE_ = 118 + SQLiteLexerREFERENCES_ = 119 + SQLiteLexerREGEXP_ = 120 + SQLiteLexerREINDEX_ = 121 + SQLiteLexerRELEASE_ = 122 + SQLiteLexerRENAME_ = 123 + SQLiteLexerREPLACE_ = 124 + SQLiteLexerRESTRICT_ = 125 + SQLiteLexerRETURNING_ = 126 + SQLiteLexerRIGHT_ = 127 + SQLiteLexerROLLBACK_ = 128 + SQLiteLexerROW_ = 129 + SQLiteLexerROWS_ = 130 + SQLiteLexerSAVEPOINT_ = 131 + SQLiteLexerSELECT_ = 132 + SQLiteLexerSET_ = 133 + SQLiteLexerSTRICT_ = 134 + SQLiteLexerTABLE_ = 135 + SQLiteLexerTEMP_ = 136 + SQLiteLexerTEMPORARY_ = 137 + SQLiteLexerTHEN_ = 138 + SQLiteLexerTO_ = 139 + SQLiteLexerTRANSACTION_ = 140 + SQLiteLexerTRIGGER_ = 141 + SQLiteLexerUNION_ = 142 + SQLiteLexerUNIQUE_ = 143 + SQLiteLexerUPDATE_ = 144 + SQLiteLexerUSING_ = 145 + SQLiteLexerVACUUM_ = 146 + SQLiteLexerVALUES_ = 147 + SQLiteLexerVIEW_ = 148 + SQLiteLexerVIRTUAL_ = 149 + SQLiteLexerWHEN_ = 150 + SQLiteLexerWHERE_ = 151 + SQLiteLexerWITH_ = 152 + SQLiteLexerWITHOUT_ = 153 + SQLiteLexerFIRST_VALUE_ = 154 + SQLiteLexerOVER_ = 155 + SQLiteLexerPARTITION_ = 156 + SQLiteLexerRANGE_ = 157 + SQLiteLexerPRECEDING_ = 158 + SQLiteLexerUNBOUNDED_ = 159 + SQLiteLexerCURRENT_ = 160 + SQLiteLexerFOLLOWING_ = 161 + SQLiteLexerCUME_DIST_ = 162 + SQLiteLexerDENSE_RANK_ = 163 + SQLiteLexerLAG_ = 164 + SQLiteLexerLAST_VALUE_ = 165 + SQLiteLexerLEAD_ = 166 + SQLiteLexerNTH_VALUE_ = 167 + SQLiteLexerNTILE_ = 168 + SQLiteLexerPERCENT_RANK_ = 169 + SQLiteLexerRANK_ = 170 + SQLiteLexerROW_NUMBER_ = 171 + SQLiteLexerGENERATED_ = 172 + SQLiteLexerALWAYS_ = 173 + SQLiteLexerSTORED_ = 174 + SQLiteLexerTRUE_ = 175 + SQLiteLexerFALSE_ = 176 + SQLiteLexerWINDOW_ = 177 + SQLiteLexerNULLS_ = 178 + SQLiteLexerFIRST_ = 179 + SQLiteLexerLAST_ = 180 + SQLiteLexerFILTER_ = 181 + SQLiteLexerGROUPS_ = 182 + SQLiteLexerEXCLUDE_ = 183 + SQLiteLexerTIES_ = 184 + SQLiteLexerOTHERS_ = 185 + SQLiteLexerDO_ = 186 + SQLiteLexerNOTHING_ = 187 + SQLiteLexerIDENTIFIER = 188 + SQLiteLexerNUMERIC_LITERAL = 189 + SQLiteLexerNUMBERED_BIND_PARAMETER = 190 + SQLiteLexerNAMED_BIND_PARAMETER = 191 + SQLiteLexerSTRING_LITERAL = 192 + SQLiteLexerBLOB_LITERAL = 193 + SQLiteLexerSINGLE_LINE_COMMENT = 194 + SQLiteLexerMULTILINE_COMMENT = 195 + SQLiteLexerSPACES = 196 + SQLiteLexerUNEXPECTED_CHAR = 197 ) diff --git a/internal/engine/sqlite/parser/sqlite_listener.go b/internal/engine/sqlite/parser/sqlite_listener.go deleted file mode 100644 index e62df8ed97..0000000000 --- a/internal/engine/sqlite/parser/sqlite_listener.go +++ /dev/null @@ -1,508 +0,0 @@ -// Code generated from SQLite.g4 by ANTLR 4.8. DO NOT EDIT. - -package parser // SQLite - -import "github.com/antlr/antlr4/runtime/Go/antlr" - -// SQLiteListener is a complete listener for a parse tree produced by SQLiteParser. -type SQLiteListener 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) - - // EnterCompound_select_stmt is called when entering the compound_select_stmt production. - EnterCompound_select_stmt(c *Compound_select_stmtContext) - - // EnterCreate_index_stmt is called when entering the create_index_stmt production. - EnterCreate_index_stmt(c *Create_index_stmtContext) - - // EnterCreate_table_stmt is called when entering the create_table_stmt production. - EnterCreate_table_stmt(c *Create_table_stmtContext) - - // 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) - - // 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_index_stmt is called when entering the drop_index_stmt production. - EnterDrop_index_stmt(c *Drop_index_stmtContext) - - // EnterDrop_table_stmt is called when entering the drop_table_stmt production. - EnterDrop_table_stmt(c *Drop_table_stmtContext) - - // EnterDrop_trigger_stmt is called when entering the drop_trigger_stmt production. - EnterDrop_trigger_stmt(c *Drop_trigger_stmtContext) - - // EnterDrop_view_stmt is called when entering the drop_view_stmt production. - EnterDrop_view_stmt(c *Drop_view_stmtContext) - - // EnterFactored_select_stmt is called when entering the factored_select_stmt production. - EnterFactored_select_stmt(c *Factored_select_stmtContext) - - // EnterInsert_stmt is called when entering the insert_stmt production. - EnterInsert_stmt(c *Insert_stmtContext) - - // EnterPragma_stmt is called when entering the pragma_stmt production. - EnterPragma_stmt(c *Pragma_stmtContext) - - // EnterReindex_stmt is called when entering the reindex_stmt production. - EnterReindex_stmt(c *Reindex_stmtContext) - - // EnterRelease_stmt is called when entering the release_stmt production. - EnterRelease_stmt(c *Release_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) - - // EnterSimple_select_stmt is called when entering the simple_select_stmt production. - EnterSimple_select_stmt(c *Simple_select_stmtContext) - - // EnterSelect_stmt is called when entering the select_stmt production. - EnterSelect_stmt(c *Select_stmtContext) - - // EnterSelect_or_values is called when entering the select_or_values production. - EnterSelect_or_values(c *Select_or_valuesContext) - - // EnterUpdate_stmt is called when entering the update_stmt production. - EnterUpdate_stmt(c *Update_stmtContext) - - // EnterUpdate_stmt_limited is called when entering the update_stmt_limited production. - EnterUpdate_stmt_limited(c *Update_stmt_limitedContext) - - // EnterVacuum_stmt is called when entering the vacuum_stmt production. - EnterVacuum_stmt(c *Vacuum_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) - - // EnterConflict_clause is called when entering the conflict_clause production. - EnterConflict_clause(c *Conflict_clauseContext) - - // EnterExpr is called when entering the expr production. - EnterExpr(c *ExprContext) - - // EnterForeign_key_clause is called when entering the foreign_key_clause production. - EnterForeign_key_clause(c *Foreign_key_clauseContext) - - // EnterRaise_function is called when entering the raise_function production. - EnterRaise_function(c *Raise_functionContext) - - // EnterIndexed_column is called when entering the indexed_column production. - EnterIndexed_column(c *Indexed_columnContext) - - // EnterTable_constraint is called when entering the table_constraint production. - EnterTable_constraint(c *Table_constraintContext) - - // EnterWith_clause is called when entering the with_clause production. - EnterWith_clause(c *With_clauseContext) - - // EnterQualified_table_name is called when entering the qualified_table_name production. - EnterQualified_table_name(c *Qualified_table_nameContext) - - // EnterOrdering_term is called when entering the ordering_term production. - EnterOrdering_term(c *Ordering_termContext) - - // EnterPragma_value is called when entering the pragma_value production. - EnterPragma_value(c *Pragma_valueContext) - - // EnterCommon_table_expression is called when entering the common_table_expression production. - EnterCommon_table_expression(c *Common_table_expressionContext) - - // EnterResult_column is called when entering the result_column production. - EnterResult_column(c *Result_columnContext) - - // EnterTable_or_subquery is called when entering the table_or_subquery production. - EnterTable_or_subquery(c *Table_or_subqueryContext) - - // EnterJoin_clause is called when entering the join_clause production. - EnterJoin_clause(c *Join_clauseContext) - - // 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) - - // EnterSelect_core is called when entering the select_core production. - EnterSelect_core(c *Select_coreContext) - - // EnterCompound_operator is called when entering the compound_operator production. - EnterCompound_operator(c *Compound_operatorContext) - - // EnterSigned_number is called when entering the signed_number production. - EnterSigned_number(c *Signed_numberContext) - - // EnterLiteral_value is called when entering the literal_value production. - EnterLiteral_value(c *Literal_valueContext) - - // 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) - - // EnterDatabase_name is called when entering the database_name production. - EnterDatabase_name(c *Database_nameContext) - - // EnterSchema_name is called when entering the schema_name production. - EnterSchema_name(c *Schema_nameContext) - - // EnterTable_function_name is called when entering the table_function_name production. - EnterTable_function_name(c *Table_function_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) - - // EnterNew_column_name is called when entering the new_column_name production. - EnterNew_column_name(c *New_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) - - // EnterTransaction_name is called when entering the transaction_name production. - EnterTransaction_name(c *Transaction_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) - - // ExitCompound_select_stmt is called when exiting the compound_select_stmt production. - ExitCompound_select_stmt(c *Compound_select_stmtContext) - - // ExitCreate_index_stmt is called when exiting the create_index_stmt production. - ExitCreate_index_stmt(c *Create_index_stmtContext) - - // ExitCreate_table_stmt is called when exiting the create_table_stmt production. - ExitCreate_table_stmt(c *Create_table_stmtContext) - - // 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) - - // 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_index_stmt is called when exiting the drop_index_stmt production. - ExitDrop_index_stmt(c *Drop_index_stmtContext) - - // ExitDrop_table_stmt is called when exiting the drop_table_stmt production. - ExitDrop_table_stmt(c *Drop_table_stmtContext) - - // ExitDrop_trigger_stmt is called when exiting the drop_trigger_stmt production. - ExitDrop_trigger_stmt(c *Drop_trigger_stmtContext) - - // ExitDrop_view_stmt is called when exiting the drop_view_stmt production. - ExitDrop_view_stmt(c *Drop_view_stmtContext) - - // ExitFactored_select_stmt is called when exiting the factored_select_stmt production. - ExitFactored_select_stmt(c *Factored_select_stmtContext) - - // ExitInsert_stmt is called when exiting the insert_stmt production. - ExitInsert_stmt(c *Insert_stmtContext) - - // ExitPragma_stmt is called when exiting the pragma_stmt production. - ExitPragma_stmt(c *Pragma_stmtContext) - - // ExitReindex_stmt is called when exiting the reindex_stmt production. - ExitReindex_stmt(c *Reindex_stmtContext) - - // ExitRelease_stmt is called when exiting the release_stmt production. - ExitRelease_stmt(c *Release_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) - - // ExitSimple_select_stmt is called when exiting the simple_select_stmt production. - ExitSimple_select_stmt(c *Simple_select_stmtContext) - - // ExitSelect_stmt is called when exiting the select_stmt production. - ExitSelect_stmt(c *Select_stmtContext) - - // ExitSelect_or_values is called when exiting the select_or_values production. - ExitSelect_or_values(c *Select_or_valuesContext) - - // ExitUpdate_stmt is called when exiting the update_stmt production. - ExitUpdate_stmt(c *Update_stmtContext) - - // ExitUpdate_stmt_limited is called when exiting the update_stmt_limited production. - ExitUpdate_stmt_limited(c *Update_stmt_limitedContext) - - // ExitVacuum_stmt is called when exiting the vacuum_stmt production. - ExitVacuum_stmt(c *Vacuum_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) - - // ExitConflict_clause is called when exiting the conflict_clause production. - ExitConflict_clause(c *Conflict_clauseContext) - - // ExitExpr is called when exiting the expr production. - ExitExpr(c *ExprContext) - - // ExitForeign_key_clause is called when exiting the foreign_key_clause production. - ExitForeign_key_clause(c *Foreign_key_clauseContext) - - // ExitRaise_function is called when exiting the raise_function production. - ExitRaise_function(c *Raise_functionContext) - - // ExitIndexed_column is called when exiting the indexed_column production. - ExitIndexed_column(c *Indexed_columnContext) - - // ExitTable_constraint is called when exiting the table_constraint production. - ExitTable_constraint(c *Table_constraintContext) - - // ExitWith_clause is called when exiting the with_clause production. - ExitWith_clause(c *With_clauseContext) - - // ExitQualified_table_name is called when exiting the qualified_table_name production. - ExitQualified_table_name(c *Qualified_table_nameContext) - - // ExitOrdering_term is called when exiting the ordering_term production. - ExitOrdering_term(c *Ordering_termContext) - - // ExitPragma_value is called when exiting the pragma_value production. - ExitPragma_value(c *Pragma_valueContext) - - // ExitCommon_table_expression is called when exiting the common_table_expression production. - ExitCommon_table_expression(c *Common_table_expressionContext) - - // ExitResult_column is called when exiting the result_column production. - ExitResult_column(c *Result_columnContext) - - // ExitTable_or_subquery is called when exiting the table_or_subquery production. - ExitTable_or_subquery(c *Table_or_subqueryContext) - - // ExitJoin_clause is called when exiting the join_clause production. - ExitJoin_clause(c *Join_clauseContext) - - // 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) - - // ExitSelect_core is called when exiting the select_core production. - ExitSelect_core(c *Select_coreContext) - - // ExitCompound_operator is called when exiting the compound_operator production. - ExitCompound_operator(c *Compound_operatorContext) - - // ExitSigned_number is called when exiting the signed_number production. - ExitSigned_number(c *Signed_numberContext) - - // ExitLiteral_value is called when exiting the literal_value production. - ExitLiteral_value(c *Literal_valueContext) - - // 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) - - // ExitDatabase_name is called when exiting the database_name production. - ExitDatabase_name(c *Database_nameContext) - - // ExitSchema_name is called when exiting the schema_name production. - ExitSchema_name(c *Schema_nameContext) - - // ExitTable_function_name is called when exiting the table_function_name production. - ExitTable_function_name(c *Table_function_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) - - // ExitNew_column_name is called when exiting the new_column_name production. - ExitNew_column_name(c *New_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) - - // ExitTransaction_name is called when exiting the transaction_name production. - ExitTransaction_name(c *Transaction_nameContext) - - // ExitAny_name is called when exiting the any_name production. - ExitAny_name(c *Any_nameContext) -} diff --git a/internal/engine/sqlite/parser/sqlite_parser.go b/internal/engine/sqlite/parser/sqlite_parser.go index 445b5b59c7..dba28c22e4 100644 --- a/internal/engine/sqlite/parser/sqlite_parser.go +++ b/internal/engine/sqlite/parser/sqlite_parser.go @@ -1,1198 +1,1552 @@ -// Code generated from SQLite.g4 by ANTLR 4.8. DO NOT EDIT. +// Code generated from SQLiteParser.g4 by ANTLR 4.13.1. DO NOT EDIT. -package parser // SQLite +package parser // SQLiteParser import ( "fmt" - "reflect" "strconv" + "sync" - "github.com/antlr/antlr4/runtime/Go/antlr" + "github.com/antlr4-go/antlr/v4" ) // Suppress unused import errors var _ = fmt.Printf -var _ = reflect.Copy var _ = strconv.Itoa - -var parserATN = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 159, 1691, - 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, - 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, - 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, - 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, - 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, - 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, - 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, - 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, - 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, - 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, - 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, - 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, - 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, - 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, - 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, - 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 3, 2, 7, 2, 170, 10, 2, 12, - 2, 14, 2, 173, 11, 2, 3, 2, 3, 2, 3, 3, 7, 3, 178, 10, 3, 12, 3, 14, 3, - 181, 11, 3, 3, 3, 3, 3, 6, 3, 185, 10, 3, 13, 3, 14, 3, 186, 3, 3, 7, 3, - 190, 10, 3, 12, 3, 14, 3, 193, 11, 3, 3, 3, 7, 3, 196, 10, 3, 12, 3, 14, - 3, 199, 11, 3, 3, 4, 3, 4, 3, 4, 5, 4, 204, 10, 4, 5, 4, 206, 10, 4, 3, - 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, - 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, - 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 238, 10, 4, 3, 5, 3, 5, 3, 5, 3, - 5, 3, 5, 5, 5, 245, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 253, - 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 261, 10, 5, 3, 5, 5, 5, - 264, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 273, 10, 6, - 3, 7, 3, 7, 5, 7, 277, 10, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, - 285, 10, 8, 3, 8, 3, 8, 5, 8, 289, 10, 8, 5, 8, 291, 10, 8, 3, 9, 3, 9, - 3, 9, 5, 9, 296, 10, 9, 5, 9, 298, 10, 9, 3, 10, 5, 10, 301, 10, 10, 3, - 10, 3, 10, 3, 10, 5, 10, 306, 10, 10, 3, 10, 3, 10, 5, 10, 310, 10, 10, - 3, 10, 6, 10, 313, 10, 10, 13, 10, 14, 10, 314, 3, 10, 3, 10, 3, 10, 3, - 10, 3, 10, 7, 10, 322, 10, 10, 12, 10, 14, 10, 325, 11, 10, 5, 10, 327, - 10, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 333, 10, 10, 5, 10, 335, 10, - 10, 3, 11, 3, 11, 5, 11, 339, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, - 345, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 350, 10, 11, 3, 11, 3, 11, 3, - 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 359, 10, 11, 12, 11, 14, 11, 362, - 11, 11, 3, 11, 3, 11, 3, 11, 5, 11, 367, 10, 11, 3, 12, 3, 12, 5, 12, 371, - 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 377, 10, 12, 3, 12, 3, 12, 3, - 12, 5, 12, 382, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 389, - 10, 12, 12, 12, 14, 12, 392, 11, 12, 3, 12, 3, 12, 7, 12, 396, 10, 12, - 12, 12, 14, 12, 399, 11, 12, 3, 12, 3, 12, 3, 12, 5, 12, 404, 10, 12, 3, - 12, 3, 12, 5, 12, 408, 10, 12, 3, 13, 3, 13, 5, 13, 412, 10, 13, 3, 13, - 3, 13, 3, 13, 3, 13, 5, 13, 418, 10, 13, 3, 13, 3, 13, 3, 13, 5, 13, 423, - 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 430, 10, 13, 3, 13, 3, - 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 439, 10, 13, 12, 13, 14, - 13, 442, 11, 13, 5, 13, 444, 10, 13, 5, 13, 446, 10, 13, 3, 13, 3, 13, - 3, 13, 3, 13, 5, 13, 452, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 458, - 10, 13, 3, 13, 3, 13, 5, 13, 462, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, - 13, 5, 13, 469, 10, 13, 3, 13, 3, 13, 6, 13, 473, 10, 13, 13, 13, 14, 13, - 474, 3, 13, 3, 13, 3, 14, 3, 14, 5, 14, 481, 10, 14, 3, 14, 3, 14, 3, 14, - 3, 14, 5, 14, 487, 10, 14, 3, 14, 3, 14, 3, 14, 5, 14, 492, 10, 14, 3, - 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, - 504, 10, 15, 3, 15, 3, 15, 3, 15, 5, 15, 509, 10, 15, 3, 15, 3, 15, 3, - 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 518, 10, 15, 12, 15, 14, 15, 521, - 11, 15, 3, 15, 3, 15, 5, 15, 525, 10, 15, 3, 16, 5, 16, 528, 10, 16, 3, - 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 535, 10, 16, 3, 17, 5, 17, 538, - 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 545, 10, 17, 3, 17, 3, - 17, 3, 17, 3, 17, 3, 17, 7, 17, 552, 10, 17, 12, 17, 14, 17, 555, 11, 17, - 5, 17, 557, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 563, 10, 17, 5, - 17, 565, 10, 17, 3, 18, 3, 18, 5, 18, 569, 10, 18, 3, 18, 3, 18, 3, 19, - 3, 19, 3, 19, 3, 19, 5, 19, 577, 10, 19, 3, 19, 3, 19, 3, 19, 5, 19, 582, - 10, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 590, 10, 20, 3, - 20, 3, 20, 3, 20, 5, 20, 595, 10, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, - 3, 21, 5, 21, 603, 10, 21, 3, 21, 3, 21, 3, 21, 5, 21, 608, 10, 21, 3, - 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 5, 22, 616, 10, 22, 3, 22, 3, 22, - 3, 22, 5, 22, 621, 10, 22, 3, 22, 3, 22, 3, 23, 5, 23, 626, 10, 23, 3, - 23, 3, 23, 3, 23, 3, 23, 7, 23, 632, 10, 23, 12, 23, 14, 23, 635, 11, 23, - 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 642, 10, 23, 12, 23, 14, 23, - 645, 11, 23, 5, 23, 647, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 653, - 10, 23, 5, 23, 655, 10, 23, 3, 24, 5, 24, 658, 10, 24, 3, 24, 3, 24, 3, - 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, - 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 677, 10, 24, 3, 24, 3, 24, 3, 24, 3, - 24, 5, 24, 683, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 690, - 10, 24, 12, 24, 14, 24, 693, 11, 24, 3, 24, 3, 24, 5, 24, 697, 10, 24, - 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 704, 10, 24, 12, 24, 14, 24, - 707, 11, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 715, 10, - 24, 12, 24, 14, 24, 718, 11, 24, 3, 24, 3, 24, 7, 24, 722, 10, 24, 12, - 24, 14, 24, 725, 11, 24, 3, 24, 3, 24, 3, 24, 5, 24, 730, 10, 24, 3, 25, - 3, 25, 3, 25, 3, 25, 5, 25, 736, 10, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, - 25, 3, 25, 3, 25, 5, 25, 745, 10, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, - 5, 26, 752, 10, 26, 3, 26, 3, 26, 5, 26, 756, 10, 26, 5, 26, 758, 10, 26, - 3, 27, 3, 27, 5, 27, 762, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 5, - 28, 769, 10, 28, 5, 28, 771, 10, 28, 3, 28, 3, 28, 5, 28, 775, 10, 28, - 3, 28, 5, 28, 778, 10, 28, 3, 29, 3, 29, 3, 29, 3, 30, 5, 30, 784, 10, - 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 7, 30, 792, 10, 30, 12, 30, - 14, 30, 795, 11, 30, 5, 30, 797, 10, 30, 3, 30, 3, 30, 3, 30, 3, 30, 5, - 30, 803, 10, 30, 5, 30, 805, 10, 30, 3, 31, 5, 31, 808, 10, 31, 3, 31, - 3, 31, 3, 31, 3, 31, 7, 31, 814, 10, 31, 12, 31, 14, 31, 817, 11, 31, 3, - 31, 3, 31, 3, 31, 3, 31, 3, 31, 7, 31, 824, 10, 31, 12, 31, 14, 31, 827, - 11, 31, 5, 31, 829, 10, 31, 3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 835, 10, - 31, 5, 31, 837, 10, 31, 3, 32, 3, 32, 5, 32, 841, 10, 32, 3, 32, 3, 32, - 3, 32, 7, 32, 846, 10, 32, 12, 32, 14, 32, 849, 11, 32, 3, 32, 3, 32, 3, - 32, 3, 32, 7, 32, 855, 10, 32, 12, 32, 14, 32, 858, 11, 32, 3, 32, 5, 32, - 861, 10, 32, 5, 32, 863, 10, 32, 3, 32, 3, 32, 5, 32, 867, 10, 32, 3, 32, - 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 874, 10, 32, 12, 32, 14, 32, 877, 11, - 32, 3, 32, 3, 32, 5, 32, 881, 10, 32, 5, 32, 883, 10, 32, 3, 32, 3, 32, - 3, 32, 3, 32, 3, 32, 7, 32, 890, 10, 32, 12, 32, 14, 32, 893, 11, 32, 3, - 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 7, 32, 901, 10, 32, 12, 32, 14, - 32, 904, 11, 32, 3, 32, 3, 32, 7, 32, 908, 10, 32, 12, 32, 14, 32, 911, - 11, 32, 5, 32, 913, 10, 32, 3, 33, 5, 33, 916, 10, 33, 3, 33, 3, 33, 3, - 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 929, - 10, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, - 3, 33, 7, 33, 941, 10, 33, 12, 33, 14, 33, 944, 11, 33, 3, 33, 3, 33, 5, - 33, 948, 10, 33, 3, 34, 5, 34, 951, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, - 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 964, 10, 34, 3, - 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, - 976, 10, 34, 12, 34, 14, 34, 979, 11, 34, 3, 34, 3, 34, 5, 34, 983, 10, - 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 990, 10, 34, 12, 34, 14, - 34, 993, 11, 34, 5, 34, 995, 10, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, - 1001, 10, 34, 5, 34, 1003, 10, 34, 3, 35, 3, 35, 3, 36, 3, 36, 5, 36, 1009, - 10, 36, 3, 36, 7, 36, 1012, 10, 36, 12, 36, 14, 36, 1015, 11, 36, 3, 37, - 6, 37, 1018, 10, 37, 13, 37, 14, 37, 1019, 3, 37, 3, 37, 3, 37, 3, 37, - 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 1032, 10, 37, 3, 38, 3, - 38, 5, 38, 1036, 10, 38, 3, 38, 3, 38, 3, 38, 5, 38, 1041, 10, 38, 3, 38, - 3, 38, 5, 38, 1045, 10, 38, 3, 38, 5, 38, 1048, 10, 38, 3, 38, 3, 38, 3, - 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, - 3, 38, 3, 38, 3, 38, 5, 38, 1066, 10, 38, 3, 38, 3, 38, 3, 38, 5, 38, 1071, - 10, 38, 3, 39, 3, 39, 3, 39, 5, 39, 1076, 10, 39, 3, 40, 3, 40, 3, 40, - 3, 40, 3, 40, 3, 40, 5, 40, 1084, 10, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1089, - 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1098, 10, - 40, 3, 40, 3, 40, 3, 40, 7, 40, 1103, 10, 40, 12, 40, 14, 40, 1106, 11, - 40, 3, 40, 5, 40, 1109, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, - 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1125, 10, - 40, 3, 40, 5, 40, 1128, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, - 5, 40, 1136, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 6, 40, 1143, 10, - 40, 13, 40, 14, 40, 1144, 3, 40, 3, 40, 5, 40, 1149, 10, 40, 3, 40, 3, - 40, 3, 40, 5, 40, 1154, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, - 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, - 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, - 5, 40, 1183, 10, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1188, 10, 40, 3, 40, 3, - 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1197, 10, 40, 3, 40, 3, 40, - 3, 40, 3, 40, 3, 40, 3, 40, 7, 40, 1205, 10, 40, 12, 40, 14, 40, 1208, - 11, 40, 5, 40, 1210, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1216, 10, - 40, 3, 40, 5, 40, 1219, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, - 1226, 10, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 1232, 10, 40, 3, 40, 3, - 40, 3, 40, 3, 40, 3, 40, 5, 40, 1239, 10, 40, 7, 40, 1241, 10, 40, 12, - 40, 14, 40, 1244, 11, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 7, - 41, 1252, 10, 41, 12, 41, 14, 41, 1255, 11, 41, 3, 41, 3, 41, 5, 41, 1259, - 10, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, - 3, 41, 5, 41, 1271, 10, 41, 3, 41, 3, 41, 5, 41, 1275, 10, 41, 7, 41, 1277, - 10, 41, 12, 41, 14, 41, 1280, 11, 41, 3, 41, 5, 41, 1283, 10, 41, 3, 41, - 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 1290, 10, 41, 5, 41, 1292, 10, 41, 3, - 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 1300, 10, 42, 3, 42, 3, 42, - 3, 43, 3, 43, 3, 43, 5, 43, 1307, 10, 43, 3, 43, 5, 43, 1310, 10, 43, 3, - 44, 3, 44, 5, 44, 1314, 10, 44, 3, 44, 3, 44, 3, 44, 5, 44, 1319, 10, 44, - 3, 44, 3, 44, 3, 44, 3, 44, 7, 44, 1325, 10, 44, 12, 44, 14, 44, 1328, - 11, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, - 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 7, 44, 1344, 10, 44, 12, 44, 14, 44, - 1347, 11, 44, 3, 44, 3, 44, 3, 44, 5, 44, 1352, 10, 44, 3, 45, 3, 45, 5, - 45, 1356, 10, 45, 3, 45, 3, 45, 3, 45, 7, 45, 1361, 10, 45, 12, 45, 14, - 45, 1364, 11, 45, 3, 46, 3, 46, 3, 46, 5, 46, 1369, 10, 46, 3, 46, 3, 46, - 3, 46, 3, 46, 3, 46, 3, 46, 5, 46, 1377, 10, 46, 3, 47, 3, 47, 3, 47, 5, - 47, 1382, 10, 47, 3, 47, 5, 47, 1385, 10, 47, 3, 48, 3, 48, 3, 48, 5, 48, - 1390, 10, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 7, 49, 1397, 10, 49, 12, - 49, 14, 49, 1400, 11, 49, 3, 49, 3, 49, 5, 49, 1404, 10, 49, 3, 49, 3, - 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, - 5, 50, 1418, 10, 50, 3, 50, 5, 50, 1421, 10, 50, 5, 50, 1423, 10, 50, 3, - 51, 3, 51, 3, 51, 5, 51, 1428, 10, 51, 3, 51, 3, 51, 5, 51, 1432, 10, 51, - 3, 51, 5, 51, 1435, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1442, - 10, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1447, 10, 51, 3, 51, 3, 51, 3, 51, - 3, 51, 3, 51, 7, 51, 1454, 10, 51, 12, 51, 14, 51, 1457, 11, 51, 5, 51, - 1459, 10, 51, 3, 51, 3, 51, 5, 51, 1463, 10, 51, 3, 51, 5, 51, 1466, 10, - 51, 3, 51, 3, 51, 3, 51, 3, 51, 7, 51, 1472, 10, 51, 12, 51, 14, 51, 1475, - 11, 51, 3, 51, 5, 51, 1478, 10, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, - 3, 51, 5, 51, 1486, 10, 51, 3, 51, 5, 51, 1489, 10, 51, 5, 51, 1491, 10, - 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 7, 52, 1498, 10, 52, 12, 52, 14, - 52, 1501, 11, 52, 3, 53, 3, 53, 5, 53, 1505, 10, 53, 3, 53, 3, 53, 5, 53, - 1509, 10, 53, 3, 53, 3, 53, 5, 53, 1513, 10, 53, 3, 53, 5, 53, 1516, 10, - 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 7, 54, 1525, 10, 54, - 12, 54, 14, 54, 1528, 11, 54, 3, 54, 3, 54, 5, 54, 1532, 10, 54, 3, 55, - 3, 55, 5, 55, 1536, 10, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1541, 10, 55, 12, - 55, 14, 55, 1544, 11, 55, 3, 55, 3, 55, 3, 55, 3, 55, 7, 55, 1550, 10, - 55, 12, 55, 14, 55, 1553, 11, 55, 3, 55, 5, 55, 1556, 10, 55, 5, 55, 1558, - 10, 55, 3, 55, 3, 55, 5, 55, 1562, 10, 55, 3, 55, 3, 55, 3, 55, 3, 55, - 3, 55, 7, 55, 1569, 10, 55, 12, 55, 14, 55, 1572, 11, 55, 3, 55, 3, 55, - 5, 55, 1576, 10, 55, 5, 55, 1578, 10, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, - 55, 7, 55, 1585, 10, 55, 12, 55, 14, 55, 1588, 11, 55, 3, 55, 3, 55, 3, - 55, 3, 55, 3, 55, 3, 55, 7, 55, 1596, 10, 55, 12, 55, 14, 55, 1599, 11, - 55, 3, 55, 3, 55, 7, 55, 1603, 10, 55, 12, 55, 14, 55, 1606, 11, 55, 5, - 55, 1608, 10, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 5, 56, 1615, 10, 56, - 3, 57, 5, 57, 1618, 10, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, - 60, 3, 60, 3, 61, 3, 61, 5, 61, 1630, 10, 61, 3, 62, 3, 62, 3, 63, 3, 63, - 3, 64, 3, 64, 3, 65, 3, 65, 3, 66, 3, 66, 3, 67, 3, 67, 3, 68, 3, 68, 3, - 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 3, 72, 3, 72, 3, 73, 3, 73, 3, 74, - 3, 74, 3, 75, 3, 75, 3, 76, 3, 76, 3, 77, 3, 77, 3, 78, 3, 78, 3, 79, 3, - 79, 3, 80, 3, 80, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, - 5, 82, 1678, 10, 82, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, - 84, 3, 84, 5, 84, 1689, 10, 84, 3, 84, 4, 390, 1019, 3, 78, 85, 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, 2, 21, 5, 2, - 60, 60, 71, 71, 84, 84, 4, 2, 49, 49, 68, 68, 4, 2, 7, 7, 108, 108, 3, - 2, 133, 134, 4, 2, 31, 31, 64, 64, 4, 2, 36, 36, 62, 62, 7, 2, 27, 27, - 74, 74, 83, 83, 124, 124, 127, 127, 4, 2, 9, 9, 14, 15, 3, 2, 10, 11, 3, - 2, 16, 19, 3, 2, 20, 23, 4, 2, 8, 8, 24, 26, 6, 2, 79, 79, 99, 99, 101, - 101, 120, 120, 4, 2, 61, 61, 141, 141, 5, 2, 27, 27, 74, 74, 127, 127, - 6, 2, 54, 56, 106, 106, 152, 152, 154, 155, 4, 2, 10, 12, 104, 104, 4, - 2, 151, 151, 154, 154, 3, 2, 27, 150, 2, 1946, 2, 171, 3, 2, 2, 2, 4, 179, - 3, 2, 2, 2, 6, 205, 3, 2, 2, 2, 8, 239, 3, 2, 2, 2, 10, 265, 3, 2, 2, 2, - 12, 274, 3, 2, 2, 2, 14, 282, 3, 2, 2, 2, 16, 292, 3, 2, 2, 2, 18, 300, - 3, 2, 2, 2, 20, 336, 3, 2, 2, 2, 22, 368, 3, 2, 2, 2, 24, 409, 3, 2, 2, - 2, 26, 478, 3, 2, 2, 2, 28, 497, 3, 2, 2, 2, 30, 527, 3, 2, 2, 2, 32, 537, - 3, 2, 2, 2, 34, 566, 3, 2, 2, 2, 36, 572, 3, 2, 2, 2, 38, 585, 3, 2, 2, - 2, 40, 598, 3, 2, 2, 2, 42, 611, 3, 2, 2, 2, 44, 625, 3, 2, 2, 2, 46, 657, - 3, 2, 2, 2, 48, 731, 3, 2, 2, 2, 50, 746, 3, 2, 2, 2, 52, 759, 3, 2, 2, - 2, 54, 765, 3, 2, 2, 2, 56, 779, 3, 2, 2, 2, 58, 783, 3, 2, 2, 2, 60, 807, - 3, 2, 2, 2, 62, 912, 3, 2, 2, 2, 64, 915, 3, 2, 2, 2, 66, 950, 3, 2, 2, - 2, 68, 1004, 3, 2, 2, 2, 70, 1006, 3, 2, 2, 2, 72, 1017, 3, 2, 2, 2, 74, - 1035, 3, 2, 2, 2, 76, 1075, 3, 2, 2, 2, 78, 1153, 3, 2, 2, 2, 80, 1245, - 3, 2, 2, 2, 82, 1293, 3, 2, 2, 2, 84, 1303, 3, 2, 2, 2, 86, 1313, 3, 2, - 2, 2, 88, 1353, 3, 2, 2, 2, 90, 1368, 3, 2, 2, 2, 92, 1378, 3, 2, 2, 2, - 94, 1389, 3, 2, 2, 2, 96, 1391, 3, 2, 2, 2, 98, 1422, 3, 2, 2, 2, 100, - 1490, 3, 2, 2, 2, 102, 1492, 3, 2, 2, 2, 104, 1515, 3, 2, 2, 2, 106, 1531, - 3, 2, 2, 2, 108, 1607, 3, 2, 2, 2, 110, 1614, 3, 2, 2, 2, 112, 1617, 3, - 2, 2, 2, 114, 1621, 3, 2, 2, 2, 116, 1623, 3, 2, 2, 2, 118, 1625, 3, 2, - 2, 2, 120, 1629, 3, 2, 2, 2, 122, 1631, 3, 2, 2, 2, 124, 1633, 3, 2, 2, - 2, 126, 1635, 3, 2, 2, 2, 128, 1637, 3, 2, 2, 2, 130, 1639, 3, 2, 2, 2, - 132, 1641, 3, 2, 2, 2, 134, 1643, 3, 2, 2, 2, 136, 1645, 3, 2, 2, 2, 138, - 1647, 3, 2, 2, 2, 140, 1649, 3, 2, 2, 2, 142, 1651, 3, 2, 2, 2, 144, 1653, - 3, 2, 2, 2, 146, 1655, 3, 2, 2, 2, 148, 1657, 3, 2, 2, 2, 150, 1659, 3, - 2, 2, 2, 152, 1661, 3, 2, 2, 2, 154, 1663, 3, 2, 2, 2, 156, 1665, 3, 2, - 2, 2, 158, 1667, 3, 2, 2, 2, 160, 1669, 3, 2, 2, 2, 162, 1677, 3, 2, 2, - 2, 164, 1679, 3, 2, 2, 2, 166, 1688, 3, 2, 2, 2, 168, 170, 5, 4, 3, 2, - 169, 168, 3, 2, 2, 2, 170, 173, 3, 2, 2, 2, 171, 169, 3, 2, 2, 2, 171, - 172, 3, 2, 2, 2, 172, 174, 3, 2, 2, 2, 173, 171, 3, 2, 2, 2, 174, 175, - 7, 2, 2, 3, 175, 3, 3, 2, 2, 2, 176, 178, 7, 3, 2, 2, 177, 176, 3, 2, 2, - 2, 178, 181, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, - 182, 3, 2, 2, 2, 181, 179, 3, 2, 2, 2, 182, 191, 5, 6, 4, 2, 183, 185, - 7, 3, 2, 2, 184, 183, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 184, 3, 2, - 2, 2, 186, 187, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 190, 5, 6, 4, 2, - 189, 184, 3, 2, 2, 2, 190, 193, 3, 2, 2, 2, 191, 189, 3, 2, 2, 2, 191, - 192, 3, 2, 2, 2, 192, 197, 3, 2, 2, 2, 193, 191, 3, 2, 2, 2, 194, 196, - 7, 3, 2, 2, 195, 194, 3, 2, 2, 2, 196, 199, 3, 2, 2, 2, 197, 195, 3, 2, - 2, 2, 197, 198, 3, 2, 2, 2, 198, 5, 3, 2, 2, 2, 199, 197, 3, 2, 2, 2, 200, - 203, 7, 73, 2, 2, 201, 202, 7, 116, 2, 2, 202, 204, 7, 113, 2, 2, 203, - 201, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 206, 3, 2, 2, 2, 205, 200, - 3, 2, 2, 2, 205, 206, 3, 2, 2, 2, 206, 237, 3, 2, 2, 2, 207, 238, 5, 8, - 5, 2, 208, 238, 5, 10, 6, 2, 209, 238, 5, 12, 7, 2, 210, 238, 5, 14, 8, - 2, 211, 238, 5, 16, 9, 2, 212, 238, 5, 18, 10, 2, 213, 238, 5, 20, 11, - 2, 214, 238, 5, 22, 12, 2, 215, 238, 5, 24, 13, 2, 216, 238, 5, 26, 14, - 2, 217, 238, 5, 28, 15, 2, 218, 238, 5, 30, 16, 2, 219, 238, 5, 32, 17, - 2, 220, 238, 5, 34, 18, 2, 221, 238, 5, 36, 19, 2, 222, 238, 5, 38, 20, - 2, 223, 238, 5, 40, 21, 2, 224, 238, 5, 42, 22, 2, 225, 238, 5, 44, 23, - 2, 226, 238, 5, 46, 24, 2, 227, 238, 5, 48, 25, 2, 228, 238, 5, 50, 26, - 2, 229, 238, 5, 52, 27, 2, 230, 238, 5, 54, 28, 2, 231, 238, 5, 56, 29, - 2, 232, 238, 5, 58, 30, 2, 233, 238, 5, 60, 31, 2, 234, 238, 5, 64, 33, - 2, 235, 238, 5, 66, 34, 2, 236, 238, 5, 68, 35, 2, 237, 207, 3, 2, 2, 2, - 237, 208, 3, 2, 2, 2, 237, 209, 3, 2, 2, 2, 237, 210, 3, 2, 2, 2, 237, - 211, 3, 2, 2, 2, 237, 212, 3, 2, 2, 2, 237, 213, 3, 2, 2, 2, 237, 214, - 3, 2, 2, 2, 237, 215, 3, 2, 2, 2, 237, 216, 3, 2, 2, 2, 237, 217, 3, 2, - 2, 2, 237, 218, 3, 2, 2, 2, 237, 219, 3, 2, 2, 2, 237, 220, 3, 2, 2, 2, - 237, 221, 3, 2, 2, 2, 237, 222, 3, 2, 2, 2, 237, 223, 3, 2, 2, 2, 237, - 224, 3, 2, 2, 2, 237, 225, 3, 2, 2, 2, 237, 226, 3, 2, 2, 2, 237, 227, - 3, 2, 2, 2, 237, 228, 3, 2, 2, 2, 237, 229, 3, 2, 2, 2, 237, 230, 3, 2, - 2, 2, 237, 231, 3, 2, 2, 2, 237, 232, 3, 2, 2, 2, 237, 233, 3, 2, 2, 2, - 237, 234, 3, 2, 2, 2, 237, 235, 3, 2, 2, 2, 237, 236, 3, 2, 2, 2, 238, - 7, 3, 2, 2, 2, 239, 240, 7, 32, 2, 2, 240, 244, 7, 132, 2, 2, 241, 242, - 5, 130, 66, 2, 242, 243, 7, 4, 2, 2, 243, 245, 3, 2, 2, 2, 244, 241, 3, - 2, 2, 2, 244, 245, 3, 2, 2, 2, 245, 246, 3, 2, 2, 2, 246, 263, 5, 136, - 69, 2, 247, 248, 7, 123, 2, 2, 248, 249, 7, 136, 2, 2, 249, 264, 5, 140, - 71, 2, 250, 252, 7, 123, 2, 2, 251, 253, 7, 48, 2, 2, 252, 251, 3, 2, 2, - 2, 252, 253, 3, 2, 2, 2, 253, 254, 3, 2, 2, 2, 254, 255, 5, 142, 72, 2, - 255, 256, 7, 136, 2, 2, 256, 257, 5, 144, 73, 2, 257, 264, 3, 2, 2, 2, - 258, 260, 7, 29, 2, 2, 259, 261, 7, 48, 2, 2, 260, 259, 3, 2, 2, 2, 260, - 261, 3, 2, 2, 2, 261, 262, 3, 2, 2, 2, 262, 264, 5, 70, 36, 2, 263, 247, - 3, 2, 2, 2, 263, 250, 3, 2, 2, 2, 263, 258, 3, 2, 2, 2, 264, 9, 3, 2, 2, - 2, 265, 272, 7, 33, 2, 2, 266, 273, 5, 130, 66, 2, 267, 273, 5, 138, 70, - 2, 268, 269, 5, 130, 66, 2, 269, 270, 7, 4, 2, 2, 270, 271, 5, 138, 70, - 2, 271, 273, 3, 2, 2, 2, 272, 266, 3, 2, 2, 2, 272, 267, 3, 2, 2, 2, 272, - 268, 3, 2, 2, 2, 272, 273, 3, 2, 2, 2, 273, 11, 3, 2, 2, 2, 274, 276, 7, - 37, 2, 2, 275, 277, 7, 57, 2, 2, 276, 275, 3, 2, 2, 2, 276, 277, 3, 2, - 2, 2, 277, 278, 3, 2, 2, 2, 278, 279, 5, 78, 40, 2, 279, 280, 7, 35, 2, - 2, 280, 281, 5, 130, 66, 2, 281, 13, 3, 2, 2, 2, 282, 284, 7, 40, 2, 2, - 283, 285, 9, 2, 2, 2, 284, 283, 3, 2, 2, 2, 284, 285, 3, 2, 2, 2, 285, - 290, 3, 2, 2, 2, 286, 288, 7, 137, 2, 2, 287, 289, 5, 164, 83, 2, 288, - 287, 3, 2, 2, 2, 288, 289, 3, 2, 2, 2, 289, 291, 3, 2, 2, 2, 290, 286, - 3, 2, 2, 2, 290, 291, 3, 2, 2, 2, 291, 15, 3, 2, 2, 2, 292, 297, 9, 3, - 2, 2, 293, 295, 7, 137, 2, 2, 294, 296, 5, 164, 83, 2, 295, 294, 3, 2, - 2, 2, 295, 296, 3, 2, 2, 2, 296, 298, 3, 2, 2, 2, 297, 293, 3, 2, 2, 2, - 297, 298, 3, 2, 2, 2, 298, 17, 3, 2, 2, 2, 299, 301, 5, 88, 45, 2, 300, - 299, 3, 2, 2, 2, 300, 301, 3, 2, 2, 2, 301, 302, 3, 2, 2, 2, 302, 312, - 5, 108, 55, 2, 303, 305, 7, 139, 2, 2, 304, 306, 7, 31, 2, 2, 305, 304, - 3, 2, 2, 2, 305, 306, 3, 2, 2, 2, 306, 310, 3, 2, 2, 2, 307, 310, 7, 92, - 2, 2, 308, 310, 7, 70, 2, 2, 309, 303, 3, 2, 2, 2, 309, 307, 3, 2, 2, 2, - 309, 308, 3, 2, 2, 2, 310, 311, 3, 2, 2, 2, 311, 313, 5, 108, 55, 2, 312, - 309, 3, 2, 2, 2, 313, 314, 3, 2, 2, 2, 314, 312, 3, 2, 2, 2, 314, 315, - 3, 2, 2, 2, 315, 326, 3, 2, 2, 2, 316, 317, 7, 111, 2, 2, 317, 318, 7, - 42, 2, 2, 318, 323, 5, 92, 47, 2, 319, 320, 7, 7, 2, 2, 320, 322, 5, 92, - 47, 2, 321, 319, 3, 2, 2, 2, 322, 325, 3, 2, 2, 2, 323, 321, 3, 2, 2, 2, - 323, 324, 3, 2, 2, 2, 324, 327, 3, 2, 2, 2, 325, 323, 3, 2, 2, 2, 326, - 316, 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 334, 3, 2, 2, 2, 328, 329, - 7, 100, 2, 2, 329, 332, 5, 78, 40, 2, 330, 331, 9, 4, 2, 2, 331, 333, 5, - 78, 40, 2, 332, 330, 3, 2, 2, 2, 332, 333, 3, 2, 2, 2, 333, 335, 3, 2, - 2, 2, 334, 328, 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 19, 3, 2, 2, 2, - 336, 338, 7, 52, 2, 2, 337, 339, 7, 140, 2, 2, 338, 337, 3, 2, 2, 2, 338, - 339, 3, 2, 2, 2, 339, 340, 3, 2, 2, 2, 340, 344, 7, 86, 2, 2, 341, 342, - 7, 82, 2, 2, 342, 343, 7, 104, 2, 2, 343, 345, 7, 72, 2, 2, 344, 341, 3, - 2, 2, 2, 344, 345, 3, 2, 2, 2, 345, 349, 3, 2, 2, 2, 346, 347, 5, 130, - 66, 2, 347, 348, 7, 4, 2, 2, 348, 350, 3, 2, 2, 2, 349, 346, 3, 2, 2, 2, - 349, 350, 3, 2, 2, 2, 350, 351, 3, 2, 2, 2, 351, 352, 5, 150, 76, 2, 352, - 353, 7, 109, 2, 2, 353, 354, 5, 136, 69, 2, 354, 355, 7, 5, 2, 2, 355, - 360, 5, 84, 43, 2, 356, 357, 7, 7, 2, 2, 357, 359, 5, 84, 43, 2, 358, 356, - 3, 2, 2, 2, 359, 362, 3, 2, 2, 2, 360, 358, 3, 2, 2, 2, 360, 361, 3, 2, - 2, 2, 361, 363, 3, 2, 2, 2, 362, 360, 3, 2, 2, 2, 363, 366, 7, 6, 2, 2, - 364, 365, 7, 148, 2, 2, 365, 367, 5, 78, 40, 2, 366, 364, 3, 2, 2, 2, 366, - 367, 3, 2, 2, 2, 367, 21, 3, 2, 2, 2, 368, 370, 7, 52, 2, 2, 369, 371, - 9, 5, 2, 2, 370, 369, 3, 2, 2, 2, 370, 371, 3, 2, 2, 2, 371, 372, 3, 2, - 2, 2, 372, 376, 7, 132, 2, 2, 373, 374, 7, 82, 2, 2, 374, 375, 7, 104, - 2, 2, 375, 377, 7, 72, 2, 2, 376, 373, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, - 377, 381, 3, 2, 2, 2, 378, 379, 5, 130, 66, 2, 379, 380, 7, 4, 2, 2, 380, - 382, 3, 2, 2, 2, 381, 378, 3, 2, 2, 2, 381, 382, 3, 2, 2, 2, 382, 383, - 3, 2, 2, 2, 383, 407, 5, 136, 69, 2, 384, 385, 7, 5, 2, 2, 385, 390, 5, - 70, 36, 2, 386, 387, 7, 7, 2, 2, 387, 389, 5, 70, 36, 2, 388, 386, 3, 2, - 2, 2, 389, 392, 3, 2, 2, 2, 390, 391, 3, 2, 2, 2, 390, 388, 3, 2, 2, 2, - 391, 397, 3, 2, 2, 2, 392, 390, 3, 2, 2, 2, 393, 394, 7, 7, 2, 2, 394, - 396, 5, 86, 44, 2, 395, 393, 3, 2, 2, 2, 396, 399, 3, 2, 2, 2, 397, 395, - 3, 2, 2, 2, 397, 398, 3, 2, 2, 2, 398, 400, 3, 2, 2, 2, 399, 397, 3, 2, - 2, 2, 400, 403, 7, 6, 2, 2, 401, 402, 7, 150, 2, 2, 402, 404, 7, 151, 2, - 2, 403, 401, 3, 2, 2, 2, 403, 404, 3, 2, 2, 2, 404, 408, 3, 2, 2, 2, 405, - 406, 7, 35, 2, 2, 406, 408, 5, 60, 31, 2, 407, 384, 3, 2, 2, 2, 407, 405, - 3, 2, 2, 2, 408, 23, 3, 2, 2, 2, 409, 411, 7, 52, 2, 2, 410, 412, 9, 5, - 2, 2, 411, 410, 3, 2, 2, 2, 411, 412, 3, 2, 2, 2, 412, 413, 3, 2, 2, 2, - 413, 417, 7, 138, 2, 2, 414, 415, 7, 82, 2, 2, 415, 416, 7, 104, 2, 2, - 416, 418, 7, 72, 2, 2, 417, 414, 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, - 422, 3, 2, 2, 2, 419, 420, 5, 130, 66, 2, 420, 421, 7, 4, 2, 2, 421, 423, - 3, 2, 2, 2, 422, 419, 3, 2, 2, 2, 422, 423, 3, 2, 2, 2, 423, 424, 3, 2, - 2, 2, 424, 429, 5, 152, 77, 2, 425, 430, 7, 39, 2, 2, 426, 430, 7, 30, - 2, 2, 427, 428, 7, 91, 2, 2, 428, 430, 7, 107, 2, 2, 429, 425, 3, 2, 2, - 2, 429, 426, 3, 2, 2, 2, 429, 427, 3, 2, 2, 2, 429, 430, 3, 2, 2, 2, 430, - 445, 3, 2, 2, 2, 431, 446, 7, 61, 2, 2, 432, 446, 7, 90, 2, 2, 433, 443, - 7, 141, 2, 2, 434, 435, 7, 107, 2, 2, 435, 440, 5, 142, 72, 2, 436, 437, - 7, 7, 2, 2, 437, 439, 5, 142, 72, 2, 438, 436, 3, 2, 2, 2, 439, 442, 3, - 2, 2, 2, 440, 438, 3, 2, 2, 2, 440, 441, 3, 2, 2, 2, 441, 444, 3, 2, 2, - 2, 442, 440, 3, 2, 2, 2, 443, 434, 3, 2, 2, 2, 443, 444, 3, 2, 2, 2, 444, - 446, 3, 2, 2, 2, 445, 431, 3, 2, 2, 2, 445, 432, 3, 2, 2, 2, 445, 433, - 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 451, 7, 109, 2, 2, 448, 449, 5, - 130, 66, 2, 449, 450, 7, 4, 2, 2, 450, 452, 3, 2, 2, 2, 451, 448, 3, 2, - 2, 2, 451, 452, 3, 2, 2, 2, 452, 453, 3, 2, 2, 2, 453, 457, 5, 136, 69, - 2, 454, 455, 7, 75, 2, 2, 455, 456, 7, 66, 2, 2, 456, 458, 7, 128, 2, 2, - 457, 454, 3, 2, 2, 2, 457, 458, 3, 2, 2, 2, 458, 461, 3, 2, 2, 2, 459, - 460, 7, 147, 2, 2, 460, 462, 5, 78, 40, 2, 461, 459, 3, 2, 2, 2, 461, 462, - 3, 2, 2, 2, 462, 463, 3, 2, 2, 2, 463, 472, 7, 40, 2, 2, 464, 469, 5, 64, - 33, 2, 465, 469, 5, 46, 24, 2, 466, 469, 5, 30, 16, 2, 467, 469, 5, 60, - 31, 2, 468, 464, 3, 2, 2, 2, 468, 465, 3, 2, 2, 2, 468, 466, 3, 2, 2, 2, - 468, 467, 3, 2, 2, 2, 469, 470, 3, 2, 2, 2, 470, 471, 7, 3, 2, 2, 471, - 473, 3, 2, 2, 2, 472, 468, 3, 2, 2, 2, 473, 474, 3, 2, 2, 2, 474, 472, - 3, 2, 2, 2, 474, 475, 3, 2, 2, 2, 475, 476, 3, 2, 2, 2, 476, 477, 7, 68, - 2, 2, 477, 25, 3, 2, 2, 2, 478, 480, 7, 52, 2, 2, 479, 481, 9, 5, 2, 2, - 480, 479, 3, 2, 2, 2, 480, 481, 3, 2, 2, 2, 481, 482, 3, 2, 2, 2, 482, - 486, 7, 145, 2, 2, 483, 484, 7, 82, 2, 2, 484, 485, 7, 104, 2, 2, 485, - 487, 7, 72, 2, 2, 486, 483, 3, 2, 2, 2, 486, 487, 3, 2, 2, 2, 487, 491, - 3, 2, 2, 2, 488, 489, 5, 130, 66, 2, 489, 490, 7, 4, 2, 2, 490, 492, 3, - 2, 2, 2, 491, 488, 3, 2, 2, 2, 491, 492, 3, 2, 2, 2, 492, 493, 3, 2, 2, - 2, 493, 494, 5, 154, 78, 2, 494, 495, 7, 35, 2, 2, 495, 496, 5, 60, 31, - 2, 496, 27, 3, 2, 2, 2, 497, 498, 7, 52, 2, 2, 498, 499, 7, 146, 2, 2, - 499, 503, 7, 132, 2, 2, 500, 501, 7, 82, 2, 2, 501, 502, 7, 104, 2, 2, - 502, 504, 7, 72, 2, 2, 503, 500, 3, 2, 2, 2, 503, 504, 3, 2, 2, 2, 504, - 508, 3, 2, 2, 2, 505, 506, 5, 130, 66, 2, 506, 507, 7, 4, 2, 2, 507, 509, - 3, 2, 2, 2, 508, 505, 3, 2, 2, 2, 508, 509, 3, 2, 2, 2, 509, 510, 3, 2, - 2, 2, 510, 511, 5, 136, 69, 2, 511, 512, 7, 142, 2, 2, 512, 524, 5, 156, - 79, 2, 513, 514, 7, 5, 2, 2, 514, 519, 5, 120, 61, 2, 515, 516, 7, 7, 2, - 2, 516, 518, 5, 120, 61, 2, 517, 515, 3, 2, 2, 2, 518, 521, 3, 2, 2, 2, - 519, 517, 3, 2, 2, 2, 519, 520, 3, 2, 2, 2, 520, 522, 3, 2, 2, 2, 521, - 519, 3, 2, 2, 2, 522, 523, 7, 6, 2, 2, 523, 525, 3, 2, 2, 2, 524, 513, - 3, 2, 2, 2, 524, 525, 3, 2, 2, 2, 525, 29, 3, 2, 2, 2, 526, 528, 5, 88, - 45, 2, 527, 526, 3, 2, 2, 2, 527, 528, 3, 2, 2, 2, 528, 529, 3, 2, 2, 2, - 529, 530, 7, 61, 2, 2, 530, 531, 7, 77, 2, 2, 531, 534, 5, 90, 46, 2, 532, - 533, 7, 148, 2, 2, 533, 535, 5, 78, 40, 2, 534, 532, 3, 2, 2, 2, 534, 535, - 3, 2, 2, 2, 535, 31, 3, 2, 2, 2, 536, 538, 5, 88, 45, 2, 537, 536, 3, 2, - 2, 2, 537, 538, 3, 2, 2, 2, 538, 539, 3, 2, 2, 2, 539, 540, 7, 61, 2, 2, - 540, 541, 7, 77, 2, 2, 541, 544, 5, 90, 46, 2, 542, 543, 7, 148, 2, 2, - 543, 545, 5, 78, 40, 2, 544, 542, 3, 2, 2, 2, 544, 545, 3, 2, 2, 2, 545, - 564, 3, 2, 2, 2, 546, 547, 7, 111, 2, 2, 547, 548, 7, 42, 2, 2, 548, 553, - 5, 92, 47, 2, 549, 550, 7, 7, 2, 2, 550, 552, 5, 92, 47, 2, 551, 549, 3, - 2, 2, 2, 552, 555, 3, 2, 2, 2, 553, 551, 3, 2, 2, 2, 553, 554, 3, 2, 2, - 2, 554, 557, 3, 2, 2, 2, 555, 553, 3, 2, 2, 2, 556, 546, 3, 2, 2, 2, 556, - 557, 3, 2, 2, 2, 557, 558, 3, 2, 2, 2, 558, 559, 7, 100, 2, 2, 559, 562, - 5, 78, 40, 2, 560, 561, 9, 4, 2, 2, 561, 563, 5, 78, 40, 2, 562, 560, 3, - 2, 2, 2, 562, 563, 3, 2, 2, 2, 563, 565, 3, 2, 2, 2, 564, 556, 3, 2, 2, - 2, 564, 565, 3, 2, 2, 2, 565, 33, 3, 2, 2, 2, 566, 568, 7, 63, 2, 2, 567, - 569, 7, 57, 2, 2, 568, 567, 3, 2, 2, 2, 568, 569, 3, 2, 2, 2, 569, 570, - 3, 2, 2, 2, 570, 571, 5, 130, 66, 2, 571, 35, 3, 2, 2, 2, 572, 573, 7, - 65, 2, 2, 573, 576, 7, 86, 2, 2, 574, 575, 7, 82, 2, 2, 575, 577, 7, 72, - 2, 2, 576, 574, 3, 2, 2, 2, 576, 577, 3, 2, 2, 2, 577, 581, 3, 2, 2, 2, - 578, 579, 5, 130, 66, 2, 579, 580, 7, 4, 2, 2, 580, 582, 3, 2, 2, 2, 581, - 578, 3, 2, 2, 2, 581, 582, 3, 2, 2, 2, 582, 583, 3, 2, 2, 2, 583, 584, - 5, 150, 76, 2, 584, 37, 3, 2, 2, 2, 585, 586, 7, 65, 2, 2, 586, 589, 7, - 132, 2, 2, 587, 588, 7, 82, 2, 2, 588, 590, 7, 72, 2, 2, 589, 587, 3, 2, - 2, 2, 589, 590, 3, 2, 2, 2, 590, 594, 3, 2, 2, 2, 591, 592, 5, 130, 66, - 2, 592, 593, 7, 4, 2, 2, 593, 595, 3, 2, 2, 2, 594, 591, 3, 2, 2, 2, 594, - 595, 3, 2, 2, 2, 595, 596, 3, 2, 2, 2, 596, 597, 5, 136, 69, 2, 597, 39, - 3, 2, 2, 2, 598, 599, 7, 65, 2, 2, 599, 602, 7, 138, 2, 2, 600, 601, 7, - 82, 2, 2, 601, 603, 7, 72, 2, 2, 602, 600, 3, 2, 2, 2, 602, 603, 3, 2, - 2, 2, 603, 607, 3, 2, 2, 2, 604, 605, 5, 130, 66, 2, 605, 606, 7, 4, 2, - 2, 606, 608, 3, 2, 2, 2, 607, 604, 3, 2, 2, 2, 607, 608, 3, 2, 2, 2, 608, - 609, 3, 2, 2, 2, 609, 610, 5, 152, 77, 2, 610, 41, 3, 2, 2, 2, 611, 612, - 7, 65, 2, 2, 612, 615, 7, 145, 2, 2, 613, 614, 7, 82, 2, 2, 614, 616, 7, - 72, 2, 2, 615, 613, 3, 2, 2, 2, 615, 616, 3, 2, 2, 2, 616, 620, 3, 2, 2, - 2, 617, 618, 5, 130, 66, 2, 618, 619, 7, 4, 2, 2, 619, 621, 3, 2, 2, 2, - 620, 617, 3, 2, 2, 2, 620, 621, 3, 2, 2, 2, 621, 622, 3, 2, 2, 2, 622, - 623, 5, 154, 78, 2, 623, 43, 3, 2, 2, 2, 624, 626, 5, 88, 45, 2, 625, 624, - 3, 2, 2, 2, 625, 626, 3, 2, 2, 2, 626, 627, 3, 2, 2, 2, 627, 633, 5, 108, - 55, 2, 628, 629, 5, 110, 56, 2, 629, 630, 5, 108, 55, 2, 630, 632, 3, 2, - 2, 2, 631, 628, 3, 2, 2, 2, 632, 635, 3, 2, 2, 2, 633, 631, 3, 2, 2, 2, - 633, 634, 3, 2, 2, 2, 634, 646, 3, 2, 2, 2, 635, 633, 3, 2, 2, 2, 636, - 637, 7, 111, 2, 2, 637, 638, 7, 42, 2, 2, 638, 643, 5, 92, 47, 2, 639, - 640, 7, 7, 2, 2, 640, 642, 5, 92, 47, 2, 641, 639, 3, 2, 2, 2, 642, 645, - 3, 2, 2, 2, 643, 641, 3, 2, 2, 2, 643, 644, 3, 2, 2, 2, 644, 647, 3, 2, - 2, 2, 645, 643, 3, 2, 2, 2, 646, 636, 3, 2, 2, 2, 646, 647, 3, 2, 2, 2, - 647, 654, 3, 2, 2, 2, 648, 649, 7, 100, 2, 2, 649, 652, 5, 78, 40, 2, 650, - 651, 9, 4, 2, 2, 651, 653, 5, 78, 40, 2, 652, 650, 3, 2, 2, 2, 652, 653, - 3, 2, 2, 2, 653, 655, 3, 2, 2, 2, 654, 648, 3, 2, 2, 2, 654, 655, 3, 2, - 2, 2, 655, 45, 3, 2, 2, 2, 656, 658, 5, 88, 45, 2, 657, 656, 3, 2, 2, 2, - 657, 658, 3, 2, 2, 2, 658, 676, 3, 2, 2, 2, 659, 677, 7, 90, 2, 2, 660, - 677, 7, 124, 2, 2, 661, 662, 7, 90, 2, 2, 662, 663, 7, 110, 2, 2, 663, - 677, 7, 124, 2, 2, 664, 665, 7, 90, 2, 2, 665, 666, 7, 110, 2, 2, 666, - 677, 7, 127, 2, 2, 667, 668, 7, 90, 2, 2, 668, 669, 7, 110, 2, 2, 669, - 677, 7, 27, 2, 2, 670, 671, 7, 90, 2, 2, 671, 672, 7, 110, 2, 2, 672, 677, - 7, 74, 2, 2, 673, 674, 7, 90, 2, 2, 674, 675, 7, 110, 2, 2, 675, 677, 7, - 83, 2, 2, 676, 659, 3, 2, 2, 2, 676, 660, 3, 2, 2, 2, 676, 661, 3, 2, 2, - 2, 676, 664, 3, 2, 2, 2, 676, 667, 3, 2, 2, 2, 676, 670, 3, 2, 2, 2, 676, - 673, 3, 2, 2, 2, 677, 678, 3, 2, 2, 2, 678, 682, 7, 93, 2, 2, 679, 680, - 5, 130, 66, 2, 680, 681, 7, 4, 2, 2, 681, 683, 3, 2, 2, 2, 682, 679, 3, - 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, 684, 3, 2, 2, 2, 684, 696, 5, 136, - 69, 2, 685, 686, 7, 5, 2, 2, 686, 691, 5, 142, 72, 2, 687, 688, 7, 7, 2, - 2, 688, 690, 5, 142, 72, 2, 689, 687, 3, 2, 2, 2, 690, 693, 3, 2, 2, 2, - 691, 689, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 694, 3, 2, 2, 2, 693, - 691, 3, 2, 2, 2, 694, 695, 7, 6, 2, 2, 695, 697, 3, 2, 2, 2, 696, 685, - 3, 2, 2, 2, 696, 697, 3, 2, 2, 2, 697, 729, 3, 2, 2, 2, 698, 699, 7, 144, - 2, 2, 699, 700, 7, 5, 2, 2, 700, 705, 5, 78, 40, 2, 701, 702, 7, 7, 2, - 2, 702, 704, 5, 78, 40, 2, 703, 701, 3, 2, 2, 2, 704, 707, 3, 2, 2, 2, - 705, 703, 3, 2, 2, 2, 705, 706, 3, 2, 2, 2, 706, 708, 3, 2, 2, 2, 707, - 705, 3, 2, 2, 2, 708, 723, 7, 6, 2, 2, 709, 710, 7, 7, 2, 2, 710, 711, - 7, 5, 2, 2, 711, 716, 5, 78, 40, 2, 712, 713, 7, 7, 2, 2, 713, 715, 5, - 78, 40, 2, 714, 712, 3, 2, 2, 2, 715, 718, 3, 2, 2, 2, 716, 714, 3, 2, - 2, 2, 716, 717, 3, 2, 2, 2, 717, 719, 3, 2, 2, 2, 718, 716, 3, 2, 2, 2, - 719, 720, 7, 6, 2, 2, 720, 722, 3, 2, 2, 2, 721, 709, 3, 2, 2, 2, 722, - 725, 3, 2, 2, 2, 723, 721, 3, 2, 2, 2, 723, 724, 3, 2, 2, 2, 724, 730, - 3, 2, 2, 2, 725, 723, 3, 2, 2, 2, 726, 730, 5, 60, 31, 2, 727, 728, 7, - 58, 2, 2, 728, 730, 7, 144, 2, 2, 729, 698, 3, 2, 2, 2, 729, 726, 3, 2, - 2, 2, 729, 727, 3, 2, 2, 2, 730, 47, 3, 2, 2, 2, 731, 735, 7, 114, 2, 2, - 732, 733, 5, 130, 66, 2, 733, 734, 7, 4, 2, 2, 734, 736, 3, 2, 2, 2, 735, - 732, 3, 2, 2, 2, 735, 736, 3, 2, 2, 2, 736, 737, 3, 2, 2, 2, 737, 744, - 5, 158, 80, 2, 738, 739, 7, 8, 2, 2, 739, 745, 5, 94, 48, 2, 740, 741, - 7, 5, 2, 2, 741, 742, 5, 94, 48, 2, 742, 743, 7, 6, 2, 2, 743, 745, 3, - 2, 2, 2, 744, 738, 3, 2, 2, 2, 744, 740, 3, 2, 2, 2, 744, 745, 3, 2, 2, - 2, 745, 49, 3, 2, 2, 2, 746, 757, 7, 121, 2, 2, 747, 758, 5, 146, 74, 2, - 748, 749, 5, 130, 66, 2, 749, 750, 7, 4, 2, 2, 750, 752, 3, 2, 2, 2, 751, - 748, 3, 2, 2, 2, 751, 752, 3, 2, 2, 2, 752, 755, 3, 2, 2, 2, 753, 756, - 5, 136, 69, 2, 754, 756, 5, 150, 76, 2, 755, 753, 3, 2, 2, 2, 755, 754, - 3, 2, 2, 2, 756, 758, 3, 2, 2, 2, 757, 747, 3, 2, 2, 2, 757, 751, 3, 2, - 2, 2, 757, 758, 3, 2, 2, 2, 758, 51, 3, 2, 2, 2, 759, 761, 7, 122, 2, 2, - 760, 762, 7, 129, 2, 2, 761, 760, 3, 2, 2, 2, 761, 762, 3, 2, 2, 2, 762, - 763, 3, 2, 2, 2, 763, 764, 5, 160, 81, 2, 764, 53, 3, 2, 2, 2, 765, 770, - 7, 127, 2, 2, 766, 768, 7, 137, 2, 2, 767, 769, 5, 164, 83, 2, 768, 767, - 3, 2, 2, 2, 768, 769, 3, 2, 2, 2, 769, 771, 3, 2, 2, 2, 770, 766, 3, 2, - 2, 2, 770, 771, 3, 2, 2, 2, 771, 777, 3, 2, 2, 2, 772, 774, 7, 136, 2, - 2, 773, 775, 7, 129, 2, 2, 774, 773, 3, 2, 2, 2, 774, 775, 3, 2, 2, 2, - 775, 776, 3, 2, 2, 2, 776, 778, 5, 160, 81, 2, 777, 772, 3, 2, 2, 2, 777, - 778, 3, 2, 2, 2, 778, 55, 3, 2, 2, 2, 779, 780, 7, 129, 2, 2, 780, 781, - 5, 160, 81, 2, 781, 57, 3, 2, 2, 2, 782, 784, 5, 88, 45, 2, 783, 782, 3, - 2, 2, 2, 783, 784, 3, 2, 2, 2, 784, 785, 3, 2, 2, 2, 785, 796, 5, 108, - 55, 2, 786, 787, 7, 111, 2, 2, 787, 788, 7, 42, 2, 2, 788, 793, 5, 92, - 47, 2, 789, 790, 7, 7, 2, 2, 790, 792, 5, 92, 47, 2, 791, 789, 3, 2, 2, - 2, 792, 795, 3, 2, 2, 2, 793, 791, 3, 2, 2, 2, 793, 794, 3, 2, 2, 2, 794, - 797, 3, 2, 2, 2, 795, 793, 3, 2, 2, 2, 796, 786, 3, 2, 2, 2, 796, 797, - 3, 2, 2, 2, 797, 804, 3, 2, 2, 2, 798, 799, 7, 100, 2, 2, 799, 802, 5, - 78, 40, 2, 800, 801, 9, 4, 2, 2, 801, 803, 5, 78, 40, 2, 802, 800, 3, 2, - 2, 2, 802, 803, 3, 2, 2, 2, 803, 805, 3, 2, 2, 2, 804, 798, 3, 2, 2, 2, - 804, 805, 3, 2, 2, 2, 805, 59, 3, 2, 2, 2, 806, 808, 5, 88, 45, 2, 807, - 806, 3, 2, 2, 2, 807, 808, 3, 2, 2, 2, 808, 809, 3, 2, 2, 2, 809, 815, - 5, 62, 32, 2, 810, 811, 5, 110, 56, 2, 811, 812, 5, 62, 32, 2, 812, 814, - 3, 2, 2, 2, 813, 810, 3, 2, 2, 2, 814, 817, 3, 2, 2, 2, 815, 813, 3, 2, - 2, 2, 815, 816, 3, 2, 2, 2, 816, 828, 3, 2, 2, 2, 817, 815, 3, 2, 2, 2, - 818, 819, 7, 111, 2, 2, 819, 820, 7, 42, 2, 2, 820, 825, 5, 92, 47, 2, - 821, 822, 7, 7, 2, 2, 822, 824, 5, 92, 47, 2, 823, 821, 3, 2, 2, 2, 824, - 827, 3, 2, 2, 2, 825, 823, 3, 2, 2, 2, 825, 826, 3, 2, 2, 2, 826, 829, - 3, 2, 2, 2, 827, 825, 3, 2, 2, 2, 828, 818, 3, 2, 2, 2, 828, 829, 3, 2, - 2, 2, 829, 836, 3, 2, 2, 2, 830, 831, 7, 100, 2, 2, 831, 834, 5, 78, 40, - 2, 832, 833, 9, 4, 2, 2, 833, 835, 5, 78, 40, 2, 834, 832, 3, 2, 2, 2, - 834, 835, 3, 2, 2, 2, 835, 837, 3, 2, 2, 2, 836, 830, 3, 2, 2, 2, 836, - 837, 3, 2, 2, 2, 837, 61, 3, 2, 2, 2, 838, 840, 7, 130, 2, 2, 839, 841, - 9, 6, 2, 2, 840, 839, 3, 2, 2, 2, 840, 841, 3, 2, 2, 2, 841, 842, 3, 2, - 2, 2, 842, 847, 5, 98, 50, 2, 843, 844, 7, 7, 2, 2, 844, 846, 5, 98, 50, - 2, 845, 843, 3, 2, 2, 2, 846, 849, 3, 2, 2, 2, 847, 845, 3, 2, 2, 2, 847, - 848, 3, 2, 2, 2, 848, 862, 3, 2, 2, 2, 849, 847, 3, 2, 2, 2, 850, 860, - 7, 77, 2, 2, 851, 856, 5, 100, 51, 2, 852, 853, 7, 7, 2, 2, 853, 855, 5, - 100, 51, 2, 854, 852, 3, 2, 2, 2, 855, 858, 3, 2, 2, 2, 856, 854, 3, 2, - 2, 2, 856, 857, 3, 2, 2, 2, 857, 861, 3, 2, 2, 2, 858, 856, 3, 2, 2, 2, - 859, 861, 5, 102, 52, 2, 860, 851, 3, 2, 2, 2, 860, 859, 3, 2, 2, 2, 861, - 863, 3, 2, 2, 2, 862, 850, 3, 2, 2, 2, 862, 863, 3, 2, 2, 2, 863, 866, - 3, 2, 2, 2, 864, 865, 7, 148, 2, 2, 865, 867, 5, 78, 40, 2, 866, 864, 3, - 2, 2, 2, 866, 867, 3, 2, 2, 2, 867, 882, 3, 2, 2, 2, 868, 869, 7, 80, 2, - 2, 869, 870, 7, 42, 2, 2, 870, 875, 5, 78, 40, 2, 871, 872, 7, 7, 2, 2, - 872, 874, 5, 78, 40, 2, 873, 871, 3, 2, 2, 2, 874, 877, 3, 2, 2, 2, 875, - 873, 3, 2, 2, 2, 875, 876, 3, 2, 2, 2, 876, 880, 3, 2, 2, 2, 877, 875, - 3, 2, 2, 2, 878, 879, 7, 81, 2, 2, 879, 881, 5, 78, 40, 2, 880, 878, 3, - 2, 2, 2, 880, 881, 3, 2, 2, 2, 881, 883, 3, 2, 2, 2, 882, 868, 3, 2, 2, - 2, 882, 883, 3, 2, 2, 2, 883, 913, 3, 2, 2, 2, 884, 885, 7, 144, 2, 2, - 885, 886, 7, 5, 2, 2, 886, 891, 5, 78, 40, 2, 887, 888, 7, 7, 2, 2, 888, - 890, 5, 78, 40, 2, 889, 887, 3, 2, 2, 2, 890, 893, 3, 2, 2, 2, 891, 889, - 3, 2, 2, 2, 891, 892, 3, 2, 2, 2, 892, 894, 3, 2, 2, 2, 893, 891, 3, 2, - 2, 2, 894, 909, 7, 6, 2, 2, 895, 896, 7, 7, 2, 2, 896, 897, 7, 5, 2, 2, - 897, 902, 5, 78, 40, 2, 898, 899, 7, 7, 2, 2, 899, 901, 5, 78, 40, 2, 900, - 898, 3, 2, 2, 2, 901, 904, 3, 2, 2, 2, 902, 900, 3, 2, 2, 2, 902, 903, - 3, 2, 2, 2, 903, 905, 3, 2, 2, 2, 904, 902, 3, 2, 2, 2, 905, 906, 7, 6, - 2, 2, 906, 908, 3, 2, 2, 2, 907, 895, 3, 2, 2, 2, 908, 911, 3, 2, 2, 2, - 909, 907, 3, 2, 2, 2, 909, 910, 3, 2, 2, 2, 910, 913, 3, 2, 2, 2, 911, - 909, 3, 2, 2, 2, 912, 838, 3, 2, 2, 2, 912, 884, 3, 2, 2, 2, 913, 63, 3, - 2, 2, 2, 914, 916, 5, 88, 45, 2, 915, 914, 3, 2, 2, 2, 915, 916, 3, 2, - 2, 2, 916, 917, 3, 2, 2, 2, 917, 928, 7, 141, 2, 2, 918, 919, 7, 110, 2, - 2, 919, 929, 7, 127, 2, 2, 920, 921, 7, 110, 2, 2, 921, 929, 7, 27, 2, - 2, 922, 923, 7, 110, 2, 2, 923, 929, 7, 124, 2, 2, 924, 925, 7, 110, 2, - 2, 925, 929, 7, 74, 2, 2, 926, 927, 7, 110, 2, 2, 927, 929, 7, 83, 2, 2, - 928, 918, 3, 2, 2, 2, 928, 920, 3, 2, 2, 2, 928, 922, 3, 2, 2, 2, 928, - 924, 3, 2, 2, 2, 928, 926, 3, 2, 2, 2, 928, 929, 3, 2, 2, 2, 929, 930, - 3, 2, 2, 2, 930, 931, 5, 90, 46, 2, 931, 932, 7, 131, 2, 2, 932, 933, 5, - 142, 72, 2, 933, 934, 7, 8, 2, 2, 934, 942, 5, 78, 40, 2, 935, 936, 7, - 7, 2, 2, 936, 937, 5, 142, 72, 2, 937, 938, 7, 8, 2, 2, 938, 939, 5, 78, - 40, 2, 939, 941, 3, 2, 2, 2, 940, 935, 3, 2, 2, 2, 941, 944, 3, 2, 2, 2, - 942, 940, 3, 2, 2, 2, 942, 943, 3, 2, 2, 2, 943, 947, 3, 2, 2, 2, 944, - 942, 3, 2, 2, 2, 945, 946, 7, 148, 2, 2, 946, 948, 5, 78, 40, 2, 947, 945, - 3, 2, 2, 2, 947, 948, 3, 2, 2, 2, 948, 65, 3, 2, 2, 2, 949, 951, 5, 88, - 45, 2, 950, 949, 3, 2, 2, 2, 950, 951, 3, 2, 2, 2, 951, 952, 3, 2, 2, 2, - 952, 963, 7, 141, 2, 2, 953, 954, 7, 110, 2, 2, 954, 964, 7, 127, 2, 2, - 955, 956, 7, 110, 2, 2, 956, 964, 7, 27, 2, 2, 957, 958, 7, 110, 2, 2, - 958, 964, 7, 124, 2, 2, 959, 960, 7, 110, 2, 2, 960, 964, 7, 74, 2, 2, - 961, 962, 7, 110, 2, 2, 962, 964, 7, 83, 2, 2, 963, 953, 3, 2, 2, 2, 963, - 955, 3, 2, 2, 2, 963, 957, 3, 2, 2, 2, 963, 959, 3, 2, 2, 2, 963, 961, - 3, 2, 2, 2, 963, 964, 3, 2, 2, 2, 964, 965, 3, 2, 2, 2, 965, 966, 5, 90, - 46, 2, 966, 967, 7, 131, 2, 2, 967, 968, 5, 142, 72, 2, 968, 969, 7, 8, - 2, 2, 969, 977, 5, 78, 40, 2, 970, 971, 7, 7, 2, 2, 971, 972, 5, 142, 72, - 2, 972, 973, 7, 8, 2, 2, 973, 974, 5, 78, 40, 2, 974, 976, 3, 2, 2, 2, - 975, 970, 3, 2, 2, 2, 976, 979, 3, 2, 2, 2, 977, 975, 3, 2, 2, 2, 977, - 978, 3, 2, 2, 2, 978, 982, 3, 2, 2, 2, 979, 977, 3, 2, 2, 2, 980, 981, - 7, 148, 2, 2, 981, 983, 5, 78, 40, 2, 982, 980, 3, 2, 2, 2, 982, 983, 3, - 2, 2, 2, 983, 1002, 3, 2, 2, 2, 984, 985, 7, 111, 2, 2, 985, 986, 7, 42, - 2, 2, 986, 991, 5, 92, 47, 2, 987, 988, 7, 7, 2, 2, 988, 990, 5, 92, 47, - 2, 989, 987, 3, 2, 2, 2, 990, 993, 3, 2, 2, 2, 991, 989, 3, 2, 2, 2, 991, - 992, 3, 2, 2, 2, 992, 995, 3, 2, 2, 2, 993, 991, 3, 2, 2, 2, 994, 984, - 3, 2, 2, 2, 994, 995, 3, 2, 2, 2, 995, 996, 3, 2, 2, 2, 996, 997, 7, 100, - 2, 2, 997, 1000, 5, 78, 40, 2, 998, 999, 9, 4, 2, 2, 999, 1001, 5, 78, - 40, 2, 1000, 998, 3, 2, 2, 2, 1000, 1001, 3, 2, 2, 2, 1001, 1003, 3, 2, - 2, 2, 1002, 994, 3, 2, 2, 2, 1002, 1003, 3, 2, 2, 2, 1003, 67, 3, 2, 2, - 2, 1004, 1005, 7, 143, 2, 2, 1005, 69, 3, 2, 2, 2, 1006, 1008, 5, 142, - 72, 2, 1007, 1009, 5, 72, 37, 2, 1008, 1007, 3, 2, 2, 2, 1008, 1009, 3, - 2, 2, 2, 1009, 1013, 3, 2, 2, 2, 1010, 1012, 5, 74, 38, 2, 1011, 1010, - 3, 2, 2, 2, 1012, 1015, 3, 2, 2, 2, 1013, 1011, 3, 2, 2, 2, 1013, 1014, - 3, 2, 2, 2, 1014, 71, 3, 2, 2, 2, 1015, 1013, 3, 2, 2, 2, 1016, 1018, 5, - 126, 64, 2, 1017, 1016, 3, 2, 2, 2, 1018, 1019, 3, 2, 2, 2, 1019, 1020, - 3, 2, 2, 2, 1019, 1017, 3, 2, 2, 2, 1020, 1031, 3, 2, 2, 2, 1021, 1022, - 7, 5, 2, 2, 1022, 1023, 5, 112, 57, 2, 1023, 1024, 7, 6, 2, 2, 1024, 1032, - 3, 2, 2, 2, 1025, 1026, 7, 5, 2, 2, 1026, 1027, 5, 112, 57, 2, 1027, 1028, - 7, 7, 2, 2, 1028, 1029, 5, 112, 57, 2, 1029, 1030, 7, 6, 2, 2, 1030, 1032, - 3, 2, 2, 2, 1031, 1021, 3, 2, 2, 2, 1031, 1025, 3, 2, 2, 2, 1031, 1032, - 3, 2, 2, 2, 1032, 73, 3, 2, 2, 2, 1033, 1034, 7, 51, 2, 2, 1034, 1036, - 5, 126, 64, 2, 1035, 1033, 3, 2, 2, 2, 1035, 1036, 3, 2, 2, 2, 1036, 1070, - 3, 2, 2, 2, 1037, 1038, 7, 115, 2, 2, 1038, 1040, 7, 97, 2, 2, 1039, 1041, - 9, 7, 2, 2, 1040, 1039, 3, 2, 2, 2, 1040, 1041, 3, 2, 2, 2, 1041, 1042, - 3, 2, 2, 2, 1042, 1044, 5, 76, 39, 2, 1043, 1045, 7, 38, 2, 2, 1044, 1043, - 3, 2, 2, 2, 1044, 1045, 3, 2, 2, 2, 1045, 1071, 3, 2, 2, 2, 1046, 1048, - 7, 104, 2, 2, 1047, 1046, 3, 2, 2, 2, 1047, 1048, 3, 2, 2, 2, 1048, 1049, - 3, 2, 2, 2, 1049, 1050, 7, 106, 2, 2, 1050, 1071, 5, 76, 39, 2, 1051, 1052, - 7, 140, 2, 2, 1052, 1071, 5, 76, 39, 2, 1053, 1054, 7, 46, 2, 2, 1054, - 1055, 7, 5, 2, 2, 1055, 1056, 5, 78, 40, 2, 1056, 1057, 7, 6, 2, 2, 1057, - 1071, 3, 2, 2, 2, 1058, 1065, 7, 58, 2, 2, 1059, 1066, 5, 112, 57, 2, 1060, - 1066, 5, 114, 58, 2, 1061, 1062, 7, 5, 2, 2, 1062, 1063, 5, 78, 40, 2, - 1063, 1064, 7, 6, 2, 2, 1064, 1066, 3, 2, 2, 2, 1065, 1059, 3, 2, 2, 2, - 1065, 1060, 3, 2, 2, 2, 1065, 1061, 3, 2, 2, 2, 1066, 1071, 3, 2, 2, 2, - 1067, 1068, 7, 47, 2, 2, 1068, 1071, 5, 146, 74, 2, 1069, 1071, 5, 80, - 41, 2, 1070, 1037, 3, 2, 2, 2, 1070, 1047, 3, 2, 2, 2, 1070, 1051, 3, 2, - 2, 2, 1070, 1053, 3, 2, 2, 2, 1070, 1058, 3, 2, 2, 2, 1070, 1067, 3, 2, - 2, 2, 1070, 1069, 3, 2, 2, 2, 1071, 75, 3, 2, 2, 2, 1072, 1073, 7, 109, - 2, 2, 1073, 1074, 7, 50, 2, 2, 1074, 1076, 9, 8, 2, 2, 1075, 1072, 3, 2, - 2, 2, 1075, 1076, 3, 2, 2, 2, 1076, 77, 3, 2, 2, 2, 1077, 1078, 8, 40, - 1, 2, 1078, 1154, 5, 114, 58, 2, 1079, 1154, 7, 153, 2, 2, 1080, 1081, - 5, 130, 66, 2, 1081, 1082, 7, 4, 2, 2, 1082, 1084, 3, 2, 2, 2, 1083, 1080, - 3, 2, 2, 2, 1083, 1084, 3, 2, 2, 2, 1084, 1085, 3, 2, 2, 2, 1085, 1086, - 5, 136, 69, 2, 1086, 1087, 7, 4, 2, 2, 1087, 1089, 3, 2, 2, 2, 1088, 1083, - 3, 2, 2, 2, 1088, 1089, 3, 2, 2, 2, 1089, 1090, 3, 2, 2, 2, 1090, 1154, - 5, 142, 72, 2, 1091, 1092, 5, 116, 59, 2, 1092, 1093, 5, 78, 40, 23, 1093, - 1154, 3, 2, 2, 2, 1094, 1095, 5, 128, 65, 2, 1095, 1108, 7, 5, 2, 2, 1096, - 1098, 7, 64, 2, 2, 1097, 1096, 3, 2, 2, 2, 1097, 1098, 3, 2, 2, 2, 1098, - 1099, 3, 2, 2, 2, 1099, 1104, 5, 78, 40, 2, 1100, 1101, 7, 7, 2, 2, 1101, - 1103, 5, 78, 40, 2, 1102, 1100, 3, 2, 2, 2, 1103, 1106, 3, 2, 2, 2, 1104, - 1102, 3, 2, 2, 2, 1104, 1105, 3, 2, 2, 2, 1105, 1109, 3, 2, 2, 2, 1106, - 1104, 3, 2, 2, 2, 1107, 1109, 7, 9, 2, 2, 1108, 1097, 3, 2, 2, 2, 1108, - 1107, 3, 2, 2, 2, 1108, 1109, 3, 2, 2, 2, 1109, 1110, 3, 2, 2, 2, 1110, - 1111, 7, 6, 2, 2, 1111, 1154, 3, 2, 2, 2, 1112, 1113, 7, 5, 2, 2, 1113, - 1114, 5, 78, 40, 2, 1114, 1115, 7, 6, 2, 2, 1115, 1154, 3, 2, 2, 2, 1116, - 1117, 7, 45, 2, 2, 1117, 1118, 7, 5, 2, 2, 1118, 1119, 5, 78, 40, 2, 1119, - 1120, 7, 35, 2, 2, 1120, 1121, 5, 72, 37, 2, 1121, 1122, 7, 6, 2, 2, 1122, - 1154, 3, 2, 2, 2, 1123, 1125, 7, 104, 2, 2, 1124, 1123, 3, 2, 2, 2, 1124, - 1125, 3, 2, 2, 2, 1125, 1126, 3, 2, 2, 2, 1126, 1128, 7, 72, 2, 2, 1127, - 1124, 3, 2, 2, 2, 1127, 1128, 3, 2, 2, 2, 1128, 1129, 3, 2, 2, 2, 1129, - 1130, 7, 5, 2, 2, 1130, 1131, 5, 60, 31, 2, 1131, 1132, 7, 6, 2, 2, 1132, - 1154, 3, 2, 2, 2, 1133, 1135, 7, 44, 2, 2, 1134, 1136, 5, 78, 40, 2, 1135, - 1134, 3, 2, 2, 2, 1135, 1136, 3, 2, 2, 2, 1136, 1142, 3, 2, 2, 2, 1137, - 1138, 7, 147, 2, 2, 1138, 1139, 5, 78, 40, 2, 1139, 1140, 7, 135, 2, 2, - 1140, 1141, 5, 78, 40, 2, 1141, 1143, 3, 2, 2, 2, 1142, 1137, 3, 2, 2, - 2, 1143, 1144, 3, 2, 2, 2, 1144, 1142, 3, 2, 2, 2, 1144, 1145, 3, 2, 2, - 2, 1145, 1148, 3, 2, 2, 2, 1146, 1147, 7, 67, 2, 2, 1147, 1149, 5, 78, - 40, 2, 1148, 1146, 3, 2, 2, 2, 1148, 1149, 3, 2, 2, 2, 1149, 1150, 3, 2, - 2, 2, 1150, 1151, 7, 68, 2, 2, 1151, 1154, 3, 2, 2, 2, 1152, 1154, 5, 82, - 42, 2, 1153, 1077, 3, 2, 2, 2, 1153, 1079, 3, 2, 2, 2, 1153, 1088, 3, 2, - 2, 2, 1153, 1091, 3, 2, 2, 2, 1153, 1094, 3, 2, 2, 2, 1153, 1112, 3, 2, - 2, 2, 1153, 1116, 3, 2, 2, 2, 1153, 1127, 3, 2, 2, 2, 1153, 1133, 3, 2, - 2, 2, 1153, 1152, 3, 2, 2, 2, 1154, 1242, 3, 2, 2, 2, 1155, 1156, 12, 22, - 2, 2, 1156, 1157, 7, 13, 2, 2, 1157, 1241, 5, 78, 40, 23, 1158, 1159, 12, - 21, 2, 2, 1159, 1160, 9, 9, 2, 2, 1160, 1241, 5, 78, 40, 22, 1161, 1162, - 12, 20, 2, 2, 1162, 1163, 9, 10, 2, 2, 1163, 1241, 5, 78, 40, 21, 1164, - 1165, 12, 19, 2, 2, 1165, 1166, 9, 11, 2, 2, 1166, 1241, 5, 78, 40, 20, - 1167, 1168, 12, 18, 2, 2, 1168, 1169, 9, 12, 2, 2, 1169, 1241, 5, 78, 40, - 19, 1170, 1171, 12, 17, 2, 2, 1171, 1172, 9, 13, 2, 2, 1172, 1241, 5, 78, - 40, 18, 1173, 1174, 12, 15, 2, 2, 1174, 1175, 7, 34, 2, 2, 1175, 1241, - 5, 78, 40, 16, 1176, 1177, 12, 14, 2, 2, 1177, 1178, 7, 110, 2, 2, 1178, - 1241, 5, 78, 40, 15, 1179, 1180, 12, 7, 2, 2, 1180, 1182, 7, 94, 2, 2, - 1181, 1183, 7, 104, 2, 2, 1182, 1181, 3, 2, 2, 2, 1182, 1183, 3, 2, 2, - 2, 1183, 1184, 3, 2, 2, 2, 1184, 1241, 5, 78, 40, 8, 1185, 1187, 12, 6, - 2, 2, 1186, 1188, 7, 104, 2, 2, 1187, 1186, 3, 2, 2, 2, 1187, 1188, 3, - 2, 2, 2, 1188, 1189, 3, 2, 2, 2, 1189, 1190, 7, 41, 2, 2, 1190, 1191, 5, - 78, 40, 2, 1191, 1192, 7, 34, 2, 2, 1192, 1193, 5, 78, 40, 7, 1193, 1241, - 3, 2, 2, 2, 1194, 1196, 12, 16, 2, 2, 1195, 1197, 7, 104, 2, 2, 1196, 1195, - 3, 2, 2, 2, 1196, 1197, 3, 2, 2, 2, 1197, 1198, 3, 2, 2, 2, 1198, 1218, - 7, 85, 2, 2, 1199, 1209, 7, 5, 2, 2, 1200, 1210, 5, 60, 31, 2, 1201, 1206, - 5, 78, 40, 2, 1202, 1203, 7, 7, 2, 2, 1203, 1205, 5, 78, 40, 2, 1204, 1202, - 3, 2, 2, 2, 1205, 1208, 3, 2, 2, 2, 1206, 1204, 3, 2, 2, 2, 1206, 1207, - 3, 2, 2, 2, 1207, 1210, 3, 2, 2, 2, 1208, 1206, 3, 2, 2, 2, 1209, 1200, - 3, 2, 2, 2, 1209, 1201, 3, 2, 2, 2, 1209, 1210, 3, 2, 2, 2, 1210, 1211, - 3, 2, 2, 2, 1211, 1219, 7, 6, 2, 2, 1212, 1213, 5, 130, 66, 2, 1213, 1214, - 7, 4, 2, 2, 1214, 1216, 3, 2, 2, 2, 1215, 1212, 3, 2, 2, 2, 1215, 1216, - 3, 2, 2, 2, 1216, 1217, 3, 2, 2, 2, 1217, 1219, 5, 136, 69, 2, 1218, 1199, - 3, 2, 2, 2, 1218, 1215, 3, 2, 2, 2, 1219, 1241, 3, 2, 2, 2, 1220, 1221, - 12, 10, 2, 2, 1221, 1222, 7, 47, 2, 2, 1222, 1241, 5, 146, 74, 2, 1223, - 1225, 12, 9, 2, 2, 1224, 1226, 7, 104, 2, 2, 1225, 1224, 3, 2, 2, 2, 1225, - 1226, 3, 2, 2, 2, 1226, 1227, 3, 2, 2, 2, 1227, 1228, 9, 14, 2, 2, 1228, - 1231, 5, 78, 40, 2, 1229, 1230, 7, 69, 2, 2, 1230, 1232, 5, 78, 40, 2, - 1231, 1229, 3, 2, 2, 2, 1231, 1232, 3, 2, 2, 2, 1232, 1241, 3, 2, 2, 2, - 1233, 1238, 12, 8, 2, 2, 1234, 1239, 7, 95, 2, 2, 1235, 1239, 7, 105, 2, - 2, 1236, 1237, 7, 104, 2, 2, 1237, 1239, 7, 106, 2, 2, 1238, 1234, 3, 2, - 2, 2, 1238, 1235, 3, 2, 2, 2, 1238, 1236, 3, 2, 2, 2, 1239, 1241, 3, 2, - 2, 2, 1240, 1155, 3, 2, 2, 2, 1240, 1158, 3, 2, 2, 2, 1240, 1161, 3, 2, - 2, 2, 1240, 1164, 3, 2, 2, 2, 1240, 1167, 3, 2, 2, 2, 1240, 1170, 3, 2, - 2, 2, 1240, 1173, 3, 2, 2, 2, 1240, 1176, 3, 2, 2, 2, 1240, 1179, 3, 2, - 2, 2, 1240, 1185, 3, 2, 2, 2, 1240, 1194, 3, 2, 2, 2, 1240, 1220, 3, 2, - 2, 2, 1240, 1223, 3, 2, 2, 2, 1240, 1233, 3, 2, 2, 2, 1241, 1244, 3, 2, - 2, 2, 1242, 1240, 3, 2, 2, 2, 1242, 1243, 3, 2, 2, 2, 1243, 79, 3, 2, 2, - 2, 1244, 1242, 3, 2, 2, 2, 1245, 1246, 7, 119, 2, 2, 1246, 1258, 5, 148, - 75, 2, 1247, 1248, 7, 5, 2, 2, 1248, 1253, 5, 142, 72, 2, 1249, 1250, 7, - 7, 2, 2, 1250, 1252, 5, 142, 72, 2, 1251, 1249, 3, 2, 2, 2, 1252, 1255, - 3, 2, 2, 2, 1253, 1251, 3, 2, 2, 2, 1253, 1254, 3, 2, 2, 2, 1254, 1256, - 3, 2, 2, 2, 1255, 1253, 3, 2, 2, 2, 1256, 1257, 7, 6, 2, 2, 1257, 1259, - 3, 2, 2, 2, 1258, 1247, 3, 2, 2, 2, 1258, 1259, 3, 2, 2, 2, 1259, 1278, - 3, 2, 2, 2, 1260, 1261, 7, 109, 2, 2, 1261, 1270, 9, 15, 2, 2, 1262, 1263, - 7, 131, 2, 2, 1263, 1271, 7, 106, 2, 2, 1264, 1265, 7, 131, 2, 2, 1265, - 1271, 7, 58, 2, 2, 1266, 1271, 7, 43, 2, 2, 1267, 1271, 7, 125, 2, 2, 1268, - 1269, 7, 103, 2, 2, 1269, 1271, 7, 28, 2, 2, 1270, 1262, 3, 2, 2, 2, 1270, - 1264, 3, 2, 2, 2, 1270, 1266, 3, 2, 2, 2, 1270, 1267, 3, 2, 2, 2, 1270, - 1268, 3, 2, 2, 2, 1271, 1275, 3, 2, 2, 2, 1272, 1273, 7, 101, 2, 2, 1273, - 1275, 5, 126, 64, 2, 1274, 1260, 3, 2, 2, 2, 1274, 1272, 3, 2, 2, 2, 1275, - 1277, 3, 2, 2, 2, 1276, 1274, 3, 2, 2, 2, 1277, 1280, 3, 2, 2, 2, 1278, - 1276, 3, 2, 2, 2, 1278, 1279, 3, 2, 2, 2, 1279, 1291, 3, 2, 2, 2, 1280, - 1278, 3, 2, 2, 2, 1281, 1283, 7, 104, 2, 2, 1282, 1281, 3, 2, 2, 2, 1282, - 1283, 3, 2, 2, 2, 1283, 1284, 3, 2, 2, 2, 1284, 1289, 7, 59, 2, 2, 1285, - 1286, 7, 88, 2, 2, 1286, 1290, 7, 60, 2, 2, 1287, 1288, 7, 88, 2, 2, 1288, - 1290, 7, 84, 2, 2, 1289, 1285, 3, 2, 2, 2, 1289, 1287, 3, 2, 2, 2, 1289, - 1290, 3, 2, 2, 2, 1290, 1292, 3, 2, 2, 2, 1291, 1282, 3, 2, 2, 2, 1291, - 1292, 3, 2, 2, 2, 1292, 81, 3, 2, 2, 2, 1293, 1294, 7, 117, 2, 2, 1294, - 1299, 7, 5, 2, 2, 1295, 1300, 7, 83, 2, 2, 1296, 1297, 9, 16, 2, 2, 1297, - 1298, 7, 7, 2, 2, 1298, 1300, 5, 118, 60, 2, 1299, 1295, 3, 2, 2, 2, 1299, - 1296, 3, 2, 2, 2, 1300, 1301, 3, 2, 2, 2, 1301, 1302, 7, 6, 2, 2, 1302, - 83, 3, 2, 2, 2, 1303, 1306, 5, 142, 72, 2, 1304, 1305, 7, 47, 2, 2, 1305, - 1307, 5, 146, 74, 2, 1306, 1304, 3, 2, 2, 2, 1306, 1307, 3, 2, 2, 2, 1307, - 1309, 3, 2, 2, 2, 1308, 1310, 9, 7, 2, 2, 1309, 1308, 3, 2, 2, 2, 1309, - 1310, 3, 2, 2, 2, 1310, 85, 3, 2, 2, 2, 1311, 1312, 7, 51, 2, 2, 1312, - 1314, 5, 126, 64, 2, 1313, 1311, 3, 2, 2, 2, 1313, 1314, 3, 2, 2, 2, 1314, - 1351, 3, 2, 2, 2, 1315, 1316, 7, 115, 2, 2, 1316, 1319, 7, 97, 2, 2, 1317, - 1319, 7, 140, 2, 2, 1318, 1315, 3, 2, 2, 2, 1318, 1317, 3, 2, 2, 2, 1319, - 1320, 3, 2, 2, 2, 1320, 1321, 7, 5, 2, 2, 1321, 1326, 5, 84, 43, 2, 1322, - 1323, 7, 7, 2, 2, 1323, 1325, 5, 84, 43, 2, 1324, 1322, 3, 2, 2, 2, 1325, - 1328, 3, 2, 2, 2, 1326, 1324, 3, 2, 2, 2, 1326, 1327, 3, 2, 2, 2, 1327, - 1329, 3, 2, 2, 2, 1328, 1326, 3, 2, 2, 2, 1329, 1330, 7, 6, 2, 2, 1330, - 1331, 5, 76, 39, 2, 1331, 1352, 3, 2, 2, 2, 1332, 1333, 7, 46, 2, 2, 1333, - 1334, 7, 5, 2, 2, 1334, 1335, 5, 78, 40, 2, 1335, 1336, 7, 6, 2, 2, 1336, - 1352, 3, 2, 2, 2, 1337, 1338, 7, 76, 2, 2, 1338, 1339, 7, 97, 2, 2, 1339, - 1340, 7, 5, 2, 2, 1340, 1345, 5, 142, 72, 2, 1341, 1342, 7, 7, 2, 2, 1342, - 1344, 5, 142, 72, 2, 1343, 1341, 3, 2, 2, 2, 1344, 1347, 3, 2, 2, 2, 1345, - 1343, 3, 2, 2, 2, 1345, 1346, 3, 2, 2, 2, 1346, 1348, 3, 2, 2, 2, 1347, - 1345, 3, 2, 2, 2, 1348, 1349, 7, 6, 2, 2, 1349, 1350, 5, 80, 41, 2, 1350, - 1352, 3, 2, 2, 2, 1351, 1318, 3, 2, 2, 2, 1351, 1332, 3, 2, 2, 2, 1351, - 1337, 3, 2, 2, 2, 1352, 87, 3, 2, 2, 2, 1353, 1355, 7, 149, 2, 2, 1354, - 1356, 7, 118, 2, 2, 1355, 1354, 3, 2, 2, 2, 1355, 1356, 3, 2, 2, 2, 1356, - 1357, 3, 2, 2, 2, 1357, 1362, 5, 96, 49, 2, 1358, 1359, 7, 7, 2, 2, 1359, - 1361, 5, 96, 49, 2, 1360, 1358, 3, 2, 2, 2, 1361, 1364, 3, 2, 2, 2, 1362, - 1360, 3, 2, 2, 2, 1362, 1363, 3, 2, 2, 2, 1363, 89, 3, 2, 2, 2, 1364, 1362, - 3, 2, 2, 2, 1365, 1366, 5, 130, 66, 2, 1366, 1367, 7, 4, 2, 2, 1367, 1369, - 3, 2, 2, 2, 1368, 1365, 3, 2, 2, 2, 1368, 1369, 3, 2, 2, 2, 1369, 1370, - 3, 2, 2, 2, 1370, 1376, 5, 136, 69, 2, 1371, 1372, 7, 87, 2, 2, 1372, 1373, - 7, 42, 2, 2, 1373, 1377, 5, 150, 76, 2, 1374, 1375, 7, 104, 2, 2, 1375, - 1377, 7, 87, 2, 2, 1376, 1371, 3, 2, 2, 2, 1376, 1374, 3, 2, 2, 2, 1376, - 1377, 3, 2, 2, 2, 1377, 91, 3, 2, 2, 2, 1378, 1381, 5, 78, 40, 2, 1379, - 1380, 7, 47, 2, 2, 1380, 1382, 5, 146, 74, 2, 1381, 1379, 3, 2, 2, 2, 1381, - 1382, 3, 2, 2, 2, 1382, 1384, 3, 2, 2, 2, 1383, 1385, 9, 7, 2, 2, 1384, - 1383, 3, 2, 2, 2, 1384, 1385, 3, 2, 2, 2, 1385, 93, 3, 2, 2, 2, 1386, 1390, - 5, 112, 57, 2, 1387, 1390, 5, 126, 64, 2, 1388, 1390, 7, 154, 2, 2, 1389, - 1386, 3, 2, 2, 2, 1389, 1387, 3, 2, 2, 2, 1389, 1388, 3, 2, 2, 2, 1390, - 95, 3, 2, 2, 2, 1391, 1403, 5, 136, 69, 2, 1392, 1393, 7, 5, 2, 2, 1393, - 1398, 5, 142, 72, 2, 1394, 1395, 7, 7, 2, 2, 1395, 1397, 5, 142, 72, 2, - 1396, 1394, 3, 2, 2, 2, 1397, 1400, 3, 2, 2, 2, 1398, 1396, 3, 2, 2, 2, - 1398, 1399, 3, 2, 2, 2, 1399, 1401, 3, 2, 2, 2, 1400, 1398, 3, 2, 2, 2, - 1401, 1402, 7, 6, 2, 2, 1402, 1404, 3, 2, 2, 2, 1403, 1392, 3, 2, 2, 2, - 1403, 1404, 3, 2, 2, 2, 1404, 1405, 3, 2, 2, 2, 1405, 1406, 7, 35, 2, 2, - 1406, 1407, 7, 5, 2, 2, 1407, 1408, 5, 60, 31, 2, 1408, 1409, 7, 6, 2, - 2, 1409, 97, 3, 2, 2, 2, 1410, 1423, 7, 9, 2, 2, 1411, 1412, 5, 136, 69, - 2, 1412, 1413, 7, 4, 2, 2, 1413, 1414, 7, 9, 2, 2, 1414, 1423, 3, 2, 2, - 2, 1415, 1420, 5, 78, 40, 2, 1416, 1418, 7, 35, 2, 2, 1417, 1416, 3, 2, - 2, 2, 1417, 1418, 3, 2, 2, 2, 1418, 1419, 3, 2, 2, 2, 1419, 1421, 5, 122, - 62, 2, 1420, 1417, 3, 2, 2, 2, 1420, 1421, 3, 2, 2, 2, 1421, 1423, 3, 2, - 2, 2, 1422, 1410, 3, 2, 2, 2, 1422, 1411, 3, 2, 2, 2, 1422, 1415, 3, 2, - 2, 2, 1423, 99, 3, 2, 2, 2, 1424, 1425, 5, 132, 67, 2, 1425, 1426, 7, 4, - 2, 2, 1426, 1428, 3, 2, 2, 2, 1427, 1424, 3, 2, 2, 2, 1427, 1428, 3, 2, - 2, 2, 1428, 1429, 3, 2, 2, 2, 1429, 1434, 5, 136, 69, 2, 1430, 1432, 7, - 35, 2, 2, 1431, 1430, 3, 2, 2, 2, 1431, 1432, 3, 2, 2, 2, 1432, 1433, 3, - 2, 2, 2, 1433, 1435, 5, 162, 82, 2, 1434, 1431, 3, 2, 2, 2, 1434, 1435, - 3, 2, 2, 2, 1435, 1441, 3, 2, 2, 2, 1436, 1437, 7, 87, 2, 2, 1437, 1438, - 7, 42, 2, 2, 1438, 1442, 5, 150, 76, 2, 1439, 1440, 7, 104, 2, 2, 1440, - 1442, 7, 87, 2, 2, 1441, 1436, 3, 2, 2, 2, 1441, 1439, 3, 2, 2, 2, 1441, - 1442, 3, 2, 2, 2, 1442, 1491, 3, 2, 2, 2, 1443, 1444, 5, 132, 67, 2, 1444, - 1445, 7, 4, 2, 2, 1445, 1447, 3, 2, 2, 2, 1446, 1443, 3, 2, 2, 2, 1446, - 1447, 3, 2, 2, 2, 1447, 1448, 3, 2, 2, 2, 1448, 1449, 5, 134, 68, 2, 1449, - 1458, 7, 5, 2, 2, 1450, 1455, 5, 78, 40, 2, 1451, 1452, 7, 7, 2, 2, 1452, - 1454, 5, 78, 40, 2, 1453, 1451, 3, 2, 2, 2, 1454, 1457, 3, 2, 2, 2, 1455, - 1453, 3, 2, 2, 2, 1455, 1456, 3, 2, 2, 2, 1456, 1459, 3, 2, 2, 2, 1457, - 1455, 3, 2, 2, 2, 1458, 1450, 3, 2, 2, 2, 1458, 1459, 3, 2, 2, 2, 1459, - 1460, 3, 2, 2, 2, 1460, 1465, 7, 6, 2, 2, 1461, 1463, 7, 35, 2, 2, 1462, - 1461, 3, 2, 2, 2, 1462, 1463, 3, 2, 2, 2, 1463, 1464, 3, 2, 2, 2, 1464, - 1466, 5, 162, 82, 2, 1465, 1462, 3, 2, 2, 2, 1465, 1466, 3, 2, 2, 2, 1466, - 1491, 3, 2, 2, 2, 1467, 1477, 7, 5, 2, 2, 1468, 1473, 5, 100, 51, 2, 1469, - 1470, 7, 7, 2, 2, 1470, 1472, 5, 100, 51, 2, 1471, 1469, 3, 2, 2, 2, 1472, - 1475, 3, 2, 2, 2, 1473, 1471, 3, 2, 2, 2, 1473, 1474, 3, 2, 2, 2, 1474, - 1478, 3, 2, 2, 2, 1475, 1473, 3, 2, 2, 2, 1476, 1478, 5, 102, 52, 2, 1477, - 1468, 3, 2, 2, 2, 1477, 1476, 3, 2, 2, 2, 1478, 1479, 3, 2, 2, 2, 1479, - 1480, 7, 6, 2, 2, 1480, 1491, 3, 2, 2, 2, 1481, 1482, 7, 5, 2, 2, 1482, - 1483, 5, 60, 31, 2, 1483, 1488, 7, 6, 2, 2, 1484, 1486, 7, 35, 2, 2, 1485, - 1484, 3, 2, 2, 2, 1485, 1486, 3, 2, 2, 2, 1486, 1487, 3, 2, 2, 2, 1487, - 1489, 5, 162, 82, 2, 1488, 1485, 3, 2, 2, 2, 1488, 1489, 3, 2, 2, 2, 1489, - 1491, 3, 2, 2, 2, 1490, 1427, 3, 2, 2, 2, 1490, 1446, 3, 2, 2, 2, 1490, - 1467, 3, 2, 2, 2, 1490, 1481, 3, 2, 2, 2, 1491, 101, 3, 2, 2, 2, 1492, - 1499, 5, 100, 51, 2, 1493, 1494, 5, 104, 53, 2, 1494, 1495, 5, 100, 51, - 2, 1495, 1496, 5, 106, 54, 2, 1496, 1498, 3, 2, 2, 2, 1497, 1493, 3, 2, - 2, 2, 1498, 1501, 3, 2, 2, 2, 1499, 1497, 3, 2, 2, 2, 1499, 1500, 3, 2, - 2, 2, 1500, 103, 3, 2, 2, 2, 1501, 1499, 3, 2, 2, 2, 1502, 1516, 7, 7, - 2, 2, 1503, 1505, 7, 102, 2, 2, 1504, 1503, 3, 2, 2, 2, 1504, 1505, 3, - 2, 2, 2, 1505, 1512, 3, 2, 2, 2, 1506, 1508, 7, 98, 2, 2, 1507, 1509, 7, - 112, 2, 2, 1508, 1507, 3, 2, 2, 2, 1508, 1509, 3, 2, 2, 2, 1509, 1513, - 3, 2, 2, 2, 1510, 1513, 7, 89, 2, 2, 1511, 1513, 7, 53, 2, 2, 1512, 1506, - 3, 2, 2, 2, 1512, 1510, 3, 2, 2, 2, 1512, 1511, 3, 2, 2, 2, 1512, 1513, - 3, 2, 2, 2, 1513, 1514, 3, 2, 2, 2, 1514, 1516, 7, 96, 2, 2, 1515, 1502, - 3, 2, 2, 2, 1515, 1504, 3, 2, 2, 2, 1516, 105, 3, 2, 2, 2, 1517, 1518, - 7, 109, 2, 2, 1518, 1532, 5, 78, 40, 2, 1519, 1520, 7, 142, 2, 2, 1520, - 1521, 7, 5, 2, 2, 1521, 1526, 5, 142, 72, 2, 1522, 1523, 7, 7, 2, 2, 1523, - 1525, 5, 142, 72, 2, 1524, 1522, 3, 2, 2, 2, 1525, 1528, 3, 2, 2, 2, 1526, - 1524, 3, 2, 2, 2, 1526, 1527, 3, 2, 2, 2, 1527, 1529, 3, 2, 2, 2, 1528, - 1526, 3, 2, 2, 2, 1529, 1530, 7, 6, 2, 2, 1530, 1532, 3, 2, 2, 2, 1531, - 1517, 3, 2, 2, 2, 1531, 1519, 3, 2, 2, 2, 1531, 1532, 3, 2, 2, 2, 1532, - 107, 3, 2, 2, 2, 1533, 1535, 7, 130, 2, 2, 1534, 1536, 9, 6, 2, 2, 1535, - 1534, 3, 2, 2, 2, 1535, 1536, 3, 2, 2, 2, 1536, 1537, 3, 2, 2, 2, 1537, - 1542, 5, 98, 50, 2, 1538, 1539, 7, 7, 2, 2, 1539, 1541, 5, 98, 50, 2, 1540, - 1538, 3, 2, 2, 2, 1541, 1544, 3, 2, 2, 2, 1542, 1540, 3, 2, 2, 2, 1542, - 1543, 3, 2, 2, 2, 1543, 1557, 3, 2, 2, 2, 1544, 1542, 3, 2, 2, 2, 1545, - 1555, 7, 77, 2, 2, 1546, 1551, 5, 100, 51, 2, 1547, 1548, 7, 7, 2, 2, 1548, - 1550, 5, 100, 51, 2, 1549, 1547, 3, 2, 2, 2, 1550, 1553, 3, 2, 2, 2, 1551, - 1549, 3, 2, 2, 2, 1551, 1552, 3, 2, 2, 2, 1552, 1556, 3, 2, 2, 2, 1553, - 1551, 3, 2, 2, 2, 1554, 1556, 5, 102, 52, 2, 1555, 1546, 3, 2, 2, 2, 1555, - 1554, 3, 2, 2, 2, 1556, 1558, 3, 2, 2, 2, 1557, 1545, 3, 2, 2, 2, 1557, - 1558, 3, 2, 2, 2, 1558, 1561, 3, 2, 2, 2, 1559, 1560, 7, 148, 2, 2, 1560, - 1562, 5, 78, 40, 2, 1561, 1559, 3, 2, 2, 2, 1561, 1562, 3, 2, 2, 2, 1562, - 1577, 3, 2, 2, 2, 1563, 1564, 7, 80, 2, 2, 1564, 1565, 7, 42, 2, 2, 1565, - 1570, 5, 78, 40, 2, 1566, 1567, 7, 7, 2, 2, 1567, 1569, 5, 78, 40, 2, 1568, - 1566, 3, 2, 2, 2, 1569, 1572, 3, 2, 2, 2, 1570, 1568, 3, 2, 2, 2, 1570, - 1571, 3, 2, 2, 2, 1571, 1575, 3, 2, 2, 2, 1572, 1570, 3, 2, 2, 2, 1573, - 1574, 7, 81, 2, 2, 1574, 1576, 5, 78, 40, 2, 1575, 1573, 3, 2, 2, 2, 1575, - 1576, 3, 2, 2, 2, 1576, 1578, 3, 2, 2, 2, 1577, 1563, 3, 2, 2, 2, 1577, - 1578, 3, 2, 2, 2, 1578, 1608, 3, 2, 2, 2, 1579, 1580, 7, 144, 2, 2, 1580, - 1581, 7, 5, 2, 2, 1581, 1586, 5, 78, 40, 2, 1582, 1583, 7, 7, 2, 2, 1583, - 1585, 5, 78, 40, 2, 1584, 1582, 3, 2, 2, 2, 1585, 1588, 3, 2, 2, 2, 1586, - 1584, 3, 2, 2, 2, 1586, 1587, 3, 2, 2, 2, 1587, 1589, 3, 2, 2, 2, 1588, - 1586, 3, 2, 2, 2, 1589, 1604, 7, 6, 2, 2, 1590, 1591, 7, 7, 2, 2, 1591, - 1592, 7, 5, 2, 2, 1592, 1597, 5, 78, 40, 2, 1593, 1594, 7, 7, 2, 2, 1594, - 1596, 5, 78, 40, 2, 1595, 1593, 3, 2, 2, 2, 1596, 1599, 3, 2, 2, 2, 1597, - 1595, 3, 2, 2, 2, 1597, 1598, 3, 2, 2, 2, 1598, 1600, 3, 2, 2, 2, 1599, - 1597, 3, 2, 2, 2, 1600, 1601, 7, 6, 2, 2, 1601, 1603, 3, 2, 2, 2, 1602, - 1590, 3, 2, 2, 2, 1603, 1606, 3, 2, 2, 2, 1604, 1602, 3, 2, 2, 2, 1604, - 1605, 3, 2, 2, 2, 1605, 1608, 3, 2, 2, 2, 1606, 1604, 3, 2, 2, 2, 1607, - 1533, 3, 2, 2, 2, 1607, 1579, 3, 2, 2, 2, 1608, 109, 3, 2, 2, 2, 1609, - 1615, 7, 139, 2, 2, 1610, 1611, 7, 139, 2, 2, 1611, 1615, 7, 31, 2, 2, - 1612, 1615, 7, 92, 2, 2, 1613, 1615, 7, 70, 2, 2, 1614, 1609, 3, 2, 2, - 2, 1614, 1610, 3, 2, 2, 2, 1614, 1612, 3, 2, 2, 2, 1614, 1613, 3, 2, 2, - 2, 1615, 111, 3, 2, 2, 2, 1616, 1618, 9, 10, 2, 2, 1617, 1616, 3, 2, 2, - 2, 1617, 1618, 3, 2, 2, 2, 1618, 1619, 3, 2, 2, 2, 1619, 1620, 7, 152, - 2, 2, 1620, 113, 3, 2, 2, 2, 1621, 1622, 9, 17, 2, 2, 1622, 115, 3, 2, - 2, 2, 1623, 1624, 9, 18, 2, 2, 1624, 117, 3, 2, 2, 2, 1625, 1626, 7, 154, - 2, 2, 1626, 119, 3, 2, 2, 2, 1627, 1630, 5, 78, 40, 2, 1628, 1630, 5, 70, - 36, 2, 1629, 1627, 3, 2, 2, 2, 1629, 1628, 3, 2, 2, 2, 1630, 121, 3, 2, - 2, 2, 1631, 1632, 9, 19, 2, 2, 1632, 123, 3, 2, 2, 2, 1633, 1634, 9, 20, - 2, 2, 1634, 125, 3, 2, 2, 2, 1635, 1636, 5, 166, 84, 2, 1636, 127, 3, 2, - 2, 2, 1637, 1638, 5, 166, 84, 2, 1638, 129, 3, 2, 2, 2, 1639, 1640, 5, - 166, 84, 2, 1640, 131, 3, 2, 2, 2, 1641, 1642, 5, 166, 84, 2, 1642, 133, - 3, 2, 2, 2, 1643, 1644, 5, 166, 84, 2, 1644, 135, 3, 2, 2, 2, 1645, 1646, - 5, 166, 84, 2, 1646, 137, 3, 2, 2, 2, 1647, 1648, 5, 166, 84, 2, 1648, - 139, 3, 2, 2, 2, 1649, 1650, 5, 166, 84, 2, 1650, 141, 3, 2, 2, 2, 1651, - 1652, 5, 166, 84, 2, 1652, 143, 3, 2, 2, 2, 1653, 1654, 5, 166, 84, 2, - 1654, 145, 3, 2, 2, 2, 1655, 1656, 5, 166, 84, 2, 1656, 147, 3, 2, 2, 2, - 1657, 1658, 5, 166, 84, 2, 1658, 149, 3, 2, 2, 2, 1659, 1660, 5, 166, 84, - 2, 1660, 151, 3, 2, 2, 2, 1661, 1662, 5, 166, 84, 2, 1662, 153, 3, 2, 2, - 2, 1663, 1664, 5, 166, 84, 2, 1664, 155, 3, 2, 2, 2, 1665, 1666, 5, 166, - 84, 2, 1666, 157, 3, 2, 2, 2, 1667, 1668, 5, 166, 84, 2, 1668, 159, 3, - 2, 2, 2, 1669, 1670, 5, 166, 84, 2, 1670, 161, 3, 2, 2, 2, 1671, 1678, - 7, 151, 2, 2, 1672, 1678, 7, 154, 2, 2, 1673, 1674, 7, 5, 2, 2, 1674, 1675, - 5, 162, 82, 2, 1675, 1676, 7, 6, 2, 2, 1676, 1678, 3, 2, 2, 2, 1677, 1671, - 3, 2, 2, 2, 1677, 1672, 3, 2, 2, 2, 1677, 1673, 3, 2, 2, 2, 1678, 163, - 3, 2, 2, 2, 1679, 1680, 5, 166, 84, 2, 1680, 165, 3, 2, 2, 2, 1681, 1689, - 7, 151, 2, 2, 1682, 1689, 5, 124, 63, 2, 1683, 1689, 7, 154, 2, 2, 1684, - 1685, 7, 5, 2, 2, 1685, 1686, 5, 166, 84, 2, 1686, 1687, 7, 6, 2, 2, 1687, - 1689, 3, 2, 2, 2, 1688, 1681, 3, 2, 2, 2, 1688, 1682, 3, 2, 2, 2, 1688, - 1683, 3, 2, 2, 2, 1688, 1684, 3, 2, 2, 2, 1689, 167, 3, 2, 2, 2, 239, 171, - 179, 186, 191, 197, 203, 205, 237, 244, 252, 260, 263, 272, 276, 284, 288, - 290, 295, 297, 300, 305, 309, 314, 323, 326, 332, 334, 338, 344, 349, 360, - 366, 370, 376, 381, 390, 397, 403, 407, 411, 417, 422, 429, 440, 443, 445, - 451, 457, 461, 468, 474, 480, 486, 491, 503, 508, 519, 524, 527, 534, 537, - 544, 553, 556, 562, 564, 568, 576, 581, 589, 594, 602, 607, 615, 620, 625, - 633, 643, 646, 652, 654, 657, 676, 682, 691, 696, 705, 716, 723, 729, 735, - 744, 751, 755, 757, 761, 768, 770, 774, 777, 783, 793, 796, 802, 804, 807, - 815, 825, 828, 834, 836, 840, 847, 856, 860, 862, 866, 875, 880, 882, 891, - 902, 909, 912, 915, 928, 942, 947, 950, 963, 977, 982, 991, 994, 1000, - 1002, 1008, 1013, 1019, 1031, 1035, 1040, 1044, 1047, 1065, 1070, 1075, - 1083, 1088, 1097, 1104, 1108, 1124, 1127, 1135, 1144, 1148, 1153, 1182, - 1187, 1196, 1206, 1209, 1215, 1218, 1225, 1231, 1238, 1240, 1242, 1253, - 1258, 1270, 1274, 1278, 1282, 1289, 1291, 1299, 1306, 1309, 1313, 1318, - 1326, 1345, 1351, 1355, 1362, 1368, 1376, 1381, 1384, 1389, 1398, 1403, - 1417, 1420, 1422, 1427, 1431, 1434, 1441, 1446, 1455, 1458, 1462, 1465, - 1473, 1477, 1485, 1488, 1490, 1499, 1504, 1508, 1512, 1515, 1526, 1531, - 1535, 1542, 1551, 1555, 1557, 1561, 1570, 1575, 1577, 1586, 1597, 1604, - 1607, 1614, 1617, 1629, 1677, 1688, -} -var deserializer = antlr.NewATNDeserializer(nil) -var deserializedATN = deserializer.DeserializeFromUInt16(parserATN) - -var literalNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", -} -var 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", "K_ABORT", "K_ACTION", - "K_ADD", "K_AFTER", "K_ALL", "K_ALTER", "K_ANALYZE", "K_AND", "K_AS", "K_ASC", - "K_ATTACH", "K_AUTOINCREMENT", "K_BEFORE", "K_BEGIN", "K_BETWEEN", "K_BY", - "K_CASCADE", "K_CASE", "K_CAST", "K_CHECK", "K_COLLATE", "K_COLUMN", "K_COMMIT", - "K_CONFLICT", "K_CONSTRAINT", "K_CREATE", "K_CROSS", "K_CURRENT_DATE", - "K_CURRENT_TIME", "K_CURRENT_TIMESTAMP", "K_DATABASE", "K_DEFAULT", "K_DEFERRABLE", - "K_DEFERRED", "K_DELETE", "K_DESC", "K_DETACH", "K_DISTINCT", "K_DROP", - "K_EACH", "K_ELSE", "K_END", "K_ESCAPE", "K_EXCEPT", "K_EXCLUSIVE", "K_EXISTS", - "K_EXPLAIN", "K_FAIL", "K_FOR", "K_FOREIGN", "K_FROM", "K_FULL", "K_GLOB", - "K_GROUP", "K_HAVING", "K_IF", "K_IGNORE", "K_IMMEDIATE", "K_IN", "K_INDEX", - "K_INDEXED", "K_INITIALLY", "K_INNER", "K_INSERT", "K_INSTEAD", "K_INTERSECT", - "K_INTO", "K_IS", "K_ISNULL", "K_JOIN", "K_KEY", "K_LEFT", "K_LIKE", "K_LIMIT", - "K_MATCH", "K_NATURAL", "K_NO", "K_NOT", "K_NOTNULL", "K_NULL", "K_OF", - "K_OFFSET", "K_ON", "K_OR", "K_ORDER", "K_OUTER", "K_PLAN", "K_PRAGMA", - "K_PRIMARY", "K_QUERY", "K_RAISE", "K_RECURSIVE", "K_REFERENCES", "K_REGEXP", - "K_REINDEX", "K_RELEASE", "K_RENAME", "K_REPLACE", "K_RESTRICT", "K_RIGHT", - "K_ROLLBACK", "K_ROW", "K_SAVEPOINT", "K_SELECT", "K_SET", "K_TABLE", "K_TEMP", - "K_TEMPORARY", "K_THEN", "K_TO", "K_TRANSACTION", "K_TRIGGER", "K_UNION", - "K_UNIQUE", "K_UPDATE", "K_USING", "K_VACUUM", "K_VALUES", "K_VIEW", "K_VIRTUAL", - "K_WHEN", "K_WHERE", "K_WITH", "K_WITHOUT", "IDENTIFIER", "NUMERIC_LITERAL", - "BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", - "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", -} - -var ruleNames = []string{ - "parse", "sql_stmt_list", "sql_stmt", "alter_table_stmt", "analyze_stmt", - "attach_stmt", "begin_stmt", "commit_stmt", "compound_select_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_index_stmt", - "drop_table_stmt", "drop_trigger_stmt", "drop_view_stmt", "factored_select_stmt", - "insert_stmt", "pragma_stmt", "reindex_stmt", "release_stmt", "rollback_stmt", - "savepoint_stmt", "simple_select_stmt", "select_stmt", "select_or_values", - "update_stmt", "update_stmt_limited", "vacuum_stmt", "column_def", "type_name", - "column_constraint", "conflict_clause", "expr", "foreign_key_clause", "raise_function", - "indexed_column", "table_constraint", "with_clause", "qualified_table_name", - "ordering_term", "pragma_value", "common_table_expression", "result_column", - "table_or_subquery", "join_clause", "join_operator", "join_constraint", - "select_core", "compound_operator", "signed_number", "literal_value", "unary_operator", - "error_message", "module_argument", "column_alias", "keyword", "name", - "function_name", "database_name", "schema_name", "table_function_name", - "table_name", "table_or_index_name", "new_table_name", "column_name", "new_column_name", - "collation_name", "foreign_table", "index_name", "trigger_name", "view_name", - "module_name", "pragma_name", "savepoint_name", "table_alias", "transaction_name", - "any_name", -} -var decisionToDFA = make([]*antlr.DFA, len(deserializedATN.DecisionToState)) - -func init() { - for index, ds := range deserializedATN.DecisionToState { - decisionToDFA[index] = antlr.NewDFA(ds, index) - } -} +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", "PTR2", "PTR", "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, 197, 2176, 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, 1, 34, 1, 34, 1, 34, 3, 34, 1035, + 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1042, 8, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1053, 8, 34, + 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1062, 8, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1070, 8, 34, 10, 34, 12, + 34, 1073, 9, 34, 3, 34, 1075, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, + 1081, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1087, 8, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 5, 34, 1094, 8, 34, 10, 34, 12, 34, 1097, 9, 34, + 3, 34, 1099, 8, 34, 1, 34, 1, 34, 3, 34, 1103, 8, 34, 1, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, + 1116, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1123, 8, 34, 5, + 34, 1125, 8, 34, 10, 34, 12, 34, 1128, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, + 1, 35, 1, 35, 3, 35, 1136, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, + 37, 1143, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, + 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1156, 8, 37, 1, 37, 1, 37, 1, 37, 3, + 37, 1161, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1167, 8, 37, 10, 37, + 12, 37, 1170, 9, 37, 1, 37, 1, 37, 3, 37, 1174, 8, 37, 1, 37, 1, 37, 1, + 37, 1, 37, 1, 37, 5, 37, 1181, 8, 37, 10, 37, 12, 37, 1184, 9, 37, 1, 37, + 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1192, 8, 37, 10, 37, 12, 37, + 1195, 9, 37, 1, 37, 1, 37, 5, 37, 1199, 8, 37, 10, 37, 12, 37, 1202, 9, + 37, 1, 37, 1, 37, 1, 37, 3, 37, 1207, 8, 37, 1, 37, 3, 37, 1210, 8, 37, + 1, 37, 3, 37, 1213, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, + 38, 1221, 8, 38, 10, 38, 12, 38, 1224, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, + 1229, 8, 38, 3, 38, 1231, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, + 38, 3, 38, 1239, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1246, + 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1251, 8, 38, 10, 38, 12, 38, 1254, 9, + 38, 1, 38, 1, 38, 3, 38, 1258, 8, 38, 3, 38, 1260, 8, 38, 1, 39, 1, 39, + 1, 39, 1, 39, 3, 39, 1266, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, + 39, 1, 39, 3, 39, 1275, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1280, 8, 40, + 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 1, 41, 1, 41, 3, + 41, 1291, 8, 41, 3, 41, 1293, 8, 41, 1, 42, 3, 42, 1296, 8, 42, 1, 42, + 1, 42, 1, 42, 1, 42, 5, 42, 1302, 8, 42, 10, 42, 12, 42, 1305, 9, 42, 1, + 42, 3, 42, 1308, 8, 42, 1, 42, 3, 42, 1311, 8, 42, 1, 43, 1, 43, 1, 43, + 1, 43, 1, 43, 5, 43, 1318, 8, 43, 10, 43, 12, 43, 1321, 9, 43, 1, 44, 1, + 44, 3, 44, 1325, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1330, 8, 44, 10, 44, + 12, 44, 1333, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1339, 8, 44, 10, + 44, 12, 44, 1342, 9, 44, 1, 44, 3, 44, 1345, 8, 44, 3, 44, 1347, 8, 44, + 1, 44, 1, 44, 3, 44, 1351, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, + 44, 1358, 8, 44, 10, 44, 12, 44, 1361, 9, 44, 1, 44, 1, 44, 3, 44, 1365, + 8, 44, 3, 44, 1367, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, + 44, 1, 44, 1, 44, 5, 44, 1378, 8, 44, 10, 44, 12, 44, 1381, 9, 44, 3, 44, + 1383, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1390, 8, 44, 10, + 44, 12, 44, 1393, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, + 1401, 8, 44, 10, 44, 12, 44, 1404, 9, 44, 1, 44, 1, 44, 5, 44, 1408, 8, + 44, 10, 44, 12, 44, 1411, 9, 44, 3, 44, 1413, 8, 44, 1, 45, 1, 45, 1, 46, + 3, 46, 1418, 8, 46, 1, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 46, 3, 46, 1425, + 8, 46, 1, 47, 3, 47, 1428, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1433, 8, + 47, 1, 47, 1, 47, 3, 47, 1437, 8, 47, 1, 47, 4, 47, 1440, 8, 47, 11, 47, + 12, 47, 1441, 1, 47, 3, 47, 1445, 8, 47, 1, 47, 3, 47, 1448, 8, 47, 1, + 48, 1, 48, 1, 48, 3, 48, 1453, 8, 48, 1, 48, 1, 48, 3, 48, 1457, 8, 48, + 1, 48, 3, 48, 1460, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1467, + 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1472, 8, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 5, 48, 1479, 8, 48, 10, 48, 12, 48, 1482, 9, 48, 1, 48, 1, 48, + 3, 48, 1486, 8, 48, 1, 48, 3, 48, 1489, 8, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 5, 48, 1495, 8, 48, 10, 48, 12, 48, 1498, 9, 48, 1, 48, 3, 48, 1501, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1509, 8, 48, 1, + 48, 3, 48, 1512, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1517, 8, 48, 1, 48, + 1, 48, 3, 48, 1521, 8, 48, 1, 48, 3, 48, 1524, 8, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 3, 48, 1531, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1536, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1543, 8, 48, 10, 48, 12, + 48, 1546, 9, 48, 1, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 3, 48, 1553, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1559, 8, 48, 10, 48, 12, 48, + 1562, 9, 48, 1, 48, 3, 48, 1565, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 3, 48, 1573, 8, 48, 1, 48, 3, 48, 1576, 8, 48, 3, 48, 1578, + 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1587, 8, + 49, 1, 49, 3, 49, 1590, 8, 49, 3, 49, 1592, 8, 49, 1, 50, 1, 50, 3, 50, + 1596, 8, 50, 1, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 3, 50, 1603, 8, 50, + 1, 50, 1, 50, 1, 50, 3, 50, 1608, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, + 51, 1, 51, 1, 51, 5, 51, 1617, 8, 51, 10, 51, 12, 51, 1620, 9, 51, 1, 51, + 1, 51, 3, 51, 1624, 8, 51, 1, 52, 1, 52, 3, 52, 1628, 8, 52, 1, 52, 1, + 52, 3, 52, 1632, 8, 52, 1, 53, 3, 53, 1635, 8, 53, 1, 53, 1, 53, 1, 53, + 3, 53, 1640, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1646, 8, 53, 1, + 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1653, 8, 53, 1, 53, 1, 53, 1, 53, + 5, 53, 1658, 8, 53, 10, 53, 12, 53, 1661, 9, 53, 1, 53, 1, 53, 3, 53, 1665, + 8, 53, 1, 53, 3, 53, 1668, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1674, + 8, 54, 10, 54, 12, 54, 1677, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1682, 8, + 55, 1, 55, 1, 55, 1, 55, 3, 55, 1687, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, + 3, 55, 1693, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1700, 8, + 55, 1, 55, 1, 55, 1, 55, 5, 55, 1705, 8, 55, 10, 55, 12, 55, 1708, 9, 55, + 1, 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 55, 3, + 55, 1718, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1723, 8, 56, 1, 56, 1, 56, + 1, 56, 3, 56, 1728, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1735, + 8, 56, 1, 57, 1, 57, 3, 57, 1739, 8, 57, 1, 57, 1, 57, 3, 57, 1743, 8, + 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1753, + 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1760, 8, 59, 10, 59, 12, + 59, 1763, 9, 59, 3, 59, 1765, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, + 5, 59, 1772, 8, 59, 10, 59, 12, 59, 1775, 9, 59, 1, 59, 3, 59, 1778, 8, + 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1786, 8, 60, 1, 60, + 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1793, 8, 60, 10, 60, 12, 60, 1796, 9, + 60, 3, 60, 1798, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1805, + 8, 60, 10, 60, 12, 60, 1808, 9, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, + 8, 60, 1, 60, 3, 60, 1816, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, + 61, 1, 61, 1, 61, 3, 61, 1826, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, + 1, 62, 1, 62, 3, 62, 1835, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, + 63, 1842, 8, 63, 10, 63, 12, 63, 1845, 9, 63, 1, 63, 3, 63, 1848, 8, 63, + 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1855, 8, 64, 1, 64, 1, 64, 1, + 64, 5, 64, 1860, 8, 64, 10, 64, 12, 64, 1863, 9, 64, 1, 64, 3, 64, 1866, + 8, 64, 1, 64, 1, 64, 3, 64, 1870, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, + 65, 5, 65, 1877, 8, 65, 10, 65, 12, 65, 1880, 9, 65, 1, 65, 3, 65, 1883, + 8, 65, 1, 65, 1, 65, 3, 65, 1887, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1892, + 8, 65, 1, 66, 1, 66, 3, 66, 1896, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1901, + 8, 66, 10, 66, 12, 66, 1904, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, + 5, 67, 1911, 8, 67, 10, 67, 12, 67, 1914, 9, 67, 1, 68, 1, 68, 1, 68, 1, + 68, 3, 68, 1920, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1925, 8, 69, 1, 69, + 3, 69, 1928, 8, 69, 1, 69, 1, 69, 3, 69, 1932, 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, + 1946, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, + 72, 1, 72, 3, 72, 1958, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, + 1, 73, 3, 73, 1967, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, + 74, 3, 74, 1976, 8, 74, 1, 74, 1, 74, 3, 74, 1980, 8, 74, 1, 74, 1, 74, + 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, 3, + 74, 1993, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, + 2002, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2011, + 8, 74, 1, 74, 3, 74, 2014, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2020, + 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, 2034, 8, 74, 1, 74, 1, 74, 3, 74, 2038, 8, 74, + 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2049, + 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2054, 8, 74, 1, 75, 1, 75, 1, 75, 1, + 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2065, 8, 77, 11, 77, 12, + 77, 2066, 1, 78, 1, 78, 1, 78, 4, 78, 2072, 8, 78, 11, 78, 12, 78, 2073, + 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2082, 8, 80, 1, 80, 1, + 80, 1, 80, 3, 80, 2087, 8, 80, 5, 80, 2089, 8, 80, 10, 80, 12, 80, 2092, + 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, + 85, 3, 85, 2104, 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, 2117, 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, 2174, 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, 30, 3, 0, 60, 60, 71, 71, 84, 84, 2, 0, 49, 49, 68, 68, + 1, 0, 136, 137, 2, 0, 149, 149, 174, 174, 2, 0, 8, 8, 11, 11, 2, 0, 61, + 61, 144, 144, 2, 0, 58, 58, 106, 106, 2, 0, 60, 60, 84, 84, 5, 0, 27, 27, + 74, 74, 83, 83, 124, 124, 128, 128, 4, 0, 86, 86, 135, 135, 141, 141, 148, + 148, 1, 0, 9, 10, 2, 0, 7, 7, 14, 15, 1, 0, 16, 19, 1, 0, 20, 23, 4, 0, + 79, 79, 99, 99, 101, 101, 120, 120, 3, 0, 27, 27, 74, 74, 128, 128, 5, + 0, 54, 56, 106, 106, 175, 176, 189, 189, 192, 193, 2, 0, 31, 31, 64, 64, + 3, 0, 78, 78, 98, 98, 127, 127, 3, 0, 130, 130, 157, 157, 182, 182, 2, + 0, 5, 5, 108, 108, 1, 0, 179, 180, 2, 0, 36, 36, 62, 62, 2, 0, 154, 154, + 165, 165, 2, 0, 162, 162, 169, 169, 2, 0, 163, 163, 170, 171, 2, 0, 164, + 164, 166, 166, 3, 0, 8, 8, 11, 12, 104, 104, 2, 0, 188, 188, 192, 192, + 1, 0, 27, 183, 2482, 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, 1129, 1, 0, 0, 0, 72, 1139, 1, 0, 0, 0, 74, + 1142, 1, 0, 0, 0, 76, 1214, 1, 0, 0, 0, 78, 1261, 1, 0, 0, 0, 80, 1279, + 1, 0, 0, 0, 82, 1281, 1, 0, 0, 0, 84, 1295, 1, 0, 0, 0, 86, 1312, 1, 0, + 0, 0, 88, 1412, 1, 0, 0, 0, 90, 1414, 1, 0, 0, 0, 92, 1417, 1, 0, 0, 0, + 94, 1427, 1, 0, 0, 0, 96, 1577, 1, 0, 0, 0, 98, 1591, 1, 0, 0, 0, 100, + 1607, 1, 0, 0, 0, 102, 1623, 1, 0, 0, 0, 104, 1631, 1, 0, 0, 0, 106, 1634, + 1, 0, 0, 0, 108, 1669, 1, 0, 0, 0, 110, 1681, 1, 0, 0, 0, 112, 1722, 1, + 0, 0, 0, 114, 1736, 1, 0, 0, 0, 116, 1744, 1, 0, 0, 0, 118, 1750, 1, 0, + 0, 0, 120, 1781, 1, 0, 0, 0, 122, 1817, 1, 0, 0, 0, 124, 1827, 1, 0, 0, + 0, 126, 1836, 1, 0, 0, 0, 128, 1851, 1, 0, 0, 0, 130, 1871, 1, 0, 0, 0, + 132, 1893, 1, 0, 0, 0, 134, 1905, 1, 0, 0, 0, 136, 1915, 1, 0, 0, 0, 138, + 1921, 1, 0, 0, 0, 140, 1933, 1, 0, 0, 0, 142, 1945, 1, 0, 0, 0, 144, 1957, + 1, 0, 0, 0, 146, 1966, 1, 0, 0, 0, 148, 2053, 1, 0, 0, 0, 150, 2055, 1, + 0, 0, 0, 152, 2058, 1, 0, 0, 0, 154, 2061, 1, 0, 0, 0, 156, 2068, 1, 0, + 0, 0, 158, 2075, 1, 0, 0, 0, 160, 2079, 1, 0, 0, 0, 162, 2093, 1, 0, 0, + 0, 164, 2095, 1, 0, 0, 0, 166, 2097, 1, 0, 0, 0, 168, 2099, 1, 0, 0, 0, + 170, 2103, 1, 0, 0, 0, 172, 2105, 1, 0, 0, 0, 174, 2107, 1, 0, 0, 0, 176, + 2109, 1, 0, 0, 0, 178, 2111, 1, 0, 0, 0, 180, 2116, 1, 0, 0, 0, 182, 2120, + 1, 0, 0, 0, 184, 2122, 1, 0, 0, 0, 186, 2124, 1, 0, 0, 0, 188, 2126, 1, + 0, 0, 0, 190, 2128, 1, 0, 0, 0, 192, 2130, 1, 0, 0, 0, 194, 2132, 1, 0, + 0, 0, 196, 2134, 1, 0, 0, 0, 198, 2136, 1, 0, 0, 0, 200, 2138, 1, 0, 0, + 0, 202, 2140, 1, 0, 0, 0, 204, 2142, 1, 0, 0, 0, 206, 2144, 1, 0, 0, 0, + 208, 2146, 1, 0, 0, 0, 210, 2148, 1, 0, 0, 0, 212, 2150, 1, 0, 0, 0, 214, + 2152, 1, 0, 0, 0, 216, 2154, 1, 0, 0, 0, 218, 2156, 1, 0, 0, 0, 220, 2158, + 1, 0, 0, 0, 222, 2160, 1, 0, 0, 0, 224, 2162, 1, 0, 0, 0, 226, 2164, 1, + 0, 0, 0, 228, 2173, 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, 73, 0, 0, + 263, 264, 5, 116, 0, 0, 264, 266, 5, 113, 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, 32, 0, 0, 296, 300, 5, 135, 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, 123, 0, 0, 304, 305, 5, 139, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, + 5, 48, 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, 139, 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, 29, 0, 0, 316, 318, 5, 48, 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, 65, 0, 0, 321, 323, 5, 48, 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, 33, 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, 37, 0, 0, 338, 340, 5, 57, 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, 35, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, + 1, 0, 0, 0, 345, 347, 5, 40, 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, 140, 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, 140, 0, 0, 357, 356, + 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 128, + 0, 0, 360, 362, 5, 140, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, + 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 139, 0, 0, 364, 366, 5, 131, 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, 131, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, + 1, 0, 0, 0, 373, 375, 5, 122, 0, 0, 374, 376, 5, 131, 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, 52, 0, 0, 380, 382, 5, 143, 0, + 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, + 387, 5, 86, 0, 0, 384, 385, 5, 82, 0, 0, 385, 386, 5, 104, 0, 0, 386, 388, + 5, 72, 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, 109, 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, 151, 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, 47, 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, 153, 0, 0, 423, 426, 5, 188, 0, 0, 424, 426, + 5, 134, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, + 0, 0, 427, 429, 5, 52, 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, 135, 0, 0, 432, + 433, 5, 82, 0, 0, 433, 434, 5, 104, 0, 0, 434, 436, 5, 72, 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, 35, 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, 51, 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, 115, 0, 0, 506, + 508, 5, 97, 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, 38, 0, + 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, + 517, 5, 104, 0, 0, 517, 520, 5, 106, 0, 0, 518, 520, 5, 143, 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, 46, 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, 58, 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, 47, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, + 40, 20, 0, 541, 542, 5, 172, 0, 0, 542, 544, 5, 173, 0, 0, 543, 541, 1, + 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 35, 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, 189, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 51, 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, 115, 0, 0, 564, 567, 5, 97, 0, 0, 565, 567, 5, 143, + 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, 46, 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, 76, 0, 0, 587, 588, 5, 97, 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, 119, 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, 109, 0, 0, 618, 625, 7, + 5, 0, 0, 619, 620, 5, 133, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 43, + 0, 0, 622, 626, 5, 125, 0, 0, 623, 624, 5, 103, 0, 0, 624, 626, 5, 28, + 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, 101, 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, 104, 0, 0, 635, 634, 1, 0, 0, + 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 59, 0, 0, 638, + 639, 5, 88, 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, 109, 0, 0, 645, 646, 5, 50, 0, + 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 52, 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, 141, 0, 0, 653, 654, 5, 82, 0, 0, 654, 655, 5, + 104, 0, 0, 655, 657, 5, 72, 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, 39, 0, 0, 665, 669, + 5, 30, 0, 0, 666, 667, 5, 91, 0, 0, 667, 669, 5, 107, 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, 61, 0, 0, 671, 685, 5, 90, 0, 0, + 672, 682, 5, 144, 0, 0, 673, 674, 5, 107, 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, 109, 0, 0, 687, + 691, 3, 184, 92, 0, 688, 689, 5, 75, 0, 0, 689, 690, 5, 66, 0, 0, 690, + 692, 5, 129, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, + 1, 0, 0, 0, 693, 694, 5, 150, 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, 40, 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, 68, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 52, 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, 148, 0, 0, 717, 718, 5, 82, 0, 0, 718, 719, + 5, 104, 0, 0, 719, 721, 5, 72, 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, 35, 0, 0, 742, 743, 3, 84, 42, 0, 743, + 47, 1, 0, 0, 0, 744, 745, 5, 52, 0, 0, 745, 746, 5, 149, 0, 0, 746, 750, + 5, 135, 0, 0, 747, 748, 5, 82, 0, 0, 748, 749, 5, 104, 0, 0, 749, 751, + 5, 72, 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, 145, 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, 152, 0, 0, 774, 776, + 5, 118, 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, 35, 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, 35, 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, 35, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, + 0, 812, 814, 5, 142, 0, 0, 813, 815, 5, 31, 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, 35, 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, 126, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, + 0, 841, 843, 5, 35, 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, 35, 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, 61, + 0, 0, 869, 870, 5, 77, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 151, + 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, 61, 0, 0, 882, 883, 5, 77, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, + 5, 151, 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, 63, 0, 0, 898, 900, 5, 57, 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, 65, 0, 0, 904, 907, 7, 9, 0, 0, + 905, 906, 5, 82, 0, 0, 906, 908, 5, 72, 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, 190, + 0, 0, 919, 1006, 5, 191, 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, 21, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, + 5, 3, 0, 0, 936, 938, 5, 64, 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, 45, 0, 0, 969, 970, 5, 3, 0, 0, 970, + 971, 3, 68, 34, 0, 971, 972, 5, 35, 0, 0, 972, 973, 3, 32, 16, 0, 973, + 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 104, 0, 0, 976, 975, + 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 72, + 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, 44, 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, 150, + 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 138, 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, 67, 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, 68, 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, 1126, 1, 0, 0, 0, 1007, 1008, 10, 20, 0, 0, 1008, 1009, 5, + 13, 0, 0, 1009, 1125, 3, 68, 34, 21, 1010, 1011, 10, 19, 0, 0, 1011, 1012, + 7, 10, 0, 0, 1012, 1125, 3, 68, 34, 20, 1013, 1014, 10, 18, 0, 0, 1014, + 1015, 7, 11, 0, 0, 1015, 1125, 3, 68, 34, 19, 1016, 1017, 10, 17, 0, 0, + 1017, 1018, 7, 4, 0, 0, 1018, 1125, 3, 68, 34, 18, 1019, 1020, 10, 16, + 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1125, 3, 68, 34, 17, 1022, 1023, 10, + 15, 0, 0, 1023, 1024, 7, 13, 0, 0, 1024, 1125, 3, 68, 34, 16, 1025, 1041, + 10, 14, 0, 0, 1026, 1042, 5, 6, 0, 0, 1027, 1042, 5, 24, 0, 0, 1028, 1042, + 5, 25, 0, 0, 1029, 1042, 5, 26, 0, 0, 1030, 1042, 5, 94, 0, 0, 1031, 1032, + 5, 94, 0, 0, 1032, 1042, 5, 104, 0, 0, 1033, 1035, 5, 104, 0, 0, 1034, + 1033, 1, 0, 0, 0, 1034, 1035, 1, 0, 0, 0, 1035, 1036, 1, 0, 0, 0, 1036, + 1042, 5, 85, 0, 0, 1037, 1042, 5, 99, 0, 0, 1038, 1042, 5, 79, 0, 0, 1039, + 1042, 5, 101, 0, 0, 1040, 1042, 5, 120, 0, 0, 1041, 1026, 1, 0, 0, 0, 1041, + 1027, 1, 0, 0, 0, 1041, 1028, 1, 0, 0, 0, 1041, 1029, 1, 0, 0, 0, 1041, + 1030, 1, 0, 0, 0, 1041, 1031, 1, 0, 0, 0, 1041, 1034, 1, 0, 0, 0, 1041, + 1037, 1, 0, 0, 0, 1041, 1038, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, + 1040, 1, 0, 0, 0, 1042, 1043, 1, 0, 0, 0, 1043, 1125, 3, 68, 34, 15, 1044, + 1045, 10, 12, 0, 0, 1045, 1046, 5, 34, 0, 0, 1046, 1125, 3, 68, 34, 13, + 1047, 1048, 10, 11, 0, 0, 1048, 1049, 5, 110, 0, 0, 1049, 1125, 3, 68, + 34, 12, 1050, 1052, 10, 4, 0, 0, 1051, 1053, 5, 104, 0, 0, 1052, 1051, + 1, 0, 0, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, + 5, 41, 0, 0, 1055, 1056, 3, 68, 34, 0, 1056, 1057, 5, 34, 0, 0, 1057, 1058, + 3, 68, 34, 5, 1058, 1125, 1, 0, 0, 0, 1059, 1061, 10, 13, 0, 0, 1060, 1062, + 5, 104, 0, 0, 1061, 1060, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1063, + 1, 0, 0, 0, 1063, 1102, 5, 85, 0, 0, 1064, 1074, 5, 3, 0, 0, 1065, 1075, + 3, 84, 42, 0, 1066, 1071, 3, 68, 34, 0, 1067, 1068, 5, 5, 0, 0, 1068, 1070, + 3, 68, 34, 0, 1069, 1067, 1, 0, 0, 0, 1070, 1073, 1, 0, 0, 0, 1071, 1069, + 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1075, 1, 0, 0, 0, 1073, 1071, + 1, 0, 0, 0, 1074, 1065, 1, 0, 0, 0, 1074, 1066, 1, 0, 0, 0, 1074, 1075, + 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1103, 5, 4, 0, 0, 1077, 1078, + 3, 182, 91, 0, 1078, 1079, 5, 2, 0, 0, 1079, 1081, 1, 0, 0, 0, 1080, 1077, + 1, 0, 0, 0, 1080, 1081, 1, 0, 0, 0, 1081, 1082, 1, 0, 0, 0, 1082, 1103, + 3, 184, 92, 0, 1083, 1084, 3, 182, 91, 0, 1084, 1085, 5, 2, 0, 0, 1085, + 1087, 1, 0, 0, 0, 1086, 1083, 1, 0, 0, 0, 1086, 1087, 1, 0, 0, 0, 1087, + 1088, 1, 0, 0, 0, 1088, 1089, 3, 226, 113, 0, 1089, 1098, 5, 3, 0, 0, 1090, + 1095, 3, 68, 34, 0, 1091, 1092, 5, 5, 0, 0, 1092, 1094, 3, 68, 34, 0, 1093, + 1091, 1, 0, 0, 0, 1094, 1097, 1, 0, 0, 0, 1095, 1093, 1, 0, 0, 0, 1095, + 1096, 1, 0, 0, 0, 1096, 1099, 1, 0, 0, 0, 1097, 1095, 1, 0, 0, 0, 1098, + 1090, 1, 0, 0, 0, 1098, 1099, 1, 0, 0, 0, 1099, 1100, 1, 0, 0, 0, 1100, + 1101, 5, 4, 0, 0, 1101, 1103, 1, 0, 0, 0, 1102, 1064, 1, 0, 0, 0, 1102, + 1080, 1, 0, 0, 0, 1102, 1086, 1, 0, 0, 0, 1103, 1125, 1, 0, 0, 0, 1104, + 1105, 10, 7, 0, 0, 1105, 1106, 5, 47, 0, 0, 1106, 1125, 3, 192, 96, 0, + 1107, 1109, 10, 6, 0, 0, 1108, 1110, 5, 104, 0, 0, 1109, 1108, 1, 0, 0, + 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 1, 0, 0, 0, 1111, 1112, 7, 14, 0, + 0, 1112, 1115, 3, 68, 34, 0, 1113, 1114, 5, 69, 0, 0, 1114, 1116, 3, 68, + 34, 0, 1115, 1113, 1, 0, 0, 0, 1115, 1116, 1, 0, 0, 0, 1116, 1125, 1, 0, + 0, 0, 1117, 1122, 10, 5, 0, 0, 1118, 1123, 5, 95, 0, 0, 1119, 1123, 5, + 105, 0, 0, 1120, 1121, 5, 104, 0, 0, 1121, 1123, 5, 106, 0, 0, 1122, 1118, + 1, 0, 0, 0, 1122, 1119, 1, 0, 0, 0, 1122, 1120, 1, 0, 0, 0, 1123, 1125, + 1, 0, 0, 0, 1124, 1007, 1, 0, 0, 0, 1124, 1010, 1, 0, 0, 0, 1124, 1013, + 1, 0, 0, 0, 1124, 1016, 1, 0, 0, 0, 1124, 1019, 1, 0, 0, 0, 1124, 1022, + 1, 0, 0, 0, 1124, 1025, 1, 0, 0, 0, 1124, 1044, 1, 0, 0, 0, 1124, 1047, + 1, 0, 0, 0, 1124, 1050, 1, 0, 0, 0, 1124, 1059, 1, 0, 0, 0, 1124, 1104, + 1, 0, 0, 0, 1124, 1107, 1, 0, 0, 0, 1124, 1117, 1, 0, 0, 0, 1125, 1128, + 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1126, 1127, 1, 0, 0, 0, 1127, 69, 1, + 0, 0, 0, 1128, 1126, 1, 0, 0, 0, 1129, 1130, 5, 117, 0, 0, 1130, 1135, + 5, 3, 0, 0, 1131, 1136, 5, 83, 0, 0, 1132, 1133, 7, 15, 0, 0, 1133, 1134, + 5, 5, 0, 0, 1134, 1136, 3, 168, 84, 0, 1135, 1131, 1, 0, 0, 0, 1135, 1132, + 1, 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1138, 5, 4, 0, 0, 1138, 71, 1, + 0, 0, 0, 1139, 1140, 7, 16, 0, 0, 1140, 73, 1, 0, 0, 0, 1141, 1143, 3, + 50, 25, 0, 1142, 1141, 1, 0, 0, 0, 1142, 1143, 1, 0, 0, 0, 1143, 1149, + 1, 0, 0, 0, 1144, 1150, 5, 90, 0, 0, 1145, 1150, 5, 124, 0, 0, 1146, 1147, + 5, 90, 0, 0, 1147, 1148, 5, 110, 0, 0, 1148, 1150, 7, 8, 0, 0, 1149, 1144, + 1, 0, 0, 0, 1149, 1145, 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1150, 1151, + 1, 0, 0, 0, 1151, 1155, 5, 93, 0, 0, 1152, 1153, 3, 182, 91, 0, 1153, 1154, + 5, 2, 0, 0, 1154, 1156, 1, 0, 0, 0, 1155, 1152, 1, 0, 0, 0, 1155, 1156, + 1, 0, 0, 0, 1156, 1157, 1, 0, 0, 0, 1157, 1160, 3, 184, 92, 0, 1158, 1159, + 5, 35, 0, 0, 1159, 1161, 3, 208, 104, 0, 1160, 1158, 1, 0, 0, 0, 1160, + 1161, 1, 0, 0, 0, 1161, 1173, 1, 0, 0, 0, 1162, 1163, 5, 3, 0, 0, 1163, + 1168, 3, 190, 95, 0, 1164, 1165, 5, 5, 0, 0, 1165, 1167, 3, 190, 95, 0, + 1166, 1164, 1, 0, 0, 0, 1167, 1170, 1, 0, 0, 0, 1168, 1166, 1, 0, 0, 0, + 1168, 1169, 1, 0, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1168, 1, 0, 0, 0, + 1171, 1172, 5, 4, 0, 0, 1172, 1174, 1, 0, 0, 0, 1173, 1162, 1, 0, 0, 0, + 1173, 1174, 1, 0, 0, 0, 1174, 1206, 1, 0, 0, 0, 1175, 1176, 5, 147, 0, + 0, 1176, 1177, 5, 3, 0, 0, 1177, 1182, 3, 68, 34, 0, 1178, 1179, 5, 5, + 0, 0, 1179, 1181, 3, 68, 34, 0, 1180, 1178, 1, 0, 0, 0, 1181, 1184, 1, + 0, 0, 0, 1182, 1180, 1, 0, 0, 0, 1182, 1183, 1, 0, 0, 0, 1183, 1185, 1, + 0, 0, 0, 1184, 1182, 1, 0, 0, 0, 1185, 1200, 5, 4, 0, 0, 1186, 1187, 5, + 5, 0, 0, 1187, 1188, 5, 3, 0, 0, 1188, 1193, 3, 68, 34, 0, 1189, 1190, + 5, 5, 0, 0, 1190, 1192, 3, 68, 34, 0, 1191, 1189, 1, 0, 0, 0, 1192, 1195, + 1, 0, 0, 0, 1193, 1191, 1, 0, 0, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1196, + 1, 0, 0, 0, 1195, 1193, 1, 0, 0, 0, 1196, 1197, 5, 4, 0, 0, 1197, 1199, + 1, 0, 0, 0, 1198, 1186, 1, 0, 0, 0, 1199, 1202, 1, 0, 0, 0, 1200, 1198, + 1, 0, 0, 0, 1200, 1201, 1, 0, 0, 0, 1201, 1207, 1, 0, 0, 0, 1202, 1200, + 1, 0, 0, 0, 1203, 1207, 3, 84, 42, 0, 1204, 1205, 5, 58, 0, 0, 1205, 1207, + 5, 147, 0, 0, 1206, 1175, 1, 0, 0, 0, 1206, 1203, 1, 0, 0, 0, 1206, 1204, + 1, 0, 0, 0, 1207, 1209, 1, 0, 0, 0, 1208, 1210, 3, 76, 38, 0, 1209, 1208, + 1, 0, 0, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1212, 1, 0, 0, 0, 1211, 1213, + 3, 58, 29, 0, 1212, 1211, 1, 0, 0, 0, 1212, 1213, 1, 0, 0, 0, 1213, 75, + 1, 0, 0, 0, 1214, 1215, 5, 109, 0, 0, 1215, 1230, 5, 50, 0, 0, 1216, 1217, + 5, 3, 0, 0, 1217, 1222, 3, 24, 12, 0, 1218, 1219, 5, 5, 0, 0, 1219, 1221, + 3, 24, 12, 0, 1220, 1218, 1, 0, 0, 0, 1221, 1224, 1, 0, 0, 0, 1222, 1220, + 1, 0, 0, 0, 1222, 1223, 1, 0, 0, 0, 1223, 1225, 1, 0, 0, 0, 1224, 1222, + 1, 0, 0, 0, 1225, 1228, 5, 4, 0, 0, 1226, 1227, 5, 151, 0, 0, 1227, 1229, + 3, 68, 34, 0, 1228, 1226, 1, 0, 0, 0, 1228, 1229, 1, 0, 0, 0, 1229, 1231, + 1, 0, 0, 0, 1230, 1216, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1232, + 1, 0, 0, 0, 1232, 1259, 5, 186, 0, 0, 1233, 1260, 5, 187, 0, 0, 1234, 1235, + 5, 144, 0, 0, 1235, 1238, 5, 133, 0, 0, 1236, 1239, 3, 190, 95, 0, 1237, + 1239, 3, 108, 54, 0, 1238, 1236, 1, 0, 0, 0, 1238, 1237, 1, 0, 0, 0, 1239, + 1240, 1, 0, 0, 0, 1240, 1241, 5, 6, 0, 0, 1241, 1252, 3, 68, 34, 0, 1242, + 1245, 5, 5, 0, 0, 1243, 1246, 3, 190, 95, 0, 1244, 1246, 3, 108, 54, 0, + 1245, 1243, 1, 0, 0, 0, 1245, 1244, 1, 0, 0, 0, 1246, 1247, 1, 0, 0, 0, + 1247, 1248, 5, 6, 0, 0, 1248, 1249, 3, 68, 34, 0, 1249, 1251, 1, 0, 0, + 0, 1250, 1242, 1, 0, 0, 0, 1251, 1254, 1, 0, 0, 0, 1252, 1250, 1, 0, 0, + 0, 1252, 1253, 1, 0, 0, 0, 1253, 1257, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, + 0, 1255, 1256, 5, 151, 0, 0, 1256, 1258, 3, 68, 34, 0, 1257, 1255, 1, 0, + 0, 0, 1257, 1258, 1, 0, 0, 0, 1258, 1260, 1, 0, 0, 0, 1259, 1233, 1, 0, + 0, 0, 1259, 1234, 1, 0, 0, 0, 1260, 77, 1, 0, 0, 0, 1261, 1265, 5, 114, + 0, 0, 1262, 1263, 3, 182, 91, 0, 1263, 1264, 5, 2, 0, 0, 1264, 1266, 1, + 0, 0, 0, 1265, 1262, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1267, 1, + 0, 0, 0, 1267, 1274, 3, 204, 102, 0, 1268, 1269, 5, 6, 0, 0, 1269, 1275, + 3, 80, 40, 0, 1270, 1271, 5, 3, 0, 0, 1271, 1272, 3, 80, 40, 0, 1272, 1273, + 5, 4, 0, 0, 1273, 1275, 1, 0, 0, 0, 1274, 1268, 1, 0, 0, 0, 1274, 1270, + 1, 0, 0, 0, 1274, 1275, 1, 0, 0, 0, 1275, 79, 1, 0, 0, 0, 1276, 1280, 3, + 36, 18, 0, 1277, 1280, 3, 176, 88, 0, 1278, 1280, 5, 192, 0, 0, 1279, 1276, + 1, 0, 0, 0, 1279, 1277, 1, 0, 0, 0, 1279, 1278, 1, 0, 0, 0, 1280, 81, 1, + 0, 0, 0, 1281, 1292, 5, 121, 0, 0, 1282, 1293, 3, 192, 96, 0, 1283, 1284, + 3, 182, 91, 0, 1284, 1285, 5, 2, 0, 0, 1285, 1287, 1, 0, 0, 0, 1286, 1283, + 1, 0, 0, 0, 1286, 1287, 1, 0, 0, 0, 1287, 1290, 1, 0, 0, 0, 1288, 1291, + 3, 184, 92, 0, 1289, 1291, 3, 196, 98, 0, 1290, 1288, 1, 0, 0, 0, 1290, + 1289, 1, 0, 0, 0, 1291, 1293, 1, 0, 0, 0, 1292, 1282, 1, 0, 0, 0, 1292, + 1286, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 83, 1, 0, 0, 0, 1294, 1296, + 3, 132, 66, 0, 1295, 1294, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1297, + 1, 0, 0, 0, 1297, 1303, 3, 88, 44, 0, 1298, 1299, 3, 104, 52, 0, 1299, + 1300, 3, 88, 44, 0, 1300, 1302, 1, 0, 0, 0, 1301, 1298, 1, 0, 0, 0, 1302, + 1305, 1, 0, 0, 0, 1303, 1301, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, + 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1306, 1308, 3, 134, 67, 0, 1307, + 1306, 1, 0, 0, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1310, 1, 0, 0, 0, 1309, + 1311, 3, 136, 68, 0, 1310, 1309, 1, 0, 0, 0, 1310, 1311, 1, 0, 0, 0, 1311, + 85, 1, 0, 0, 0, 1312, 1319, 3, 96, 48, 0, 1313, 1314, 3, 100, 50, 0, 1314, + 1315, 3, 96, 48, 0, 1315, 1316, 3, 102, 51, 0, 1316, 1318, 1, 0, 0, 0, + 1317, 1313, 1, 0, 0, 0, 1318, 1321, 1, 0, 0, 0, 1319, 1317, 1, 0, 0, 0, + 1319, 1320, 1, 0, 0, 0, 1320, 87, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, 1322, + 1324, 5, 132, 0, 0, 1323, 1325, 7, 17, 0, 0, 1324, 1323, 1, 0, 0, 0, 1324, + 1325, 1, 0, 0, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1331, 3, 98, 49, 0, 1327, + 1328, 5, 5, 0, 0, 1328, 1330, 3, 98, 49, 0, 1329, 1327, 1, 0, 0, 0, 1330, + 1333, 1, 0, 0, 0, 1331, 1329, 1, 0, 0, 0, 1331, 1332, 1, 0, 0, 0, 1332, + 1346, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1334, 1344, 5, 77, 0, 0, 1335, + 1340, 3, 96, 48, 0, 1336, 1337, 5, 5, 0, 0, 1337, 1339, 3, 96, 48, 0, 1338, + 1336, 1, 0, 0, 0, 1339, 1342, 1, 0, 0, 0, 1340, 1338, 1, 0, 0, 0, 1340, + 1341, 1, 0, 0, 0, 1341, 1345, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1343, + 1345, 3, 86, 43, 0, 1344, 1335, 1, 0, 0, 0, 1344, 1343, 1, 0, 0, 0, 1345, + 1347, 1, 0, 0, 0, 1346, 1334, 1, 0, 0, 0, 1346, 1347, 1, 0, 0, 0, 1347, + 1350, 1, 0, 0, 0, 1348, 1349, 5, 151, 0, 0, 1349, 1351, 3, 68, 34, 0, 1350, + 1348, 1, 0, 0, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1366, 1, 0, 0, 0, 1352, + 1353, 5, 80, 0, 0, 1353, 1354, 5, 42, 0, 0, 1354, 1359, 3, 68, 34, 0, 1355, + 1356, 5, 5, 0, 0, 1356, 1358, 3, 68, 34, 0, 1357, 1355, 1, 0, 0, 0, 1358, + 1361, 1, 0, 0, 0, 1359, 1357, 1, 0, 0, 0, 1359, 1360, 1, 0, 0, 0, 1360, + 1364, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1362, 1363, 5, 81, 0, 0, 1363, + 1365, 3, 68, 34, 0, 1364, 1362, 1, 0, 0, 0, 1364, 1365, 1, 0, 0, 0, 1365, + 1367, 1, 0, 0, 0, 1366, 1352, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, + 1382, 1, 0, 0, 0, 1368, 1369, 5, 177, 0, 0, 1369, 1370, 3, 214, 107, 0, + 1370, 1371, 5, 35, 0, 0, 1371, 1379, 3, 118, 59, 0, 1372, 1373, 5, 5, 0, + 0, 1373, 1374, 3, 214, 107, 0, 1374, 1375, 5, 35, 0, 0, 1375, 1376, 3, + 118, 59, 0, 1376, 1378, 1, 0, 0, 0, 1377, 1372, 1, 0, 0, 0, 1378, 1381, + 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1383, + 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1382, 1368, 1, 0, 0, 0, 1382, 1383, + 1, 0, 0, 0, 1383, 1413, 1, 0, 0, 0, 1384, 1385, 5, 147, 0, 0, 1385, 1386, + 5, 3, 0, 0, 1386, 1391, 3, 68, 34, 0, 1387, 1388, 5, 5, 0, 0, 1388, 1390, + 3, 68, 34, 0, 1389, 1387, 1, 0, 0, 0, 1390, 1393, 1, 0, 0, 0, 1391, 1389, + 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 1394, 1, 0, 0, 0, 1393, 1391, + 1, 0, 0, 0, 1394, 1409, 5, 4, 0, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1397, + 5, 3, 0, 0, 1397, 1402, 3, 68, 34, 0, 1398, 1399, 5, 5, 0, 0, 1399, 1401, + 3, 68, 34, 0, 1400, 1398, 1, 0, 0, 0, 1401, 1404, 1, 0, 0, 0, 1402, 1400, + 1, 0, 0, 0, 1402, 1403, 1, 0, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1402, + 1, 0, 0, 0, 1405, 1406, 5, 4, 0, 0, 1406, 1408, 1, 0, 0, 0, 1407, 1395, + 1, 0, 0, 0, 1408, 1411, 1, 0, 0, 0, 1409, 1407, 1, 0, 0, 0, 1409, 1410, + 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1412, 1322, + 1, 0, 0, 0, 1412, 1384, 1, 0, 0, 0, 1413, 89, 1, 0, 0, 0, 1414, 1415, 3, + 84, 42, 0, 1415, 91, 1, 0, 0, 0, 1416, 1418, 3, 132, 66, 0, 1417, 1416, + 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1419, 1, 0, 0, 0, 1419, 1421, + 3, 88, 44, 0, 1420, 1422, 3, 134, 67, 0, 1421, 1420, 1, 0, 0, 0, 1421, + 1422, 1, 0, 0, 0, 1422, 1424, 1, 0, 0, 0, 1423, 1425, 3, 136, 68, 0, 1424, + 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 93, 1, 0, 0, 0, 1426, 1428, + 3, 132, 66, 0, 1427, 1426, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1429, + 1, 0, 0, 0, 1429, 1439, 3, 88, 44, 0, 1430, 1432, 5, 142, 0, 0, 1431, 1433, + 5, 31, 0, 0, 1432, 1431, 1, 0, 0, 0, 1432, 1433, 1, 0, 0, 0, 1433, 1437, + 1, 0, 0, 0, 1434, 1437, 5, 92, 0, 0, 1435, 1437, 5, 70, 0, 0, 1436, 1430, + 1, 0, 0, 0, 1436, 1434, 1, 0, 0, 0, 1436, 1435, 1, 0, 0, 0, 1437, 1438, + 1, 0, 0, 0, 1438, 1440, 3, 88, 44, 0, 1439, 1436, 1, 0, 0, 0, 1440, 1441, + 1, 0, 0, 0, 1441, 1439, 1, 0, 0, 0, 1441, 1442, 1, 0, 0, 0, 1442, 1444, + 1, 0, 0, 0, 1443, 1445, 3, 134, 67, 0, 1444, 1443, 1, 0, 0, 0, 1444, 1445, + 1, 0, 0, 0, 1445, 1447, 1, 0, 0, 0, 1446, 1448, 3, 136, 68, 0, 1447, 1446, + 1, 0, 0, 0, 1447, 1448, 1, 0, 0, 0, 1448, 95, 1, 0, 0, 0, 1449, 1450, 3, + 182, 91, 0, 1450, 1451, 5, 2, 0, 0, 1451, 1453, 1, 0, 0, 0, 1452, 1449, + 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1454, 1, 0, 0, 0, 1454, 1459, + 3, 184, 92, 0, 1455, 1457, 5, 35, 0, 0, 1456, 1455, 1, 0, 0, 0, 1456, 1457, + 1, 0, 0, 0, 1457, 1458, 1, 0, 0, 0, 1458, 1460, 3, 208, 104, 0, 1459, 1456, + 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1466, 1, 0, 0, 0, 1461, 1462, + 5, 87, 0, 0, 1462, 1463, 5, 42, 0, 0, 1463, 1467, 3, 196, 98, 0, 1464, + 1465, 5, 104, 0, 0, 1465, 1467, 5, 87, 0, 0, 1466, 1461, 1, 0, 0, 0, 1466, + 1464, 1, 0, 0, 0, 1466, 1467, 1, 0, 0, 0, 1467, 1578, 1, 0, 0, 0, 1468, + 1469, 3, 182, 91, 0, 1469, 1470, 5, 2, 0, 0, 1470, 1472, 1, 0, 0, 0, 1471, + 1468, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 1, 0, 0, 0, 1473, + 1474, 3, 226, 113, 0, 1474, 1475, 5, 3, 0, 0, 1475, 1480, 3, 68, 34, 0, + 1476, 1477, 5, 5, 0, 0, 1477, 1479, 3, 68, 34, 0, 1478, 1476, 1, 0, 0, + 0, 1479, 1482, 1, 0, 0, 0, 1480, 1478, 1, 0, 0, 0, 1480, 1481, 1, 0, 0, + 0, 1481, 1483, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1483, 1488, 5, 4, 0, + 0, 1484, 1486, 5, 35, 0, 0, 1485, 1484, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, + 0, 1486, 1487, 1, 0, 0, 0, 1487, 1489, 3, 208, 104, 0, 1488, 1485, 1, 0, + 0, 0, 1488, 1489, 1, 0, 0, 0, 1489, 1578, 1, 0, 0, 0, 1490, 1500, 5, 3, + 0, 0, 1491, 1496, 3, 96, 48, 0, 1492, 1493, 5, 5, 0, 0, 1493, 1495, 3, + 96, 48, 0, 1494, 1492, 1, 0, 0, 0, 1495, 1498, 1, 0, 0, 0, 1496, 1494, + 1, 0, 0, 0, 1496, 1497, 1, 0, 0, 0, 1497, 1501, 1, 0, 0, 0, 1498, 1496, + 1, 0, 0, 0, 1499, 1501, 3, 86, 43, 0, 1500, 1491, 1, 0, 0, 0, 1500, 1499, + 1, 0, 0, 0, 1501, 1502, 1, 0, 0, 0, 1502, 1503, 5, 4, 0, 0, 1503, 1578, + 1, 0, 0, 0, 1504, 1505, 5, 3, 0, 0, 1505, 1506, 3, 84, 42, 0, 1506, 1511, + 5, 4, 0, 0, 1507, 1509, 5, 35, 0, 0, 1508, 1507, 1, 0, 0, 0, 1508, 1509, + 1, 0, 0, 0, 1509, 1510, 1, 0, 0, 0, 1510, 1512, 3, 208, 104, 0, 1511, 1508, + 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1578, 1, 0, 0, 0, 1513, 1514, + 3, 182, 91, 0, 1514, 1515, 5, 2, 0, 0, 1515, 1517, 1, 0, 0, 0, 1516, 1513, + 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1518, 1, 0, 0, 0, 1518, 1523, + 3, 184, 92, 0, 1519, 1521, 5, 35, 0, 0, 1520, 1519, 1, 0, 0, 0, 1520, 1521, + 1, 0, 0, 0, 1521, 1522, 1, 0, 0, 0, 1522, 1524, 3, 210, 105, 0, 1523, 1520, + 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1530, 1, 0, 0, 0, 1525, 1526, + 5, 87, 0, 0, 1526, 1527, 5, 42, 0, 0, 1527, 1531, 3, 196, 98, 0, 1528, + 1529, 5, 104, 0, 0, 1529, 1531, 5, 87, 0, 0, 1530, 1525, 1, 0, 0, 0, 1530, + 1528, 1, 0, 0, 0, 1530, 1531, 1, 0, 0, 0, 1531, 1578, 1, 0, 0, 0, 1532, + 1533, 3, 182, 91, 0, 1533, 1534, 5, 2, 0, 0, 1534, 1536, 1, 0, 0, 0, 1535, + 1532, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 1, 0, 0, 0, 1537, + 1538, 3, 226, 113, 0, 1538, 1539, 5, 3, 0, 0, 1539, 1544, 3, 68, 34, 0, + 1540, 1541, 5, 5, 0, 0, 1541, 1543, 3, 68, 34, 0, 1542, 1540, 1, 0, 0, + 0, 1543, 1546, 1, 0, 0, 0, 1544, 1542, 1, 0, 0, 0, 1544, 1545, 1, 0, 0, + 0, 1545, 1547, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1547, 1552, 5, 4, 0, + 0, 1548, 1550, 5, 35, 0, 0, 1549, 1548, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, + 0, 1550, 1551, 1, 0, 0, 0, 1551, 1553, 3, 210, 105, 0, 1552, 1549, 1, 0, + 0, 0, 1552, 1553, 1, 0, 0, 0, 1553, 1578, 1, 0, 0, 0, 1554, 1564, 5, 3, + 0, 0, 1555, 1560, 3, 96, 48, 0, 1556, 1557, 5, 5, 0, 0, 1557, 1559, 3, + 96, 48, 0, 1558, 1556, 1, 0, 0, 0, 1559, 1562, 1, 0, 0, 0, 1560, 1558, + 1, 0, 0, 0, 1560, 1561, 1, 0, 0, 0, 1561, 1565, 1, 0, 0, 0, 1562, 1560, + 1, 0, 0, 0, 1563, 1565, 3, 86, 43, 0, 1564, 1555, 1, 0, 0, 0, 1564, 1563, + 1, 0, 0, 0, 1565, 1566, 1, 0, 0, 0, 1566, 1567, 5, 4, 0, 0, 1567, 1578, + 1, 0, 0, 0, 1568, 1569, 5, 3, 0, 0, 1569, 1570, 3, 84, 42, 0, 1570, 1575, + 5, 4, 0, 0, 1571, 1573, 5, 35, 0, 0, 1572, 1571, 1, 0, 0, 0, 1572, 1573, + 1, 0, 0, 0, 1573, 1574, 1, 0, 0, 0, 1574, 1576, 3, 210, 105, 0, 1575, 1572, + 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 1, 0, 0, 0, 1577, 1452, + 1, 0, 0, 0, 1577, 1471, 1, 0, 0, 0, 1577, 1490, 1, 0, 0, 0, 1577, 1504, + 1, 0, 0, 0, 1577, 1516, 1, 0, 0, 0, 1577, 1535, 1, 0, 0, 0, 1577, 1554, + 1, 0, 0, 0, 1577, 1568, 1, 0, 0, 0, 1578, 97, 1, 0, 0, 0, 1579, 1592, 5, + 7, 0, 0, 1580, 1581, 3, 184, 92, 0, 1581, 1582, 5, 2, 0, 0, 1582, 1583, + 5, 7, 0, 0, 1583, 1592, 1, 0, 0, 0, 1584, 1589, 3, 68, 34, 0, 1585, 1587, + 5, 35, 0, 0, 1586, 1585, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1588, + 1, 0, 0, 0, 1588, 1590, 3, 172, 86, 0, 1589, 1586, 1, 0, 0, 0, 1589, 1590, + 1, 0, 0, 0, 1590, 1592, 1, 0, 0, 0, 1591, 1579, 1, 0, 0, 0, 1591, 1580, + 1, 0, 0, 0, 1591, 1584, 1, 0, 0, 0, 1592, 99, 1, 0, 0, 0, 1593, 1608, 5, + 5, 0, 0, 1594, 1596, 5, 102, 0, 0, 1595, 1594, 1, 0, 0, 0, 1595, 1596, + 1, 0, 0, 0, 1596, 1602, 1, 0, 0, 0, 1597, 1599, 7, 18, 0, 0, 1598, 1600, + 5, 112, 0, 0, 1599, 1598, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1603, + 1, 0, 0, 0, 1601, 1603, 5, 89, 0, 0, 1602, 1597, 1, 0, 0, 0, 1602, 1601, + 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1604, 1, 0, 0, 0, 1604, 1608, + 5, 96, 0, 0, 1605, 1606, 5, 53, 0, 0, 1606, 1608, 5, 96, 0, 0, 1607, 1593, + 1, 0, 0, 0, 1607, 1595, 1, 0, 0, 0, 1607, 1605, 1, 0, 0, 0, 1608, 101, + 1, 0, 0, 0, 1609, 1610, 5, 109, 0, 0, 1610, 1624, 3, 68, 34, 0, 1611, 1612, + 5, 145, 0, 0, 1612, 1613, 5, 3, 0, 0, 1613, 1618, 3, 190, 95, 0, 1614, + 1615, 5, 5, 0, 0, 1615, 1617, 3, 190, 95, 0, 1616, 1614, 1, 0, 0, 0, 1617, + 1620, 1, 0, 0, 0, 1618, 1616, 1, 0, 0, 0, 1618, 1619, 1, 0, 0, 0, 1619, + 1621, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1621, 1622, 5, 4, 0, 0, 1622, + 1624, 1, 0, 0, 0, 1623, 1609, 1, 0, 0, 0, 1623, 1611, 1, 0, 0, 0, 1623, + 1624, 1, 0, 0, 0, 1624, 103, 1, 0, 0, 0, 1625, 1627, 5, 142, 0, 0, 1626, + 1628, 5, 31, 0, 0, 1627, 1626, 1, 0, 0, 0, 1627, 1628, 1, 0, 0, 0, 1628, + 1632, 1, 0, 0, 0, 1629, 1632, 5, 92, 0, 0, 1630, 1632, 5, 70, 0, 0, 1631, + 1625, 1, 0, 0, 0, 1631, 1629, 1, 0, 0, 0, 1631, 1630, 1, 0, 0, 0, 1632, + 105, 1, 0, 0, 0, 1633, 1635, 3, 50, 25, 0, 1634, 1633, 1, 0, 0, 0, 1634, + 1635, 1, 0, 0, 0, 1635, 1636, 1, 0, 0, 0, 1636, 1639, 5, 144, 0, 0, 1637, + 1638, 5, 110, 0, 0, 1638, 1640, 7, 8, 0, 0, 1639, 1637, 1, 0, 0, 0, 1639, + 1640, 1, 0, 0, 0, 1640, 1641, 1, 0, 0, 0, 1641, 1642, 3, 112, 56, 0, 1642, + 1645, 5, 133, 0, 0, 1643, 1646, 3, 190, 95, 0, 1644, 1646, 3, 108, 54, + 0, 1645, 1643, 1, 0, 0, 0, 1645, 1644, 1, 0, 0, 0, 1646, 1647, 1, 0, 0, + 0, 1647, 1648, 5, 6, 0, 0, 1648, 1659, 3, 68, 34, 0, 1649, 1652, 5, 5, + 0, 0, 1650, 1653, 3, 190, 95, 0, 1651, 1653, 3, 108, 54, 0, 1652, 1650, + 1, 0, 0, 0, 1652, 1651, 1, 0, 0, 0, 1653, 1654, 1, 0, 0, 0, 1654, 1655, + 5, 6, 0, 0, 1655, 1656, 3, 68, 34, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1649, + 1, 0, 0, 0, 1658, 1661, 1, 0, 0, 0, 1659, 1657, 1, 0, 0, 0, 1659, 1660, + 1, 0, 0, 0, 1660, 1664, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1662, 1663, + 5, 151, 0, 0, 1663, 1665, 3, 68, 34, 0, 1664, 1662, 1, 0, 0, 0, 1664, 1665, + 1, 0, 0, 0, 1665, 1667, 1, 0, 0, 0, 1666, 1668, 3, 58, 29, 0, 1667, 1666, + 1, 0, 0, 0, 1667, 1668, 1, 0, 0, 0, 1668, 107, 1, 0, 0, 0, 1669, 1670, + 5, 3, 0, 0, 1670, 1675, 3, 190, 95, 0, 1671, 1672, 5, 5, 0, 0, 1672, 1674, + 3, 190, 95, 0, 1673, 1671, 1, 0, 0, 0, 1674, 1677, 1, 0, 0, 0, 1675, 1673, + 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1675, + 1, 0, 0, 0, 1678, 1679, 5, 4, 0, 0, 1679, 109, 1, 0, 0, 0, 1680, 1682, + 3, 50, 25, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1683, + 1, 0, 0, 0, 1683, 1686, 5, 144, 0, 0, 1684, 1685, 5, 110, 0, 0, 1685, 1687, + 7, 8, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, + 1, 0, 0, 0, 1688, 1689, 3, 112, 56, 0, 1689, 1692, 5, 133, 0, 0, 1690, + 1693, 3, 190, 95, 0, 1691, 1693, 3, 108, 54, 0, 1692, 1690, 1, 0, 0, 0, + 1692, 1691, 1, 0, 0, 0, 1693, 1694, 1, 0, 0, 0, 1694, 1695, 5, 6, 0, 0, + 1695, 1706, 3, 68, 34, 0, 1696, 1699, 5, 5, 0, 0, 1697, 1700, 3, 190, 95, + 0, 1698, 1700, 3, 108, 54, 0, 1699, 1697, 1, 0, 0, 0, 1699, 1698, 1, 0, + 0, 0, 1700, 1701, 1, 0, 0, 0, 1701, 1702, 5, 6, 0, 0, 1702, 1703, 3, 68, + 34, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1696, 1, 0, 0, 0, 1705, 1708, 1, 0, + 0, 0, 1706, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1711, 1, 0, + 0, 0, 1708, 1706, 1, 0, 0, 0, 1709, 1710, 5, 151, 0, 0, 1710, 1712, 3, + 68, 34, 0, 1711, 1709, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1717, + 1, 0, 0, 0, 1713, 1715, 3, 134, 67, 0, 1714, 1713, 1, 0, 0, 0, 1714, 1715, + 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 1718, 3, 136, 68, 0, 1717, 1714, + 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 111, 1, 0, 0, 0, 1719, 1720, + 3, 182, 91, 0, 1720, 1721, 5, 2, 0, 0, 1721, 1723, 1, 0, 0, 0, 1722, 1719, + 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1724, 1, 0, 0, 0, 1724, 1727, + 3, 184, 92, 0, 1725, 1726, 5, 35, 0, 0, 1726, 1728, 3, 216, 108, 0, 1727, + 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1734, 1, 0, 0, 0, 1729, + 1730, 5, 87, 0, 0, 1730, 1731, 5, 42, 0, 0, 1731, 1735, 3, 196, 98, 0, + 1732, 1733, 5, 104, 0, 0, 1733, 1735, 5, 87, 0, 0, 1734, 1729, 1, 0, 0, + 0, 1734, 1732, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 113, 1, 0, 0, + 0, 1736, 1738, 5, 146, 0, 0, 1737, 1739, 3, 182, 91, 0, 1738, 1737, 1, + 0, 0, 0, 1738, 1739, 1, 0, 0, 0, 1739, 1742, 1, 0, 0, 0, 1740, 1741, 5, + 93, 0, 0, 1741, 1743, 3, 218, 109, 0, 1742, 1740, 1, 0, 0, 0, 1742, 1743, + 1, 0, 0, 0, 1743, 115, 1, 0, 0, 0, 1744, 1745, 5, 181, 0, 0, 1745, 1746, + 5, 3, 0, 0, 1746, 1747, 5, 151, 0, 0, 1747, 1748, 3, 68, 34, 0, 1748, 1749, + 5, 4, 0, 0, 1749, 117, 1, 0, 0, 0, 1750, 1752, 5, 3, 0, 0, 1751, 1753, + 3, 220, 110, 0, 1752, 1751, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 1764, + 1, 0, 0, 0, 1754, 1755, 5, 156, 0, 0, 1755, 1756, 5, 42, 0, 0, 1756, 1761, + 3, 68, 34, 0, 1757, 1758, 5, 5, 0, 0, 1758, 1760, 3, 68, 34, 0, 1759, 1757, + 1, 0, 0, 0, 1760, 1763, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1761, 1762, + 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1764, 1754, + 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 1, 0, 0, 0, 1766, 1767, + 5, 111, 0, 0, 1767, 1768, 5, 42, 0, 0, 1768, 1773, 3, 138, 69, 0, 1769, + 1770, 5, 5, 0, 0, 1770, 1772, 3, 138, 69, 0, 1771, 1769, 1, 0, 0, 0, 1772, + 1775, 1, 0, 0, 0, 1773, 1771, 1, 0, 0, 0, 1773, 1774, 1, 0, 0, 0, 1774, + 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1776, 1778, 3, 122, 61, 0, 1777, + 1776, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 1, 0, 0, 0, 1779, + 1780, 5, 4, 0, 0, 1780, 119, 1, 0, 0, 0, 1781, 1815, 5, 155, 0, 0, 1782, + 1816, 3, 214, 107, 0, 1783, 1785, 5, 3, 0, 0, 1784, 1786, 3, 220, 110, + 0, 1785, 1784, 1, 0, 0, 0, 1785, 1786, 1, 0, 0, 0, 1786, 1797, 1, 0, 0, + 0, 1787, 1788, 5, 156, 0, 0, 1788, 1789, 5, 42, 0, 0, 1789, 1794, 3, 68, + 34, 0, 1790, 1791, 5, 5, 0, 0, 1791, 1793, 3, 68, 34, 0, 1792, 1790, 1, + 0, 0, 0, 1793, 1796, 1, 0, 0, 0, 1794, 1792, 1, 0, 0, 0, 1794, 1795, 1, + 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1797, 1787, 1, + 0, 0, 0, 1797, 1798, 1, 0, 0, 0, 1798, 1809, 1, 0, 0, 0, 1799, 1800, 5, + 111, 0, 0, 1800, 1801, 5, 42, 0, 0, 1801, 1806, 3, 138, 69, 0, 1802, 1803, + 5, 5, 0, 0, 1803, 1805, 3, 138, 69, 0, 1804, 1802, 1, 0, 0, 0, 1805, 1808, + 1, 0, 0, 0, 1806, 1804, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1810, + 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1809, 1799, 1, 0, 0, 0, 1809, 1810, + 1, 0, 0, 0, 1810, 1812, 1, 0, 0, 0, 1811, 1813, 3, 122, 61, 0, 1812, 1811, + 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1814, 1, 0, 0, 0, 1814, 1816, + 5, 4, 0, 0, 1815, 1782, 1, 0, 0, 0, 1815, 1783, 1, 0, 0, 0, 1816, 121, + 1, 0, 0, 0, 1817, 1825, 3, 124, 62, 0, 1818, 1819, 5, 183, 0, 0, 1819, + 1820, 5, 103, 0, 0, 1820, 1826, 5, 185, 0, 0, 1821, 1822, 5, 160, 0, 0, + 1822, 1826, 5, 129, 0, 0, 1823, 1826, 5, 80, 0, 0, 1824, 1826, 5, 184, + 0, 0, 1825, 1818, 1, 0, 0, 0, 1825, 1821, 1, 0, 0, 0, 1825, 1823, 1, 0, + 0, 0, 1825, 1824, 1, 0, 0, 0, 1825, 1826, 1, 0, 0, 0, 1826, 123, 1, 0, + 0, 0, 1827, 1834, 7, 19, 0, 0, 1828, 1835, 3, 146, 73, 0, 1829, 1830, 5, + 41, 0, 0, 1830, 1831, 3, 142, 71, 0, 1831, 1832, 5, 34, 0, 0, 1832, 1833, + 3, 144, 72, 0, 1833, 1835, 1, 0, 0, 0, 1834, 1828, 1, 0, 0, 0, 1834, 1829, + 1, 0, 0, 0, 1835, 125, 1, 0, 0, 0, 1836, 1837, 3, 222, 111, 0, 1837, 1847, + 5, 3, 0, 0, 1838, 1843, 3, 68, 34, 0, 1839, 1840, 5, 5, 0, 0, 1840, 1842, + 3, 68, 34, 0, 1841, 1839, 1, 0, 0, 0, 1842, 1845, 1, 0, 0, 0, 1843, 1841, + 1, 0, 0, 0, 1843, 1844, 1, 0, 0, 0, 1844, 1848, 1, 0, 0, 0, 1845, 1843, + 1, 0, 0, 0, 1846, 1848, 5, 7, 0, 0, 1847, 1838, 1, 0, 0, 0, 1847, 1846, + 1, 0, 0, 0, 1848, 1849, 1, 0, 0, 0, 1849, 1850, 5, 4, 0, 0, 1850, 127, + 1, 0, 0, 0, 1851, 1852, 3, 224, 112, 0, 1852, 1865, 5, 3, 0, 0, 1853, 1855, + 5, 64, 0, 0, 1854, 1853, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1856, + 1, 0, 0, 0, 1856, 1861, 3, 68, 34, 0, 1857, 1858, 5, 5, 0, 0, 1858, 1860, + 3, 68, 34, 0, 1859, 1857, 1, 0, 0, 0, 1860, 1863, 1, 0, 0, 0, 1861, 1859, + 1, 0, 0, 0, 1861, 1862, 1, 0, 0, 0, 1862, 1866, 1, 0, 0, 0, 1863, 1861, + 1, 0, 0, 0, 1864, 1866, 5, 7, 0, 0, 1865, 1854, 1, 0, 0, 0, 1865, 1864, + 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, 1869, + 5, 4, 0, 0, 1868, 1870, 3, 116, 58, 0, 1869, 1868, 1, 0, 0, 0, 1869, 1870, + 1, 0, 0, 0, 1870, 129, 1, 0, 0, 0, 1871, 1872, 3, 148, 74, 0, 1872, 1882, + 5, 3, 0, 0, 1873, 1878, 3, 68, 34, 0, 1874, 1875, 5, 5, 0, 0, 1875, 1877, + 3, 68, 34, 0, 1876, 1874, 1, 0, 0, 0, 1877, 1880, 1, 0, 0, 0, 1878, 1876, + 1, 0, 0, 0, 1878, 1879, 1, 0, 0, 0, 1879, 1883, 1, 0, 0, 0, 1880, 1878, + 1, 0, 0, 0, 1881, 1883, 5, 7, 0, 0, 1882, 1873, 1, 0, 0, 0, 1882, 1881, + 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1886, + 5, 4, 0, 0, 1885, 1887, 3, 116, 58, 0, 1886, 1885, 1, 0, 0, 0, 1886, 1887, + 1, 0, 0, 0, 1887, 1888, 1, 0, 0, 0, 1888, 1891, 5, 155, 0, 0, 1889, 1892, + 3, 118, 59, 0, 1890, 1892, 3, 214, 107, 0, 1891, 1889, 1, 0, 0, 0, 1891, + 1890, 1, 0, 0, 0, 1892, 131, 1, 0, 0, 0, 1893, 1895, 5, 152, 0, 0, 1894, + 1896, 5, 118, 0, 0, 1895, 1894, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, + 1897, 1, 0, 0, 0, 1897, 1902, 3, 56, 28, 0, 1898, 1899, 5, 5, 0, 0, 1899, + 1901, 3, 56, 28, 0, 1900, 1898, 1, 0, 0, 0, 1901, 1904, 1, 0, 0, 0, 1902, + 1900, 1, 0, 0, 0, 1902, 1903, 1, 0, 0, 0, 1903, 133, 1, 0, 0, 0, 1904, + 1902, 1, 0, 0, 0, 1905, 1906, 5, 111, 0, 0, 1906, 1907, 5, 42, 0, 0, 1907, + 1912, 3, 138, 69, 0, 1908, 1909, 5, 5, 0, 0, 1909, 1911, 3, 138, 69, 0, + 1910, 1908, 1, 0, 0, 0, 1911, 1914, 1, 0, 0, 0, 1912, 1910, 1, 0, 0, 0, + 1912, 1913, 1, 0, 0, 0, 1913, 135, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, + 1915, 1916, 5, 100, 0, 0, 1916, 1919, 3, 68, 34, 0, 1917, 1918, 7, 20, + 0, 0, 1918, 1920, 3, 68, 34, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1920, 1, + 0, 0, 0, 1920, 137, 1, 0, 0, 0, 1921, 1924, 3, 68, 34, 0, 1922, 1923, 5, + 47, 0, 0, 1923, 1925, 3, 192, 96, 0, 1924, 1922, 1, 0, 0, 0, 1924, 1925, + 1, 0, 0, 0, 1925, 1927, 1, 0, 0, 0, 1926, 1928, 3, 140, 70, 0, 1927, 1926, + 1, 0, 0, 0, 1927, 1928, 1, 0, 0, 0, 1928, 1931, 1, 0, 0, 0, 1929, 1930, + 5, 178, 0, 0, 1930, 1932, 7, 21, 0, 0, 1931, 1929, 1, 0, 0, 0, 1931, 1932, + 1, 0, 0, 0, 1932, 139, 1, 0, 0, 0, 1933, 1934, 7, 22, 0, 0, 1934, 141, + 1, 0, 0, 0, 1935, 1936, 3, 68, 34, 0, 1936, 1937, 5, 158, 0, 0, 1937, 1946, + 1, 0, 0, 0, 1938, 1939, 3, 68, 34, 0, 1939, 1940, 5, 161, 0, 0, 1940, 1946, + 1, 0, 0, 0, 1941, 1942, 5, 160, 0, 0, 1942, 1946, 5, 129, 0, 0, 1943, 1944, + 5, 159, 0, 0, 1944, 1946, 5, 158, 0, 0, 1945, 1935, 1, 0, 0, 0, 1945, 1938, + 1, 0, 0, 0, 1945, 1941, 1, 0, 0, 0, 1945, 1943, 1, 0, 0, 0, 1946, 143, + 1, 0, 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 158, 0, 0, 1949, 1958, + 1, 0, 0, 0, 1950, 1951, 3, 68, 34, 0, 1951, 1952, 5, 161, 0, 0, 1952, 1958, + 1, 0, 0, 0, 1953, 1954, 5, 160, 0, 0, 1954, 1958, 5, 129, 0, 0, 1955, 1956, + 5, 159, 0, 0, 1956, 1958, 5, 161, 0, 0, 1957, 1947, 1, 0, 0, 0, 1957, 1950, + 1, 0, 0, 0, 1957, 1953, 1, 0, 0, 0, 1957, 1955, 1, 0, 0, 0, 1958, 145, + 1, 0, 0, 0, 1959, 1960, 3, 68, 34, 0, 1960, 1961, 5, 158, 0, 0, 1961, 1967, + 1, 0, 0, 0, 1962, 1963, 5, 159, 0, 0, 1963, 1967, 5, 158, 0, 0, 1964, 1965, + 5, 160, 0, 0, 1965, 1967, 5, 129, 0, 0, 1966, 1959, 1, 0, 0, 0, 1966, 1962, + 1, 0, 0, 0, 1966, 1964, 1, 0, 0, 0, 1967, 147, 1, 0, 0, 0, 1968, 1969, + 7, 23, 0, 0, 1969, 1970, 5, 3, 0, 0, 1970, 1971, 3, 68, 34, 0, 1971, 1972, + 5, 4, 0, 0, 1972, 1973, 5, 155, 0, 0, 1973, 1975, 5, 3, 0, 0, 1974, 1976, + 3, 154, 77, 0, 1975, 1974, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1977, + 1, 0, 0, 0, 1977, 1979, 3, 158, 79, 0, 1978, 1980, 3, 124, 62, 0, 1979, + 1978, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 1, 0, 0, 0, 1981, + 1982, 5, 4, 0, 0, 1982, 2054, 1, 0, 0, 0, 1983, 1984, 7, 24, 0, 0, 1984, + 1985, 5, 3, 0, 0, 1985, 1986, 5, 4, 0, 0, 1986, 1987, 5, 155, 0, 0, 1987, + 1989, 5, 3, 0, 0, 1988, 1990, 3, 154, 77, 0, 1989, 1988, 1, 0, 0, 0, 1989, + 1990, 1, 0, 0, 0, 1990, 1992, 1, 0, 0, 0, 1991, 1993, 3, 156, 78, 0, 1992, + 1991, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 1994, 1, 0, 0, 0, 1994, + 2054, 5, 4, 0, 0, 1995, 1996, 7, 25, 0, 0, 1996, 1997, 5, 3, 0, 0, 1997, + 1998, 5, 4, 0, 0, 1998, 1999, 5, 155, 0, 0, 1999, 2001, 5, 3, 0, 0, 2000, + 2002, 3, 154, 77, 0, 2001, 2000, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, + 2003, 1, 0, 0, 0, 2003, 2004, 3, 158, 79, 0, 2004, 2005, 5, 4, 0, 0, 2005, + 2054, 1, 0, 0, 0, 2006, 2007, 7, 26, 0, 0, 2007, 2008, 5, 3, 0, 0, 2008, + 2010, 3, 68, 34, 0, 2009, 2011, 3, 150, 75, 0, 2010, 2009, 1, 0, 0, 0, + 2010, 2011, 1, 0, 0, 0, 2011, 2013, 1, 0, 0, 0, 2012, 2014, 3, 152, 76, + 0, 2013, 2012, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 1, 0, 0, + 0, 2015, 2016, 5, 4, 0, 0, 2016, 2017, 5, 155, 0, 0, 2017, 2019, 5, 3, + 0, 0, 2018, 2020, 3, 154, 77, 0, 2019, 2018, 1, 0, 0, 0, 2019, 2020, 1, + 0, 0, 0, 2020, 2021, 1, 0, 0, 0, 2021, 2022, 3, 158, 79, 0, 2022, 2023, + 5, 4, 0, 0, 2023, 2054, 1, 0, 0, 0, 2024, 2025, 5, 167, 0, 0, 2025, 2026, + 5, 3, 0, 0, 2026, 2027, 3, 68, 34, 0, 2027, 2028, 5, 5, 0, 0, 2028, 2029, + 3, 36, 18, 0, 2029, 2030, 5, 4, 0, 0, 2030, 2031, 5, 155, 0, 0, 2031, 2033, + 5, 3, 0, 0, 2032, 2034, 3, 154, 77, 0, 2033, 2032, 1, 0, 0, 0, 2033, 2034, + 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2037, 3, 158, 79, 0, 2036, 2038, + 3, 124, 62, 0, 2037, 2036, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, + 1, 0, 0, 0, 2039, 2040, 5, 4, 0, 0, 2040, 2054, 1, 0, 0, 0, 2041, 2042, + 5, 168, 0, 0, 2042, 2043, 5, 3, 0, 0, 2043, 2044, 3, 68, 34, 0, 2044, 2045, + 5, 4, 0, 0, 2045, 2046, 5, 155, 0, 0, 2046, 2048, 5, 3, 0, 0, 2047, 2049, + 3, 154, 77, 0, 2048, 2047, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, + 1, 0, 0, 0, 2050, 2051, 3, 158, 79, 0, 2051, 2052, 5, 4, 0, 0, 2052, 2054, + 1, 0, 0, 0, 2053, 1968, 1, 0, 0, 0, 2053, 1983, 1, 0, 0, 0, 2053, 1995, + 1, 0, 0, 0, 2053, 2006, 1, 0, 0, 0, 2053, 2024, 1, 0, 0, 0, 2053, 2041, + 1, 0, 0, 0, 2054, 149, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, + 3, 36, 18, 0, 2057, 151, 1, 0, 0, 0, 2058, 2059, 5, 5, 0, 0, 2059, 2060, + 3, 36, 18, 0, 2060, 153, 1, 0, 0, 0, 2061, 2062, 5, 156, 0, 0, 2062, 2064, + 5, 42, 0, 0, 2063, 2065, 3, 68, 34, 0, 2064, 2063, 1, 0, 0, 0, 2065, 2066, + 1, 0, 0, 0, 2066, 2064, 1, 0, 0, 0, 2066, 2067, 1, 0, 0, 0, 2067, 155, + 1, 0, 0, 0, 2068, 2069, 5, 111, 0, 0, 2069, 2071, 5, 42, 0, 0, 2070, 2072, + 3, 68, 34, 0, 2071, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 2071, + 1, 0, 0, 0, 2073, 2074, 1, 0, 0, 0, 2074, 157, 1, 0, 0, 0, 2075, 2076, + 5, 111, 0, 0, 2076, 2077, 5, 42, 0, 0, 2077, 2078, 3, 158, 79, 0, 2078, + 159, 1, 0, 0, 0, 2079, 2081, 3, 68, 34, 0, 2080, 2082, 3, 140, 70, 0, 2081, + 2080, 1, 0, 0, 0, 2081, 2082, 1, 0, 0, 0, 2082, 2090, 1, 0, 0, 0, 2083, + 2084, 5, 5, 0, 0, 2084, 2086, 3, 68, 34, 0, 2085, 2087, 3, 140, 70, 0, + 2086, 2085, 1, 0, 0, 0, 2086, 2087, 1, 0, 0, 0, 2087, 2089, 1, 0, 0, 0, + 2088, 2083, 1, 0, 0, 0, 2089, 2092, 1, 0, 0, 0, 2090, 2088, 1, 0, 0, 0, + 2090, 2091, 1, 0, 0, 0, 2091, 161, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, + 2093, 2094, 3, 84, 42, 0, 2094, 163, 1, 0, 0, 0, 2095, 2096, 3, 84, 42, + 0, 2096, 165, 1, 0, 0, 0, 2097, 2098, 7, 27, 0, 0, 2098, 167, 1, 0, 0, + 0, 2099, 2100, 5, 192, 0, 0, 2100, 169, 1, 0, 0, 0, 2101, 2104, 3, 68, + 34, 0, 2102, 2104, 3, 30, 15, 0, 2103, 2101, 1, 0, 0, 0, 2103, 2102, 1, + 0, 0, 0, 2104, 171, 1, 0, 0, 0, 2105, 2106, 7, 28, 0, 0, 2106, 173, 1, + 0, 0, 0, 2107, 2108, 7, 29, 0, 0, 2108, 175, 1, 0, 0, 0, 2109, 2110, 3, + 228, 114, 0, 2110, 177, 1, 0, 0, 0, 2111, 2112, 3, 228, 114, 0, 2112, 179, + 1, 0, 0, 0, 2113, 2114, 3, 182, 91, 0, 2114, 2115, 5, 2, 0, 0, 2115, 2117, + 1, 0, 0, 0, 2116, 2113, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, + 1, 0, 0, 0, 2118, 2119, 3, 178, 89, 0, 2119, 181, 1, 0, 0, 0, 2120, 2121, + 3, 228, 114, 0, 2121, 183, 1, 0, 0, 0, 2122, 2123, 3, 228, 114, 0, 2123, + 185, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, 187, 1, 0, 0, 0, 2126, + 2127, 3, 228, 114, 0, 2127, 189, 1, 0, 0, 0, 2128, 2129, 3, 228, 114, 0, + 2129, 191, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, 2131, 193, 1, 0, 0, + 0, 2132, 2133, 3, 228, 114, 0, 2133, 195, 1, 0, 0, 0, 2134, 2135, 3, 228, + 114, 0, 2135, 197, 1, 0, 0, 0, 2136, 2137, 3, 228, 114, 0, 2137, 199, 1, + 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 201, 1, 0, 0, 0, 2140, 2141, + 3, 228, 114, 0, 2141, 203, 1, 0, 0, 0, 2142, 2143, 3, 228, 114, 0, 2143, + 205, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, 207, 1, 0, 0, 0, 2146, + 2147, 7, 28, 0, 0, 2147, 209, 1, 0, 0, 0, 2148, 2149, 3, 228, 114, 0, 2149, + 211, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, 213, 1, 0, 0, 0, 2152, + 2153, 3, 228, 114, 0, 2153, 215, 1, 0, 0, 0, 2154, 2155, 3, 228, 114, 0, + 2155, 217, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, 2157, 219, 1, 0, 0, + 0, 2158, 2159, 3, 228, 114, 0, 2159, 221, 1, 0, 0, 0, 2160, 2161, 3, 228, + 114, 0, 2161, 223, 1, 0, 0, 0, 2162, 2163, 3, 228, 114, 0, 2163, 225, 1, + 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 227, 1, 0, 0, 0, 2166, 2174, + 5, 188, 0, 0, 2167, 2174, 3, 174, 87, 0, 2168, 2174, 5, 192, 0, 0, 2169, + 2170, 5, 3, 0, 0, 2170, 2171, 3, 228, 114, 0, 2171, 2172, 5, 4, 0, 0, 2172, + 2174, 1, 0, 0, 0, 2173, 2166, 1, 0, 0, 0, 2173, 2167, 1, 0, 0, 0, 2173, + 2168, 1, 0, 0, 0, 2173, 2169, 1, 0, 0, 0, 2174, 229, 1, 0, 0, 0, 313, 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, 1034, 1041, 1052, 1061, + 1071, 1074, 1080, 1086, 1095, 1098, 1102, 1109, 1115, 1122, 1124, 1126, + 1135, 1142, 1149, 1155, 1160, 1168, 1173, 1182, 1193, 1200, 1206, 1209, + 1212, 1222, 1228, 1230, 1238, 1245, 1252, 1257, 1259, 1265, 1274, 1279, + 1286, 1290, 1292, 1295, 1303, 1307, 1310, 1319, 1324, 1331, 1340, 1344, + 1346, 1350, 1359, 1364, 1366, 1379, 1382, 1391, 1402, 1409, 1412, 1417, + 1421, 1424, 1427, 1432, 1436, 1441, 1444, 1447, 1452, 1456, 1459, 1466, + 1471, 1480, 1485, 1488, 1496, 1500, 1508, 1511, 1516, 1520, 1523, 1530, + 1535, 1544, 1549, 1552, 1560, 1564, 1572, 1575, 1577, 1586, 1589, 1591, + 1595, 1599, 1602, 1607, 1618, 1623, 1627, 1631, 1634, 1639, 1645, 1652, + 1659, 1664, 1667, 1675, 1681, 1686, 1692, 1699, 1706, 1711, 1714, 1717, + 1722, 1727, 1734, 1738, 1742, 1752, 1761, 1764, 1773, 1777, 1785, 1794, + 1797, 1806, 1809, 1812, 1815, 1825, 1834, 1843, 1847, 1854, 1861, 1865, + 1869, 1878, 1882, 1886, 1891, 1895, 1902, 1912, 1919, 1924, 1927, 1931, + 1945, 1957, 1966, 1975, 1979, 1989, 1992, 2001, 2010, 2013, 2019, 2033, + 2037, 2048, 2053, 2066, 2073, 2081, 2086, 2090, 2103, 2116, 2173, + } + 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) - - this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache()) - this.RuleNames = ruleNames - this.LiteralNames = literalNames - this.SymbolicNames = symbolicNames - this.GrammarFileName = "SQLite.g4" + 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 - SQLiteParserK_ABORT = 25 - SQLiteParserK_ACTION = 26 - SQLiteParserK_ADD = 27 - SQLiteParserK_AFTER = 28 - SQLiteParserK_ALL = 29 - SQLiteParserK_ALTER = 30 - SQLiteParserK_ANALYZE = 31 - SQLiteParserK_AND = 32 - SQLiteParserK_AS = 33 - SQLiteParserK_ASC = 34 - SQLiteParserK_ATTACH = 35 - SQLiteParserK_AUTOINCREMENT = 36 - SQLiteParserK_BEFORE = 37 - SQLiteParserK_BEGIN = 38 - SQLiteParserK_BETWEEN = 39 - SQLiteParserK_BY = 40 - SQLiteParserK_CASCADE = 41 - SQLiteParserK_CASE = 42 - SQLiteParserK_CAST = 43 - SQLiteParserK_CHECK = 44 - SQLiteParserK_COLLATE = 45 - SQLiteParserK_COLUMN = 46 - SQLiteParserK_COMMIT = 47 - SQLiteParserK_CONFLICT = 48 - SQLiteParserK_CONSTRAINT = 49 - SQLiteParserK_CREATE = 50 - SQLiteParserK_CROSS = 51 - SQLiteParserK_CURRENT_DATE = 52 - SQLiteParserK_CURRENT_TIME = 53 - SQLiteParserK_CURRENT_TIMESTAMP = 54 - SQLiteParserK_DATABASE = 55 - SQLiteParserK_DEFAULT = 56 - SQLiteParserK_DEFERRABLE = 57 - SQLiteParserK_DEFERRED = 58 - SQLiteParserK_DELETE = 59 - SQLiteParserK_DESC = 60 - SQLiteParserK_DETACH = 61 - SQLiteParserK_DISTINCT = 62 - SQLiteParserK_DROP = 63 - SQLiteParserK_EACH = 64 - SQLiteParserK_ELSE = 65 - SQLiteParserK_END = 66 - SQLiteParserK_ESCAPE = 67 - SQLiteParserK_EXCEPT = 68 - SQLiteParserK_EXCLUSIVE = 69 - SQLiteParserK_EXISTS = 70 - SQLiteParserK_EXPLAIN = 71 - SQLiteParserK_FAIL = 72 - SQLiteParserK_FOR = 73 - SQLiteParserK_FOREIGN = 74 - SQLiteParserK_FROM = 75 - SQLiteParserK_FULL = 76 - SQLiteParserK_GLOB = 77 - SQLiteParserK_GROUP = 78 - SQLiteParserK_HAVING = 79 - SQLiteParserK_IF = 80 - SQLiteParserK_IGNORE = 81 - SQLiteParserK_IMMEDIATE = 82 - SQLiteParserK_IN = 83 - SQLiteParserK_INDEX = 84 - SQLiteParserK_INDEXED = 85 - SQLiteParserK_INITIALLY = 86 - SQLiteParserK_INNER = 87 - SQLiteParserK_INSERT = 88 - SQLiteParserK_INSTEAD = 89 - SQLiteParserK_INTERSECT = 90 - SQLiteParserK_INTO = 91 - SQLiteParserK_IS = 92 - SQLiteParserK_ISNULL = 93 - SQLiteParserK_JOIN = 94 - SQLiteParserK_KEY = 95 - SQLiteParserK_LEFT = 96 - SQLiteParserK_LIKE = 97 - SQLiteParserK_LIMIT = 98 - SQLiteParserK_MATCH = 99 - SQLiteParserK_NATURAL = 100 - SQLiteParserK_NO = 101 - SQLiteParserK_NOT = 102 - SQLiteParserK_NOTNULL = 103 - SQLiteParserK_NULL = 104 - SQLiteParserK_OF = 105 - SQLiteParserK_OFFSET = 106 - SQLiteParserK_ON = 107 - SQLiteParserK_OR = 108 - SQLiteParserK_ORDER = 109 - SQLiteParserK_OUTER = 110 - SQLiteParserK_PLAN = 111 - SQLiteParserK_PRAGMA = 112 - SQLiteParserK_PRIMARY = 113 - SQLiteParserK_QUERY = 114 - SQLiteParserK_RAISE = 115 - SQLiteParserK_RECURSIVE = 116 - SQLiteParserK_REFERENCES = 117 - SQLiteParserK_REGEXP = 118 - SQLiteParserK_REINDEX = 119 - SQLiteParserK_RELEASE = 120 - SQLiteParserK_RENAME = 121 - SQLiteParserK_REPLACE = 122 - SQLiteParserK_RESTRICT = 123 - SQLiteParserK_RIGHT = 124 - SQLiteParserK_ROLLBACK = 125 - SQLiteParserK_ROW = 126 - SQLiteParserK_SAVEPOINT = 127 - SQLiteParserK_SELECT = 128 - SQLiteParserK_SET = 129 - SQLiteParserK_TABLE = 130 - SQLiteParserK_TEMP = 131 - SQLiteParserK_TEMPORARY = 132 - SQLiteParserK_THEN = 133 - SQLiteParserK_TO = 134 - SQLiteParserK_TRANSACTION = 135 - SQLiteParserK_TRIGGER = 136 - SQLiteParserK_UNION = 137 - SQLiteParserK_UNIQUE = 138 - SQLiteParserK_UPDATE = 139 - SQLiteParserK_USING = 140 - SQLiteParserK_VACUUM = 141 - SQLiteParserK_VALUES = 142 - SQLiteParserK_VIEW = 143 - SQLiteParserK_VIRTUAL = 144 - SQLiteParserK_WHEN = 145 - SQLiteParserK_WHERE = 146 - SQLiteParserK_WITH = 147 - SQLiteParserK_WITHOUT = 148 - SQLiteParserIDENTIFIER = 149 - SQLiteParserNUMERIC_LITERAL = 150 - SQLiteParserBIND_PARAMETER = 151 - SQLiteParserSTRING_LITERAL = 152 - SQLiteParserBLOB_LITERAL = 153 - SQLiteParserSINGLE_LINE_COMMENT = 154 - SQLiteParserMULTILINE_COMMENT = 155 - SQLiteParserSPACES = 156 - SQLiteParserUNEXPECTED_CHAR = 157 + SQLiteParserEOF = antlr.TokenEOF + SQLiteParserSCOL = 1 + SQLiteParserDOT = 2 + SQLiteParserOPEN_PAR = 3 + SQLiteParserCLOSE_PAR = 4 + SQLiteParserCOMMA = 5 + SQLiteParserASSIGN = 6 + SQLiteParserSTAR = 7 + SQLiteParserPLUS = 8 + SQLiteParserPTR2 = 9 + SQLiteParserPTR = 10 + SQLiteParserMINUS = 11 + SQLiteParserTILDE = 12 + SQLiteParserPIPE2 = 13 + SQLiteParserDIV = 14 + SQLiteParserMOD = 15 + SQLiteParserLT2 = 16 + SQLiteParserGT2 = 17 + SQLiteParserAMP = 18 + SQLiteParserPIPE = 19 + SQLiteParserLT = 20 + SQLiteParserLT_EQ = 21 + SQLiteParserGT = 22 + SQLiteParserGT_EQ = 23 + SQLiteParserEQ = 24 + SQLiteParserNOT_EQ1 = 25 + SQLiteParserNOT_EQ2 = 26 + SQLiteParserABORT_ = 27 + SQLiteParserACTION_ = 28 + SQLiteParserADD_ = 29 + SQLiteParserAFTER_ = 30 + SQLiteParserALL_ = 31 + SQLiteParserALTER_ = 32 + SQLiteParserANALYZE_ = 33 + SQLiteParserAND_ = 34 + SQLiteParserAS_ = 35 + SQLiteParserASC_ = 36 + SQLiteParserATTACH_ = 37 + SQLiteParserAUTOINCREMENT_ = 38 + SQLiteParserBEFORE_ = 39 + SQLiteParserBEGIN_ = 40 + SQLiteParserBETWEEN_ = 41 + SQLiteParserBY_ = 42 + SQLiteParserCASCADE_ = 43 + SQLiteParserCASE_ = 44 + SQLiteParserCAST_ = 45 + SQLiteParserCHECK_ = 46 + SQLiteParserCOLLATE_ = 47 + SQLiteParserCOLUMN_ = 48 + SQLiteParserCOMMIT_ = 49 + SQLiteParserCONFLICT_ = 50 + SQLiteParserCONSTRAINT_ = 51 + SQLiteParserCREATE_ = 52 + SQLiteParserCROSS_ = 53 + SQLiteParserCURRENT_DATE_ = 54 + SQLiteParserCURRENT_TIME_ = 55 + SQLiteParserCURRENT_TIMESTAMP_ = 56 + SQLiteParserDATABASE_ = 57 + SQLiteParserDEFAULT_ = 58 + SQLiteParserDEFERRABLE_ = 59 + SQLiteParserDEFERRED_ = 60 + SQLiteParserDELETE_ = 61 + SQLiteParserDESC_ = 62 + SQLiteParserDETACH_ = 63 + SQLiteParserDISTINCT_ = 64 + SQLiteParserDROP_ = 65 + SQLiteParserEACH_ = 66 + SQLiteParserELSE_ = 67 + SQLiteParserEND_ = 68 + SQLiteParserESCAPE_ = 69 + SQLiteParserEXCEPT_ = 70 + SQLiteParserEXCLUSIVE_ = 71 + SQLiteParserEXISTS_ = 72 + SQLiteParserEXPLAIN_ = 73 + SQLiteParserFAIL_ = 74 + SQLiteParserFOR_ = 75 + SQLiteParserFOREIGN_ = 76 + SQLiteParserFROM_ = 77 + SQLiteParserFULL_ = 78 + SQLiteParserGLOB_ = 79 + SQLiteParserGROUP_ = 80 + SQLiteParserHAVING_ = 81 + SQLiteParserIF_ = 82 + SQLiteParserIGNORE_ = 83 + SQLiteParserIMMEDIATE_ = 84 + SQLiteParserIN_ = 85 + SQLiteParserINDEX_ = 86 + SQLiteParserINDEXED_ = 87 + SQLiteParserINITIALLY_ = 88 + SQLiteParserINNER_ = 89 + SQLiteParserINSERT_ = 90 + SQLiteParserINSTEAD_ = 91 + SQLiteParserINTERSECT_ = 92 + SQLiteParserINTO_ = 93 + SQLiteParserIS_ = 94 + SQLiteParserISNULL_ = 95 + SQLiteParserJOIN_ = 96 + SQLiteParserKEY_ = 97 + SQLiteParserLEFT_ = 98 + SQLiteParserLIKE_ = 99 + SQLiteParserLIMIT_ = 100 + SQLiteParserMATCH_ = 101 + SQLiteParserNATURAL_ = 102 + SQLiteParserNO_ = 103 + SQLiteParserNOT_ = 104 + SQLiteParserNOTNULL_ = 105 + SQLiteParserNULL_ = 106 + SQLiteParserOF_ = 107 + SQLiteParserOFFSET_ = 108 + SQLiteParserON_ = 109 + SQLiteParserOR_ = 110 + SQLiteParserORDER_ = 111 + SQLiteParserOUTER_ = 112 + SQLiteParserPLAN_ = 113 + SQLiteParserPRAGMA_ = 114 + SQLiteParserPRIMARY_ = 115 + SQLiteParserQUERY_ = 116 + SQLiteParserRAISE_ = 117 + SQLiteParserRECURSIVE_ = 118 + SQLiteParserREFERENCES_ = 119 + SQLiteParserREGEXP_ = 120 + SQLiteParserREINDEX_ = 121 + SQLiteParserRELEASE_ = 122 + SQLiteParserRENAME_ = 123 + SQLiteParserREPLACE_ = 124 + SQLiteParserRESTRICT_ = 125 + SQLiteParserRETURNING_ = 126 + SQLiteParserRIGHT_ = 127 + SQLiteParserROLLBACK_ = 128 + SQLiteParserROW_ = 129 + SQLiteParserROWS_ = 130 + SQLiteParserSAVEPOINT_ = 131 + SQLiteParserSELECT_ = 132 + SQLiteParserSET_ = 133 + SQLiteParserSTRICT_ = 134 + SQLiteParserTABLE_ = 135 + SQLiteParserTEMP_ = 136 + SQLiteParserTEMPORARY_ = 137 + SQLiteParserTHEN_ = 138 + SQLiteParserTO_ = 139 + SQLiteParserTRANSACTION_ = 140 + SQLiteParserTRIGGER_ = 141 + SQLiteParserUNION_ = 142 + SQLiteParserUNIQUE_ = 143 + SQLiteParserUPDATE_ = 144 + SQLiteParserUSING_ = 145 + SQLiteParserVACUUM_ = 146 + SQLiteParserVALUES_ = 147 + SQLiteParserVIEW_ = 148 + SQLiteParserVIRTUAL_ = 149 + SQLiteParserWHEN_ = 150 + SQLiteParserWHERE_ = 151 + SQLiteParserWITH_ = 152 + SQLiteParserWITHOUT_ = 153 + SQLiteParserFIRST_VALUE_ = 154 + SQLiteParserOVER_ = 155 + SQLiteParserPARTITION_ = 156 + SQLiteParserRANGE_ = 157 + SQLiteParserPRECEDING_ = 158 + SQLiteParserUNBOUNDED_ = 159 + SQLiteParserCURRENT_ = 160 + SQLiteParserFOLLOWING_ = 161 + SQLiteParserCUME_DIST_ = 162 + SQLiteParserDENSE_RANK_ = 163 + SQLiteParserLAG_ = 164 + SQLiteParserLAST_VALUE_ = 165 + SQLiteParserLEAD_ = 166 + SQLiteParserNTH_VALUE_ = 167 + SQLiteParserNTILE_ = 168 + SQLiteParserPERCENT_RANK_ = 169 + SQLiteParserRANK_ = 170 + SQLiteParserROW_NUMBER_ = 171 + SQLiteParserGENERATED_ = 172 + SQLiteParserALWAYS_ = 173 + SQLiteParserSTORED_ = 174 + SQLiteParserTRUE_ = 175 + SQLiteParserFALSE_ = 176 + SQLiteParserWINDOW_ = 177 + SQLiteParserNULLS_ = 178 + SQLiteParserFIRST_ = 179 + SQLiteParserLAST_ = 180 + SQLiteParserFILTER_ = 181 + SQLiteParserGROUPS_ = 182 + SQLiteParserEXCLUDE_ = 183 + SQLiteParserTIES_ = 184 + SQLiteParserOTHERS_ = 185 + SQLiteParserDO_ = 186 + SQLiteParserNOTHING_ = 187 + SQLiteParserIDENTIFIER = 188 + SQLiteParserNUMERIC_LITERAL = 189 + SQLiteParserNUMBERED_BIND_PARAMETER = 190 + SQLiteParserNAMED_BIND_PARAMETER = 191 + SQLiteParserSTRING_LITERAL = 192 + SQLiteParserBLOB_LITERAL = 193 + SQLiteParserSINGLE_LINE_COMMENT = 194 + SQLiteParserMULTILINE_COMMENT = 195 + SQLiteParserSPACES = 196 + SQLiteParserUNEXPECTED_CHAR = 197 ) // 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_compound_select_stmt = 8 - SQLiteParserRULE_create_index_stmt = 9 - SQLiteParserRULE_create_table_stmt = 10 - SQLiteParserRULE_create_trigger_stmt = 11 - SQLiteParserRULE_create_view_stmt = 12 - SQLiteParserRULE_create_virtual_table_stmt = 13 - SQLiteParserRULE_delete_stmt = 14 - SQLiteParserRULE_delete_stmt_limited = 15 - SQLiteParserRULE_detach_stmt = 16 - SQLiteParserRULE_drop_index_stmt = 17 - SQLiteParserRULE_drop_table_stmt = 18 - SQLiteParserRULE_drop_trigger_stmt = 19 - SQLiteParserRULE_drop_view_stmt = 20 - SQLiteParserRULE_factored_select_stmt = 21 - SQLiteParserRULE_insert_stmt = 22 - SQLiteParserRULE_pragma_stmt = 23 - SQLiteParserRULE_reindex_stmt = 24 - SQLiteParserRULE_release_stmt = 25 - SQLiteParserRULE_rollback_stmt = 26 - SQLiteParserRULE_savepoint_stmt = 27 - SQLiteParserRULE_simple_select_stmt = 28 - SQLiteParserRULE_select_stmt = 29 - SQLiteParserRULE_select_or_values = 30 - SQLiteParserRULE_update_stmt = 31 - SQLiteParserRULE_update_stmt_limited = 32 - SQLiteParserRULE_vacuum_stmt = 33 - SQLiteParserRULE_column_def = 34 - SQLiteParserRULE_type_name = 35 - SQLiteParserRULE_column_constraint = 36 - SQLiteParserRULE_conflict_clause = 37 - SQLiteParserRULE_expr = 38 - SQLiteParserRULE_foreign_key_clause = 39 - SQLiteParserRULE_raise_function = 40 - SQLiteParserRULE_indexed_column = 41 - SQLiteParserRULE_table_constraint = 42 - SQLiteParserRULE_with_clause = 43 - SQLiteParserRULE_qualified_table_name = 44 - SQLiteParserRULE_ordering_term = 45 - SQLiteParserRULE_pragma_value = 46 - SQLiteParserRULE_common_table_expression = 47 - SQLiteParserRULE_result_column = 48 - SQLiteParserRULE_table_or_subquery = 49 - SQLiteParserRULE_join_clause = 50 - SQLiteParserRULE_join_operator = 51 - SQLiteParserRULE_join_constraint = 52 - SQLiteParserRULE_select_core = 53 - SQLiteParserRULE_compound_operator = 54 - SQLiteParserRULE_signed_number = 55 - SQLiteParserRULE_literal_value = 56 - SQLiteParserRULE_unary_operator = 57 - SQLiteParserRULE_error_message = 58 - SQLiteParserRULE_module_argument = 59 - SQLiteParserRULE_column_alias = 60 - SQLiteParserRULE_keyword = 61 - SQLiteParserRULE_name = 62 - SQLiteParserRULE_function_name = 63 - SQLiteParserRULE_database_name = 64 - SQLiteParserRULE_schema_name = 65 - SQLiteParserRULE_table_function_name = 66 - SQLiteParserRULE_table_name = 67 - SQLiteParserRULE_table_or_index_name = 68 - SQLiteParserRULE_new_table_name = 69 - SQLiteParserRULE_column_name = 70 - SQLiteParserRULE_new_column_name = 71 - SQLiteParserRULE_collation_name = 72 - SQLiteParserRULE_foreign_table = 73 - SQLiteParserRULE_index_name = 74 - SQLiteParserRULE_trigger_name = 75 - SQLiteParserRULE_view_name = 76 - SQLiteParserRULE_module_name = 77 - SQLiteParserRULE_pragma_name = 78 - SQLiteParserRULE_savepoint_name = 79 - SQLiteParserRULE_table_alias = 80 - SQLiteParserRULE_transaction_name = 81 - SQLiteParserRULE_any_name = 82 + 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. @@ -1202,28 +1556,38 @@ type IParseContext interface { // 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 + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyParseContext() *ParseContext { var p = new(ParseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_parse return p } +func InitEmptyParseContext(p *ParseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_parse +} + func (*ParseContext) IsParseContext() {} func NewParseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ParseContext { var p = new(ParseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_parse @@ -1238,12 +1602,20 @@ func (s *ParseContext) EOF() antlr.TerminalNode { } func (s *ParseContext) AllSql_stmt_list() []ISql_stmt_listContext { - var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ISql_stmt_listContext)(nil)).Elem()) - var tst = make([]ISql_stmt_listContext, len(ts)) + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISql_stmt_listContext); ok { + len++ + } + } - for i, t := range ts { - if t != nil { + 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++ } } @@ -1251,7 +1623,17 @@ func (s *ParseContext) AllSql_stmt_list() []ISql_stmt_listContext { } func (s *ParseContext) Sql_stmt_list(i int) ISql_stmt_listContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*ISql_stmt_listContext)(nil)).Elem(), i) + 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 @@ -1269,13 +1651,13 @@ func (s *ParseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) } func (s *ParseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteListener); ok { + if listenerT, ok := listener.(SQLiteParserListener); ok { listenerT.EnterParse(s) } } func (s *ParseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteListener); ok { + if listenerT, ok := listener.(SQLiteParserListener); ok { listenerT.ExitParse(s) } } @@ -1285,43 +1667,47 @@ func (p *SQLiteParser) Parse() (localctx IParseContext) { 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(169) + p.SetState(233) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - for (((_la)&-(0x1f+1)) == 0 && ((1< 0 { + return errors.New(stderrBlob) + } + return fmt.Errorf("call: %w", err) +} diff --git a/internal/inflection/singular.go b/internal/inflection/singular.go index cc501764d0..64e042a6ab 100644 --- a/internal/inflection/singular.go +++ b/internal/inflection/singular.go @@ -6,13 +6,47 @@ import ( upstream "github.com/jinzhu/inflection" ) -func Singular(name string) string { +type SingularParams struct { + Name string + Exclusions []string +} + +func Singular(s SingularParams) string { + for _, exclusion := range s.Exclusions { + if strings.EqualFold(s.Name, exclusion) { + return s.Name + } + } + // Manual fix for incorrect handling of "campus" // - // https://github.com/kyleconroy/sqlc/issues/430 + // https://github.com/sqlc-dev/sqlc/issues/430 // https://github.com/jinzhu/inflection/issues/13 - if strings.ToLower(name) == "campus" { - return name + if strings.ToLower(s.Name) == "campus" { + return s.Name + } + // Manual fix for incorrect handling of "meta" + // + // https://github.com/sqlc-dev/sqlc/issues/1217 + // https://github.com/jinzhu/inflection/issues/21 + if strings.ToLower(s.Name) == "meta" { + return s.Name } - return upstream.Singular(name) + // Manual fix for incorrect handling of "calories" + // + // https://github.com/sqlc-dev/sqlc/issues/2017 + // https://github.com/jinzhu/inflection/issues/23 + if strings.ToLower(s.Name) == "calories" { + return "calorie" + } + // Manual fix for incorrect handling of "-ves" suffix + 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 new file mode 100644 index 0000000000..dbae7b84ae --- /dev/null +++ b/internal/info/facts.go @@ -0,0 +1,5 @@ +package info + +// When no version is set, return the next bug fix version +// after the most recent tag +const Version = "v1.30.0" diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index d3b00c507b..8f63624d2c 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -1,23 +1,42 @@ 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 ( CmdExec = ":exec" CmdExecResult = ":execresult" CmdExecRows = ":execrows" + CmdExecLastId = ":execlastid" CmdMany = ":many" CmdOne = ":one" + CmdCopyFrom = ":copyfrom" + CmdBatchExec = ":batchexec" + CmdBatchMany = ":batchmany" + CmdBatchOne = ":batchone" ) // A query name must be a valid Go identifier @@ -39,40 +58,47 @@ func validateQueryName(name string) error { return nil } -func Parse(t string, commentStyle CommentSyntax) (string, string, error) { +func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string, error) { for _, line := range strings.Split(t, "\n") { var prefix string if strings.HasPrefix(line, "--") { if !commentStyle.Dash { continue } - prefix = "-- name:" + prefix = "--" } if strings.HasPrefix(line, "/*") { if !commentStyle.SlashStar { continue } - prefix = "/* name:" + prefix = "/*" } if strings.HasPrefix(line, "#") { if !commentStyle.Hash { continue } - prefix = "# name:" + prefix = "#" } if prefix == "" { continue } - if !strings.HasPrefix(line, prefix) { + rest := line[len(prefix):] + if !strings.HasPrefix(strings.TrimSpace(rest), "name") { continue } + if !strings.Contains(rest, ":") { + continue + } + if !strings.HasPrefix(rest, " name: ") { + return "", "", fmt.Errorf("invalid metadata: %s", line) + } part := strings.Split(strings.TrimSpace(line), " ") - if strings.HasPrefix(line, "/*") { + if prefix == "/*" { part = part[:len(part)-1] // removes the trailing "*/" element } - if len(part) == 2 { - return "", "", fmt.Errorf("missing query type [':one', ':many', ':exec', ':execrows', ':execresult']: %s", line) + 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 { return "", "", fmt.Errorf("invalid query comment: %s", line) @@ -80,7 +106,7 @@ func Parse(t string, commentStyle CommentSyntax) (string, string, error) { queryName := part[2] queryType := strings.TrimSpace(part[3]) switch queryType { - case CmdOne, CmdMany, CmdExec, CmdExecResult, CmdExecRows: + case CmdOne, CmdMany, CmdExec, CmdExecResult, CmdExecRows, CmdExecLastId, CmdCopyFrom, CmdBatchExec, CmdBatchMany, CmdBatchOne: default: return "", "", fmt.Errorf("invalid query type: %s", queryType) } @@ -91,3 +117,56 @@ func Parse(t string, commentStyle CommentSyntax) (string, string, error) { } return "", "", nil } + +// 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 { + 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 params, flags, ruleSkiplist, nil +} diff --git a/internal/metadata/meta_test.go b/internal/metadata/meta_test.go index 37e99307c6..e9ef54586e 100644 --- a/internal/metadata/meta_test.go +++ b/internal/metadata/meta_test.go @@ -1,8 +1,11 @@ package metadata -import "testing" +import ( + "testing" +) + +func TestParseQueryNameAndType(t *testing.T) { -func TestParseMetadata(t *testing.T) { for _, query := range []string{ `-- name: CreateFoo, :one`, `-- name: 9Foo_, :one`, @@ -10,9 +13,170 @@ func TestParseMetadata(t *testing.T) { `-- name: CreateFoo`, `-- name: CreateFoo :one something`, `-- name: `, + `--name: CreateFoo :one`, + `--name CreateFoo :one`, + `--name: CreateFoo :two`, + "-- name:CreateFoo", + `--name:CreateFoo :two`, } { - if _, _, err := Parse(query, CommentSyntax{Dash: true}); err == nil { + if _, _, err := ParseQueryNameAndType(query, CommentSyntax{Dash: true}); err == nil { t.Errorf("expected invalid metadata: %q", query) } } + + for _, query := range []string{ + `-- some comment`, + `-- name comment`, + `--name comment`, + } { + if _, _, err := ParseQueryNameAndType(query, CommentSyntax{Dash: true}); err != nil { + t.Errorf("expected valid comment: %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 @flag-bar", + }, + { + " name: GetFoos :many", + " @param @flag-bar UUID", + " @flag-foo", + }, + { + " name: GetFoos :many", + " @flag-foo", + " @param @flag-bar UUID", + }, + } { + _, flags, _, err := ParseCommentFlags(comments) + if err != nil { + 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") + } + } +} + +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..4ade6045a4 100644 --- a/internal/migrations/migrations.go +++ b/internal/migrations/migrations.go @@ -15,16 +15,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()) diff --git a/internal/multierr/error.go b/internal/multierr/error.go index 5dc10736d9..433a24bf80 100644 --- a/internal/multierr/error.go +++ b/internal/multierr/error.go @@ -3,8 +3,8 @@ package multierr import ( "fmt" - "github.com/kyleconroy/sqlc/internal/source" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) type FileError struct { diff --git a/internal/opts/debug.go b/internal/opts/debug.go index ac0dcc4783..b92cbd4ae8 100644 --- a/internal/opts/debug.go +++ b/internal/opts/debug.go @@ -10,25 +10,58 @@ import ( // // 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 +// databases: setting databases=managed will disable connections to databases via URI +// 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 + DumpAST bool + DumpCatalog bool + Trace string + ProcessPlugins bool + OnlyManagedDatabases bool + DumpVetEnv bool + DumpExplain bool } -func DebugFromEnv() (Debug, error) { - d := Debug{} - val := os.Getenv("SQLCDEBUG") +func DebugFromEnv() Debug { + return DebugFromString(os.Getenv("SQLCDEBUG")) +} + +func DebugFromString(val string) Debug { + d := Debug{ + ProcessPlugins: true, + } if val == "" { - return d, nil + return d } for _, pair := range strings.Split(val, ",") { - switch strings.TrimSpace(pair) { - case "dumpast=1": + pair = strings.TrimSpace(pair) + switch { + case pair == "dumpast=1": d.DumpAST = true - case "dumpcatalog=1": + 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 == "databases=managed": + d.OnlyManagedDatabases = true + case pair == "dumpvetenv=1": + d.DumpVetEnv = true + case pair == "dumpexplain=1": + d.DumpExplain = true } } - return d, nil + return d } diff --git a/internal/opts/experiment.go b/internal/opts/experiment.go new file mode 100644 index 0000000000..45a1c11e05 --- /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: +// +// analyzerv2 - enables database-only analyzer mode +// +// 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 { + // AnalyzerV2 enables the database-only analyzer mode (analyzer.database: only) + // which uses the database for all type resolution instead of parsing schema files. + AnalyzerV2 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.Split(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 "analyzerv2": + 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 "analyzerv2": + e.AnalyzerV2 = enabled + } +} + +// Enabled returns a slice of all enabled experiment names. +func (e Experiment) Enabled() []string { + var enabled []string + if e.AnalyzerV2 { + enabled = append(enabled, "analyzerv2") + } + 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..e9a8618e89 --- /dev/null +++ b/internal/opts/experiment_test.go @@ -0,0 +1,176 @@ +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 analyzerv2", + input: "analyzerv2", + want: Experiment{AnalyzerV2: true}, + }, + { + name: "disable analyzerv2", + input: "noanalyzerv2", + want: Experiment{AnalyzerV2: false}, + }, + { + name: "enable then disable analyzerv2", + input: "analyzerv2,noanalyzerv2", + want: Experiment{AnalyzerV2: false}, + }, + { + name: "analyzerv2 case insensitive", + input: "AnalyzerV2", + want: Experiment{AnalyzerV2: 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: "analyzerv2 enabled", + exp: Experiment{AnalyzerV2: true}, + want: []string{"analyzerv2"}, + }, + } + + 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) { + tests := []struct { + name string + exp Experiment + want string + }{ + { + name: "no experiments", + exp: Experiment{}, + want: "", + }, + { + name: "analyzerv2 enabled", + exp: Experiment{AnalyzerV2: true}, + want: "analyzerv2", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := tt.exp.String() + if got != tt.want { + t.Errorf("Experiment.String() = %q, want %q", got, tt.want) + } + }) + } +} + +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: "analyzerv2 lowercase", + input: "analyzerv2", + want: true, + }, + { + name: "analyzerv2 mixed case", + input: "AnalyzerV2", + 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 7ce464be2c..2059d4f6a1 100644 --- a/internal/opts/parser.go +++ b/internal/opts/parser.go @@ -1,6 +1,6 @@ package opts type Parser struct { - UsePositionalParameters bool - Debug Debug + Debug Debug + Experiment Experiment } diff --git a/internal/pattern/match.go b/internal/pattern/match.go new file mode 100644 index 0000000000..1cf8afb1e4 --- /dev/null +++ b/internal/pattern/match.go @@ -0,0 +1,85 @@ +package pattern + +import ( + "fmt" + "regexp" + "sync" +) + +// Match is a wrapper of *regexp.Regexp. +// It contains the match pattern compiled into a regular expression. +type Match struct { + *regexp.Regexp +} + +var ( + matchCache = make(map[string]*Match) + matchCacheLock sync.RWMutex +) + +// Compile takes our match expression as a string, and compiles it into a *Match object. +// Will return an error on an invalid pattern. +func MatchCompile(pattern string) (*Match, error) { + // check for pattern in cache + matchCacheLock.RLock() + matcher, ok := matchCache[pattern] + matchCacheLock.RUnlock() + if ok { + return matcher, nil + } + + // pattern isn't in cache, compile it + matcher, err := matchCompile(pattern) + if err != nil { + return nil, err + } + // add it to the cache + matchCacheLock.Lock() + matchCache[pattern] = matcher + matchCacheLock.Unlock() + + return matcher, nil +} + +func matchCompile(pattern string) (match *Match, err error) { + regex := "" + escaped := false + arr := []byte(pattern) + + for i := 0; i < len(arr); i++ { + if escaped { + escaped = false + switch arr[i] { + case '*', '?', '\\': + regex += "\\" + string(arr[i]) + default: + return nil, fmt.Errorf("Invalid escaped character '%c'", arr[i]) + } + } else { + switch arr[i] { + case '\\': + escaped = true + case '*': + regex += ".*" + case '?': + regex += "." + case '.', '(', ')', '+', '|', '^', '$', '[', ']', '{', '}': + regex += "\\" + string(arr[i]) + default: + regex += string(arr[i]) + } + } + } + + if escaped { + return nil, fmt.Errorf("Unterminated escape at end of pattern") + } + + var r *regexp.Regexp + + if r, err = regexp.Compile("^" + regex + "$"); err != nil { + return nil, err + } + + return &Match{r}, nil +} 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 new file mode 100644 index 0000000000..525ffc72ef --- /dev/null +++ b/internal/plugin/codegen.pb.go @@ -0,0 +1,1648 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: plugin/codegen.proto + +package plugin + +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 File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[0] + 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_plugin_codegen_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 File.ProtoReflect.Descriptor instead. +func (*File) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{0} +} + +func (x *File) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *File) GetContents() []byte { + if x != nil { + return x.Contents + } + 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"` + 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[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Settings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Settings) ProtoMessage() {} + +func (x *Settings) 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 Settings.ProtoReflect.Descriptor instead. +func (*Settings) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{1} +} + +func (x *Settings) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Settings) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *Settings) GetSchema() []string { + if x != nil { + return x.Schema + } + return nil +} + +func (x *Settings) GetQueries() []string { + if x != nil { + return x.Queries + } + return nil +} + +func (x *Settings) GetCodegen() *Codegen { + if x != nil { + return x.Codegen + } + return nil +} + +type Codegen struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` + Plugin string `protobuf:"bytes,2,opt,name=plugin,proto3" json:"plugin,omitempty"` + Options []byte `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + Env []string `protobuf:"bytes,4,rep,name=env,proto3" json:"env,omitempty"` + Process *Codegen_Process `protobuf:"bytes,5,opt,name=process,proto3" json:"process,omitempty"` + Wasm *Codegen_WASM `protobuf:"bytes,6,opt,name=wasm,proto3" json:"wasm,omitempty"` +} + +func (x *Codegen) Reset() { + *x = Codegen{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Codegen) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Codegen) ProtoMessage() {} + +func (x *Codegen) 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 Codegen.ProtoReflect.Descriptor instead. +func (*Codegen) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2} +} + +func (x *Codegen) GetOut() string { + if x != nil { + return x.Out + } + return "" +} + +func (x *Codegen) GetPlugin() string { + if x != nil { + return x.Plugin + } + return "" +} + +func (x *Codegen) GetOptions() []byte { + if x != nil { + return x.Options + } + return nil +} + +func (x *Codegen) GetEnv() []string { + if x != nil { + return x.Env + } + return nil +} + +func (x *Codegen) GetProcess() *Codegen_Process { + if x != nil { + return x.Process + } + return nil +} + +func (x *Codegen) GetWasm() *Codegen_WASM { + if x != nil { + return x.Wasm + } + return nil +} + +type Catalog struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + DefaultSchema string `protobuf:"bytes,2,opt,name=default_schema,json=defaultSchema,proto3" json:"default_schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Schemas []*Schema `protobuf:"bytes,4,rep,name=schemas,proto3" json:"schemas,omitempty"` +} + +func (x *Catalog) Reset() { + *x = Catalog{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Catalog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Catalog) ProtoMessage() {} + +func (x *Catalog) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_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 Catalog.ProtoReflect.Descriptor instead. +func (*Catalog) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{3} +} + +func (x *Catalog) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +func (x *Catalog) GetDefaultSchema() string { + if x != nil { + return x.DefaultSchema + } + return "" +} + +func (x *Catalog) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Catalog) GetSchemas() []*Schema { + if x != nil { + return x.Schemas + } + return nil +} + +type Schema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Tables []*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty"` + Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` + CompositeTypes []*CompositeType `protobuf:"bytes,5,rep,name=composite_types,json=compositeTypes,proto3" json:"composite_types,omitempty"` +} + +func (x *Schema) Reset() { + *x = Schema{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Schema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Schema) ProtoMessage() {} + +func (x *Schema) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[4] + 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 Schema.ProtoReflect.Descriptor instead. +func (*Schema) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{4} +} + +func (x *Schema) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +func (x *Schema) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Schema) GetTables() []*Table { + if x != nil { + return x.Tables + } + return nil +} + +func (x *Schema) GetEnums() []*Enum { + if x != nil { + return x.Enums + } + return nil +} + +func (x *Schema) GetCompositeTypes() []*CompositeType { + if x != nil { + return x.CompositeTypes + } + return nil +} + +type CompositeType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` +} + +func (x *CompositeType) Reset() { + *x = CompositeType{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompositeType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompositeType) ProtoMessage() {} + +func (x *CompositeType) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_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 CompositeType.ProtoReflect.Descriptor instead. +func (*CompositeType) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{5} +} + +func (x *CompositeType) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CompositeType) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +type Enum struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Vals []string `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"` + Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` +} + +func (x *Enum) Reset() { + *x = Enum{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Enum) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Enum) ProtoMessage() {} + +func (x *Enum) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[6] + 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 Enum.ProtoReflect.Descriptor instead. +func (*Enum) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{6} +} + +func (x *Enum) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Enum) GetVals() []string { + if x != nil { + return x.Vals + } + return nil +} + +func (x *Enum) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +type Table struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rel *Identifier `protobuf:"bytes,1,opt,name=rel,proto3" json:"rel,omitempty"` + Columns []*Column `protobuf:"bytes,2,rep,name=columns,proto3" json:"columns,omitempty"` + Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` +} + +func (x *Table) Reset() { + *x = Table{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Table) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Table) ProtoMessage() {} + +func (x *Table) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[7] + 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 Table.ProtoReflect.Descriptor instead. +func (*Table) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{7} +} + +func (x *Table) GetRel() *Identifier { + if x != nil { + return x.Rel + } + return nil +} + +func (x *Table) GetColumns() []*Column { + if x != nil { + return x.Columns + } + return nil +} + +func (x *Table) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +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_plugin_codegen_proto_msgTypes[8] + 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_plugin_codegen_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 Identifier.ProtoReflect.Descriptor instead. +func (*Identifier) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{8} +} + +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"` + NotNull bool `protobuf:"varint,3,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` + IsArray bool `protobuf:"varint,4,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` + Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"` + Length int32 `protobuf:"varint,6,opt,name=length,proto3" json:"length,omitempty"` + IsNamedParam bool `protobuf:"varint,7,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` + IsFuncCall bool `protobuf:"varint,8,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` + // XXX: Figure out what PostgreSQL calls `foo.id` + Scope string `protobuf:"bytes,9,opt,name=scope,proto3" json:"scope,omitempty"` + Table *Identifier `protobuf:"bytes,10,opt,name=table,proto3" json:"table,omitempty"` + TableAlias string `protobuf:"bytes,11,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` + Type *Identifier `protobuf:"bytes,12,opt,name=type,proto3" json:"type,omitempty"` + IsSqlcSlice bool `protobuf:"varint,13,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` + EmbedTable *Identifier `protobuf:"bytes,14,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` + 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"` +} + +func (x *Column) Reset() { + *x = Column{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[9] + 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_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 Column.ProtoReflect.Descriptor instead. +func (*Column) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} +} + +func (x *Column) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Column) GetNotNull() bool { + if x != nil { + return x.NotNull + } + return false +} + +func (x *Column) GetIsArray() bool { + if x != nil { + return x.IsArray + } + return false +} + +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) GetIsSqlcSlice() bool { + if x != nil { + return x.IsSqlcSlice + } + return false +} + +func (x *Column) GetEmbedTable() *Identifier { + if x != nil { + return x.EmbedTable + } + return nil +} + +func (x *Column) GetOriginalName() string { + if x != nil { + return x.OriginalName + } + return "" +} + +func (x *Column) GetUnsigned() bool { + if x != nil { + return x.Unsigned + } + return false +} + +func (x *Column) GetArrayDims() int32 { + if x != nil { + return x.ArrayDims + } + return 0 +} + +type Query struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Columns []*Column `protobuf:"bytes,4,rep,name=columns,proto3" json:"columns,omitempty"` + Params []*Parameter `protobuf:"bytes,5,rep,name=params,json=parameters,proto3" json:"params,omitempty"` + Comments []string `protobuf:"bytes,6,rep,name=comments,proto3" json:"comments,omitempty"` + Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` + InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=insert_into_table,proto3" json:"insert_into_table,omitempty"` +} + +func (x *Query) Reset() { + *x = Query{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Query) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Query) ProtoMessage() {} + +func (x *Query) 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 Query.ProtoReflect.Descriptor instead. +func (*Query) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} +} + +func (x *Query) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Query) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Query) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +func (x *Query) GetColumns() []*Column { + if x != nil { + return x.Columns + } + return nil +} + +func (x *Query) GetParams() []*Parameter { + if x != nil { + return x.Params + } + return nil +} + +func (x *Query) GetComments() []string { + if x != nil { + return x.Comments + } + return nil +} + +func (x *Query) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *Query) GetInsertIntoTable() *Identifier { + if x != nil { + return x.InsertIntoTable + } + return nil +} + +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_plugin_codegen_proto_msgTypes[11] + 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_plugin_codegen_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 Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} +} + +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 GenerateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Settings *Settings `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"` + Catalog *Catalog `protobuf:"bytes,2,opt,name=catalog,proto3" json:"catalog,omitempty"` + 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 *GenerateRequest) Reset() { + *x = GenerateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[12] + 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_plugin_codegen_proto_msgTypes[12] + 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_plugin_codegen_proto_rawDescGZIP(), []int{12} +} + +func (x *GenerateRequest) GetSettings() *Settings { + if x != nil { + return x.Settings + } + return nil +} + +func (x *GenerateRequest) GetCatalog() *Catalog { + if x != nil { + return x.Catalog + } + return nil +} + +func (x *GenerateRequest) GetQueries() []*Query { + if x != nil { + return x.Queries + } + return nil +} + +func (x *GenerateRequest) GetSqlcVersion() string { + if x != nil { + return x.SqlcVersion + } + return "" +} + +func (x *GenerateRequest) GetPluginOptions() []byte { + if x != nil { + return x.PluginOptions + } + return nil +} + +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 + + Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` +} + +func (x *GenerateResponse) Reset() { + *x = GenerateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[13] + 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_plugin_codegen_proto_msgTypes[13] + 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_plugin_codegen_proto_rawDescGZIP(), []int{13} +} + +func (x *GenerateResponse) GetFiles() []*File { + if x != nil { + return x.Files + } + return nil +} + +type Codegen_Process struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cmd string `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` +} + +func (x *Codegen_Process) Reset() { + *x = Codegen_Process{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Codegen_Process) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Codegen_Process) ProtoMessage() {} + +func (x *Codegen_Process) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[14] + 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 Codegen_Process.ProtoReflect.Descriptor instead. +func (*Codegen_Process) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *Codegen_Process) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +type Codegen_WASM struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Sha256 string `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` +} + +func (x *Codegen_WASM) Reset() { + *x = Codegen_WASM{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Codegen_WASM) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Codegen_WASM) ProtoMessage() {} + +func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[15] + 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 Codegen_WASM.ProtoReflect.Descriptor instead. +func (*Codegen_WASM) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *Codegen_WASM) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Codegen_WASM) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + +var File_plugin_codegen_proto protoreflect.FileDescriptor + +var file_plugin_codegen_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 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, 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, 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, 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, 0x63, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_plugin_codegen_proto_rawDescOnce sync.Once + file_plugin_codegen_proto_rawDescData = file_plugin_codegen_proto_rawDesc +) + +func file_plugin_codegen_proto_rawDescGZIP() []byte { + file_plugin_codegen_proto_rawDescOnce.Do(func() { + file_plugin_codegen_proto_rawDescData = protoimpl.X.CompressGZIP(file_plugin_codegen_proto_rawDescData) + }) + return file_plugin_codegen_proto_rawDescData +} + +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_plugin_codegen_proto_goTypes = []interface{}{ + (*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 + (*Column)(nil), // 9: plugin.Column + (*Query)(nil), // 10: plugin.Query + (*Parameter)(nil), // 11: plugin.Parameter + (*GenerateRequest)(nil), // 12: plugin.GenerateRequest + (*GenerateResponse)(nil), // 13: plugin.GenerateResponse + (*Codegen_Process)(nil), // 14: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 15: plugin.Codegen.WASM +} +var file_plugin_codegen_proto_depIdxs = []int32{ + 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen + 14, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process + 15, // 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 + 9, // 8: plugin.Table.columns:type_name -> plugin.Column + 8, // 9: plugin.Column.table:type_name -> plugin.Identifier + 8, // 10: plugin.Column.type:type_name -> plugin.Identifier + 8, // 11: plugin.Column.embed_table:type_name -> plugin.Identifier + 9, // 12: plugin.Query.columns:type_name -> plugin.Column + 11, // 13: plugin.Query.params:type_name -> plugin.Parameter + 8, // 14: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 9, // 15: plugin.Parameter.column:type_name -> plugin.Column + 1, // 16: plugin.GenerateRequest.settings:type_name -> plugin.Settings + 3, // 17: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog + 10, // 18: plugin.GenerateRequest.queries:type_name -> plugin.Query + 0, // 19: plugin.GenerateResponse.files:type_name -> plugin.File + 12, // 20: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest + 13, // 21: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse + 21, // [21:22] is the sub-list for method output_type + 20, // [20:21] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_plugin_codegen_proto_init() } +func file_plugin_codegen_proto_init() { + if File_plugin_codegen_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_plugin_codegen_proto_msgTypes[0].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 + } + } + file_plugin_codegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Settings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Codegen); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Catalog); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Schema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CompositeType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Enum); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Table); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[8].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_plugin_codegen_proto_msgTypes[9].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_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Query); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[11].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_plugin_codegen_proto_msgTypes[12].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_plugin_codegen_proto_msgTypes[13].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_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Codegen_Process); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Codegen_WASM); 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_plugin_codegen_proto_rawDesc, + NumEnums: 0, + NumMessages: 16, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_codegen_proto_goTypes, + DependencyIndexes: file_plugin_codegen_proto_depIdxs, + MessageInfos: file_plugin_codegen_proto_msgTypes, + }.Build() + File_plugin_codegen_proto = out.File + file_plugin_codegen_proto_rawDesc = nil + file_plugin_codegen_proto_goTypes = nil + file_plugin_codegen_proto_depIdxs = nil +} 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/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/rpc.go b/internal/quickdb/rpc.go new file mode 100644 index 0000000000..9d9649d3dc --- /dev/null +++ b/internal/quickdb/rpc.go @@ -0,0 +1,57 @@ +package quickdb + +import ( + "crypto/tls" + + "github.com/riza-io/grpc-go/credentials/basic" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + + "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 + return NewClient(projectID, cloudConfig.AuthToken, WithHost(cloudConfig.Hostname)) +} + +type options struct { + hostname string +} + +type Option func(*options) + +func WithHost(host string) Option { + return func(o *options) { + o.hostname = host + } +} + +func NewClient(project, token string, opts ...Option) (pb.QuickClient, error) { + var o options + for _, apply := range opts { + apply(&o) + } + + dialOpts := []grpc.DialOption{ + grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), + grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(project, token)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), + } + + hostname := o.hostname + if hostname == "" { + hostname = defaultHostname + } + + conn, err := grpc.Dial(hostname+":443", dialOpts...) + if err != nil { + return nil, err + } + + return pb.NewQuickClient(conn), nil +} diff --git a/internal/quickdb/v1/quickdb.pb.go b/internal/quickdb/v1/quickdb.pb.go new file mode 100755 index 0000000000..690dfc16f1 --- /dev/null +++ b/internal/quickdb/v1/quickdb.pb.go @@ -0,0 +1,1142 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: v1/quickdb.proto + +package quickdbv1 + +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 CreateEphemeralDatabaseRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + ServerId string `protobuf:"bytes,3,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + Migrations []string `protobuf:"bytes,4,rep,name=migrations,proto3" json:"migrations,omitempty"` +} + +func (x *CreateEphemeralDatabaseRequest) Reset() { + *x = CreateEphemeralDatabaseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateEphemeralDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEphemeralDatabaseRequest) ProtoMessage() {} + +func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 CreateEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. +func (*CreateEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateEphemeralDatabaseRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetServerId() string { + if x != nil { + return x.ServerId + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetMigrations() []string { + if x != nil { + return x.Migrations + } + return nil +} + +type CreateEphemeralDatabaseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + Uri string `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"` +} + +func (x *CreateEphemeralDatabaseResponse) Reset() { + *x = CreateEphemeralDatabaseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateEphemeralDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEphemeralDatabaseResponse) ProtoMessage() {} + +func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 CreateEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. +func (*CreateEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateEphemeralDatabaseResponse) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +func (x *CreateEphemeralDatabaseResponse) GetUri() string { + if x != nil { + return x.Uri + } + return "" +} + +type DropEphemeralDatabaseRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` +} + +func (x *DropEphemeralDatabaseRequest) Reset() { + *x = DropEphemeralDatabaseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DropEphemeralDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DropEphemeralDatabaseRequest) ProtoMessage() {} + +func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 DropEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. +func (*DropEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{2} +} + +func (x *DropEphemeralDatabaseRequest) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type DropEphemeralDatabaseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DropEphemeralDatabaseResponse) Reset() { + *x = DropEphemeralDatabaseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DropEphemeralDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DropEphemeralDatabaseResponse) ProtoMessage() {} + +func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 DropEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. +func (*DropEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{3} +} + +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[4] + 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_v1_quickdb_proto_msgTypes[4] + 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_v1_quickdb_proto_rawDescGZIP(), []int{4} +} + +func (x *File) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *File) GetContents() []byte { + if x != nil { + return x.Contents + } + 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"` // 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_v1_quickdb_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadArchiveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadArchiveRequest) ProtoMessage() {} + +func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[6] + 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 UploadArchiveRequest.ProtoReflect.Descriptor instead. +func (*UploadArchiveRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{6} +} + +func (x *UploadArchiveRequest) GetSqlcVersion() string { + if x != nil { + return x.SqlcVersion + } + return "" +} + +func (x *UploadArchiveRequest) GetInputs() []*File { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *UploadArchiveRequest) GetOutputs() []*File { + if x != nil { + return x.Outputs + } + 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 + unknownFields protoimpl.UnknownFields + + Checksum []byte `protobuf:"bytes,1,opt,name=checksum,proto3" json:"checksum,omitempty"` +} + +func (x *UploadArchiveResponse) Reset() { + *x = UploadArchiveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadArchiveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadArchiveResponse) ProtoMessage() {} + +func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[7] + 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 UploadArchiveResponse.ProtoReflect.Descriptor instead. +func (*UploadArchiveResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{7} +} + +func (x *UploadArchiveResponse) GetChecksum() []byte { + if x != nil { + return x.Checksum + } + return nil +} + +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, + 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, 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, + 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_v1_quickdb_proto_rawDescOnce sync.Once + file_v1_quickdb_proto_rawDescData = file_v1_quickdb_proto_rawDesc +) + +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_v1_quickdb_proto_rawDescData +} + +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 + (*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_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEphemeralDatabaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEphemeralDatabaseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DropEphemeralDatabaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DropEphemeralDatabaseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[4].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 + } + } + 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 + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadArchiveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + 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_v1_quickdb_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v1_quickdb_proto_goTypes, + DependencyIndexes: file_v1_quickdb_proto_depIdxs, + MessageInfos: file_v1_quickdb_proto_msgTypes, + }.Build() + 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 new file mode 100644 index 0000000000..bba3d16444 --- /dev/null +++ b/internal/remote/gen.pb.go @@ -0,0 +1,340 @@ +// 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 new file mode 100644 index 0000000000..dc85465154 --- /dev/null +++ b/internal/remote/gen.proto @@ -0,0 +1,25 @@ +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 new file mode 100644 index 0000000000..a2fb3d76a0 --- /dev/null +++ b/internal/remote/gen_grpc.pb.go @@ -0,0 +1,105 @@ +// 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 new file mode 100644 index 0000000000..4adc9f8681 --- /dev/null +++ b/internal/remote/rpc.go @@ -0,0 +1,35 @@ +package remote + +import ( + "crypto/tls" + + "github.com/riza-io/grpc-go/credentials/basic" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/rpc" +) + +const defaultHostname = "remote.sqlc.dev" + +func NewClient(cloudConfig config.Cloud) (GenClient, error) { + authID := cloudConfig.Organization + "/" + cloudConfig.Project + opts := []grpc.DialOption{ + grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), + grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(authID, cloudConfig.AuthToken)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), + } + + 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..ac0490bd1a --- /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 interface{}, 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 new file mode 100644 index 0000000000..88f3074b71 --- /dev/null +++ b/internal/shfmt/shfmt.go @@ -0,0 +1,38 @@ +package shfmt + +import ( + "os" + "regexp" + "strings" +) + +var pat = regexp.MustCompile(`\$\{[A-Z_]+\}`) + +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 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 new file mode 100644 index 0000000000..cf99ed220b --- /dev/null +++ b/internal/shfmt/shfmt_test.go @@ -0,0 +1,17 @@ +package shfmt + +import "testing" + +func TestReplace(t *testing.T) { + s := "POSTGRES_SQL://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/AUTHORS" + 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 := r.Replace(s); v != e { + t.Errorf("%s != %s", v, e) + } +} diff --git a/internal/source/code.go b/internal/source/code.go index b84324b55f..8b88a24136 100644 --- a/internal/source/code.go +++ b/internal/source/code.go @@ -12,6 +12,13 @@ type Edit struct { Location int Old string New string + OldFunc func(string) int +} + +type CommentSyntax struct { + Dash bool + Hash bool + SlashStar bool } func LineNumber(source string, head int) (int, int) { @@ -54,25 +61,37 @@ func Mutate(raw string, a []Edit) (string, error) { if len(a) == 0 { return raw, nil } + sort.Slice(a, func(i, j int) bool { return a[i].Location > a[j].Location }) + s := raw - for _, edit := range a { + for idx, edit := range a { start := edit.Location - if start > len(s) { + if start > len(s) || start < 0 { return "", fmt.Errorf("edit start location is out of bounds") } - if len(edit.New) <= 0 { - return "", fmt.Errorf("empty edit contents") + var oldLen int + if edit.OldFunc != nil { + oldLen = edit.OldFunc(s[start:]) + } else { + oldLen = len(edit.Old) } - if len(edit.Old) <= 0 { - return "", fmt.Errorf("empty edit contents") + + stop := edit.Location + oldLen + if stop > len(s) { + return "", fmt.Errorf("edit stop location is out of bounds") } - stop := edit.Location + len(edit.Old) - 1 // Assumes edit.New is non-empty - if stop < len(s) { - s = s[:start] + edit.New + s[stop+1:] - } else { - s = s[:start] + edit.New + + // If this is not the first edit, (applied backwards), check if + // this edit overlaps the previous one (and is therefore a developer error) + if idx != 0 { + prevEdit := a[idx-1] + if prevEdit.Location < edit.Location+oldLen { + return "", fmt.Errorf("2 edits overlap") + } } + + s = s[:start] + edit.New + s[stop:] } return s, nil } @@ -88,6 +107,9 @@ func StripComments(sql string) (string, []string, error) { if strings.HasPrefix(t, "/* name:") && strings.HasSuffix(t, "*/") { continue } + if strings.HasPrefix(t, "# name:") { + continue + } if strings.HasPrefix(t, "--") { comments = append(comments, strings.TrimPrefix(t, "--")) continue @@ -98,7 +120,46 @@ func StripComments(sql string) (string, []string, error) { comments = append(comments, t) continue } + if strings.HasPrefix(t, "#") { + comments = append(comments, strings.TrimPrefix(t, "#")) + 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/source/mutate_test.go b/internal/source/mutate_test.go new file mode 100644 index 0000000000..dd76888796 --- /dev/null +++ b/internal/source/mutate_test.go @@ -0,0 +1,210 @@ +package source + +import ( + "fmt" + "testing" +) + +// newEdit is a testing helper for quickly generating Edits +func newEdit(loc int, old, new string) Edit { + return Edit{Location: loc, Old: old, New: new} +} + +// TestMutateSingle tests almost every possibility of a single edit +func TestMutateSingle(t *testing.T) { + type test struct { + input string + edit Edit + expected string + } + + tests := []test{ + // Simple edits that replace everything + {"", newEdit(0, "", ""), ""}, + {"a", newEdit(0, "a", "A"), "A"}, + {"abcde", newEdit(0, "abcde", "fghij"), "fghij"}, + {"", newEdit(0, "", "fghij"), "fghij"}, + {"abcde", newEdit(0, "abcde", ""), ""}, + + // Edits that start at the very beginning (But don't cover the whole range) + {"abcde", newEdit(0, "a", "A"), "Abcde"}, + {"abcde", newEdit(0, "ab", "AB"), "ABcde"}, + {"abcde", newEdit(0, "abc", "ABC"), "ABCde"}, + {"abcde", newEdit(0, "abcd", "ABCD"), "ABCDe"}, + + // The above repeated, but with different lengths + {"abcde", newEdit(0, "a", ""), "bcde"}, + {"abcde", newEdit(0, "ab", "A"), "Acde"}, + {"abcde", newEdit(0, "abc", "AB"), "ABde"}, + {"abcde", newEdit(0, "abcd", "AB"), "ABe"}, + + // Edits that touch the end (but don't cover the whole range) + {"abcde", newEdit(4, "e", "E"), "abcdE"}, + {"abcde", newEdit(3, "de", "DE"), "abcDE"}, + {"abcde", newEdit(2, "cde", "CDE"), "abCDE"}, + {"abcde", newEdit(1, "bcde", "BCDE"), "aBCDE"}, + + // The above repeated, but with different lengths + {"abcde", newEdit(4, "e", ""), "abcd"}, + {"abcde", newEdit(3, "de", "D"), "abcD"}, + {"abcde", newEdit(2, "cde", "CD"), "abCD"}, + {"abcde", newEdit(1, "bcde", "BC"), "aBC"}, + + // Raw insertions / deletions + {"abcde", newEdit(0, "", "_"), "_abcde"}, + {"abcde", newEdit(1, "", "_"), "a_bcde"}, + {"abcde", newEdit(2, "", "_"), "ab_cde"}, + {"abcde", newEdit(3, "", "_"), "abc_de"}, + {"abcde", newEdit(4, "", "_"), "abcd_e"}, + {"abcde", newEdit(5, "", "_"), "abcde_"}, + } + + origTests := tests + // Generate the reverse mutations, for every edit - the opposite edit that makes it "undo" + for _, spec := range origTests { + tests = append(tests, test{ + input: spec.expected, + edit: newEdit(spec.edit.Location, spec.edit.New, spec.edit.Old), + expected: spec.input, + }) + } + + for _, spec := range tests { + expected := spec.expected + + actual, err := Mutate(spec.input, []Edit{spec.edit}) + testName := fmt.Sprintf("Mutate(%s, Edit{%v, %v -> %v})", spec.input, spec.edit.Location, spec.edit.Old, spec.edit.New) + if err != nil { + t.Errorf("%s should not error (%v)", testName, err) + continue + } + + if actual != expected { + t.Errorf("%s expected %v; got %v", testName, expected, actual) + } + } +} + +// TestMutateMulti tests combinations of edits +func TestMutateMulti(t *testing.T) { + type test struct { + input string + edit1 Edit + edit2 Edit + expected string + } + + tests := []test{ + // Edits that are >1 character from each other + {"abcde", newEdit(0, "a", "A"), newEdit(2, "c", "C"), "AbCde"}, + {"abcde", newEdit(0, "a", "A"), newEdit(2, "c", "C"), "AbCde"}, + + // 2 edits bump right up next to each other + {"abcde", newEdit(0, "abc", ""), newEdit(3, "de", "DE"), "DE"}, + {"abcde", newEdit(0, "abc", "ABC"), newEdit(3, "de", ""), "ABC"}, + {"abcde", newEdit(0, "abc", "ABC"), newEdit(3, "de", "DE"), "ABCDE"}, + {"abcde", newEdit(1, "b", "BB"), newEdit(2, "c", "CC"), "aBBCCde"}, + + // 2 edits bump next to each other, but don't cover the whole string + {"abcdef", newEdit(1, "bc", "C"), newEdit(3, "de", "D"), "aCDf"}, + {"abcde", newEdit(1, "bc", "CCCC"), newEdit(3, "d", "DDD"), "aCCCCDDDe"}, + + // lengthening edits + {"abcde", newEdit(1, "b", "BBBB"), newEdit(2, "c", "CCCC"), "aBBBBCCCCde"}, + } + + origTests := tests + // Generate the edits in opposite order mutations, source edits should be independent of + // the order the edits are specified + for _, spec := range origTests { + tests = append(tests, test{ + input: spec.input, + edit1: spec.edit2, + edit2: spec.edit1, + expected: spec.expected, + }) + } + + for _, spec := range tests { + expected := spec.expected + + actual, err := Mutate(spec.input, []Edit{spec.edit1, spec.edit2}) + testName := fmt.Sprintf("Mutate(%s, Edits{(%v, %v -> %v), (%v, %v -> %v)})", spec.input, + spec.edit1.Location, spec.edit1.Old, spec.edit1.New, + spec.edit2.Location, spec.edit2.Old, spec.edit2.New) + + if err != nil { + t.Errorf("%s should not error (%v)", testName, err) + continue + } + + if actual != expected { + t.Errorf("%s expected %v; got %v", testName, expected, actual) + } + } +} + +// TestMutateErrorSingle test errors are generated for trivially incorrect single edits +func TestMutateErrorSingle(t *testing.T) { + type test struct { + input string + edit Edit + } + + tests := []test{ + // old text is longer than input text + {"", newEdit(0, "a", "A")}, + {"a", newEdit(0, "aa", "A")}, + {"hello", newEdit(0, "hello!", "A")}, + + // negative indexes + {"aaa", newEdit(-1, "aa", "A")}, + {"aaa", newEdit(-2, "aa", "A")}, + {"aaa", newEdit(-100, "aa", "A")}, + } + + for _, spec := range tests { + edit := spec.edit + + _, err := Mutate(spec.input, []Edit{edit}) + testName := fmt.Sprintf("Mutate(%s, Edit{%v, %v -> %v})", spec.input, edit.Location, edit.Old, edit.New) + if err == nil { + t.Errorf("%s should error (%v)", testName, err) + continue + } + } +} + +// TestMutateErrorMulti tests error that can only happen across multiple errors +func TestMutateErrorMulti(t *testing.T) { + type test struct { + input string + edit1 Edit + edit2 Edit + } + + tests := []test{ + // These edits overlap each other, and are therefore undefined + {"abcdef", newEdit(0, "a", ""), newEdit(0, "a", "A")}, + {"abcdef", newEdit(0, "ab", ""), newEdit(1, "ab", "AB")}, + {"abcdef", newEdit(0, "abc", ""), newEdit(2, "abc", "ABC")}, + + // the last edit is longer than the string itself + {"abcdef", newEdit(0, "abcdefghi", ""), newEdit(2, "abc", "ABC")}, + + // negative indexes + {"abcdef", newEdit(-1, "abc", ""), newEdit(3, "abc", "ABC")}, + {"abcdef", newEdit(0, "abc", ""), newEdit(-1, "abc", "ABC")}, + } + + for _, spec := range tests { + actual, err := Mutate(spec.input, []Edit{spec.edit1, spec.edit2}) + testName := fmt.Sprintf("Mutate(%s, Edits{(%v, %v -> %v), (%v, %v -> %v)})", spec.input, + spec.edit1.Location, spec.edit1.Old, spec.edit1.New, + spec.edit2.Location, spec.edit2.Old, spec.edit2.New) + + if err == nil { + t.Errorf("%s should error, but got (%v)", testName, actual) + } + } +} diff --git a/internal/sql/ast/CLAUDE.md b/internal/sql/ast/CLAUDE.md new file mode 100644 index 0000000000..e769fbfca6 --- /dev/null +++ b/internal/sql/ast/CLAUDE.md @@ -0,0 +1,116 @@ +# 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)` - formats the node back to SQL + +### TrackedBuffer +The `TrackedBuffer` type (`pg_query.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) + +### 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 +- MySQL user variables (`@user_id`) use `VariableExpr` - preserved as-is in output +- sqlc named parameters (`@param`) use `A_Expr` with `@` operator - replaced with `?` +- The `named.IsParamSign()` function checks for `A_Expr` with `@` operator + +### 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..0437dac84f 100644 --- a/internal/sql/ast/a_array_expr.go +++ b/internal/sql/ast/a_array_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_ArrayExpr struct { Elements *List Location int @@ -8,3 +10,12 @@ type A_ArrayExpr struct { 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 720dca4a11..a6b610e349 100644 --- a/internal/sql/ast/a_const.go +++ b/internal/sql/ast/a_const.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Const struct { Val Node Location int @@ -8,3 +10,16 @@ type A_Const struct { func (n *A_Const) Pos() int { return n.Location } + +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, d) + buf.WriteString("'") + } else { + buf.astFormat(n.Val, d) + } +} diff --git a/internal/sql/ast/a_expr.go b/internal/sql/ast/a_expr.go index 415dd1e23f..4e67967baa 100644 --- a/internal/sql/ast/a_expr.go +++ b/internal/sql/ast/a_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Expr struct { Kind A_Expr_Kind Name *List @@ -11,3 +13,95 @@ type A_Expr struct { func (n *A_Expr) Pos() int { return n.Location } + +// isNamedParam returns true if this A_Expr represents a named parameter (@name) +// and extracts the parameter name if so. +func (n *A_Expr) isNamedParam() (string, bool) { + if n.Name == nil || len(n.Name.Items) != 1 { + return "", false + } + s, ok := n.Name.Items[0].(*String) + if !ok || s.Str != "@" { + return "", false + } + if set(n.Lexpr) || !set(n.Rexpr) { + return "", false + } + if nameStr, ok := n.Rexpr.(*String); ok { + return nameStr.Str, true + } + return "", false +} + +func (n *A_Expr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + // Check for named parameter first (works regardless of Kind) + if name, ok := n.isNamedParam(); ok { + buf.WriteString(d.NamedParam(name)) + return + } + + switch n.Kind { + case A_Expr_Kind_IN: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" IN (") + buf.astFormat(n.Rexpr, d) + buf.WriteString(")") + case A_Expr_Kind_LIKE: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" LIKE ") + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_ILIKE: + buf.astFormat(n.Lexpr, d) + 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: + // 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) { + 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 50fc6bc6bb..3adc9232cf 100644 --- a/internal/sql/ast/a_expr_kind.go +++ b/internal/sql/ast/a_expr_kind.go @@ -2,6 +2,23 @@ package ast type A_Expr_Kind uint +const ( + 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 { return 0 } diff --git a/internal/sql/ast/a_indices.go b/internal/sql/ast/a_indices.go index 8972f3a556..7180f220e7 100644 --- a/internal/sql/ast/a_indices.go +++ b/internal/sql/ast/a_indices.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Indices struct { IsSlice bool Lidx Node @@ -9,3 +11,22 @@ type A_Indices struct { 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_star.go b/internal/sql/ast/a_star.go index accd0f7dd8..7e5f07b96a 100644 --- a/internal/sql/ast/a_star.go +++ b/internal/sql/ast/a_star.go @@ -1,8 +1,17 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Star struct { } func (n *A_Star) Pos() int { return 0 } + +func (n *A_Star) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteRune('*') +} diff --git a/internal/sql/ast/aggref.go b/internal/sql/ast/aggref.go index c4fa9af7e5..6642f4d9e3 100644 --- a/internal/sql/ast/aggref.go +++ b/internal/sql/ast/aggref.go @@ -6,7 +6,6 @@ type Aggref struct { Aggtype Oid Aggcollid Oid Inputcollid Oid - Aggtranstype Oid Aggargtypes *List Aggdirectargs *List Args *List diff --git a/internal/sql/ast/alias.go b/internal/sql/ast/alias.go index 7c6302a5ef..7123982305 100644 --- a/internal/sql/ast/alias.go +++ b/internal/sql/ast/alias.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Alias struct { Aliasname *string Colnames *List @@ -8,3 +10,17 @@ type Alias struct { func (n *Alias) Pos() int { return 0 } + +func (n *Alias) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Aliasname != nil { + buf.WriteString(*n.Aliasname) + } + if items(n.Colnames) { + buf.WriteString("(") + buf.astFormat(n.Colnames, d) + buf.WriteString(")") + } +} diff --git a/internal/sql/ast/alter_table_cmd.go b/internal/sql/ast/alter_table_cmd.go index 3c6be340cd..90ffd891eb 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 @@ -39,3 +41,17 @@ type AlterTableCmd struct { func (n *AlterTableCmd) Pos() int { return 0 } + +func (n *AlterTableCmd) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + switch n.Subtype { + case AT_AddColumn: + buf.WriteString(" ADD COLUMN ") + case AT_DropColumn: + buf.WriteString(" DROP COLUMN ") + } + + buf.astFormat(n.Def, d) +} diff --git a/internal/sql/ast/alter_table_set_schema_stmt.go b/internal/sql/ast/alter_table_set_schema_stmt.go index 51ca9f5bef..890cb3e5e8 100644 --- a/internal/sql/ast/alter_table_set_schema_stmt.go +++ b/internal/sql/ast/alter_table_set_schema_stmt.go @@ -3,6 +3,7 @@ package ast type AlterTableSetSchemaStmt struct { Table *TableName NewSchema *string + MissingOk bool } func (n *AlterTableSetSchemaStmt) Pos() int { diff --git a/internal/sql/ast/alter_table_stmt.go b/internal/sql/ast/alter_table_stmt.go index 245d7c6821..4dc88707ff 100644 --- a/internal/sql/ast/alter_table_stmt.go +++ b/internal/sql/ast/alter_table_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type AlterTableStmt struct { // TODO: Only TableName or Relation should be defined Relation *RangeVar @@ -12,3 +14,13 @@ type AlterTableStmt struct { func (n *AlterTableStmt) Pos() int { return 0 } + +func (n *AlterTableStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("ALTER TABLE ") + buf.astFormat(n.Relation, d) + buf.astFormat(n.Table, d) + buf.astFormat(n.Cmds, d) +} diff --git a/internal/sql/ast/alter_type_add_value_stmt.go b/internal/sql/ast/alter_type_add_value_stmt.go index 58085bbac3..56ae7dd9b7 100644 --- a/internal/sql/ast/alter_type_add_value_stmt.go +++ b/internal/sql/ast/alter_type_add_value_stmt.go @@ -3,6 +3,9 @@ package ast type AlterTypeAddValueStmt struct { Type *TypeName NewValue *string + NewValHasNeighbor bool + NewValNeighbor *string + NewValIsAfter bool SkipIfNewValExists bool } diff --git a/internal/sql/ast/alter_type_set_schema_stmt.go b/internal/sql/ast/alter_type_set_schema_stmt.go new file mode 100644 index 0000000000..22206d85cd --- /dev/null +++ b/internal/sql/ast/alter_type_set_schema_stmt.go @@ -0,0 +1,10 @@ +package ast + +type AlterTypeSetSchemaStmt struct { + Type *TypeName + NewSchema *string +} + +func (n *AlterTypeSetSchemaStmt) Pos() int { + return 0 +} diff --git a/internal/sql/ast/between_expr.go b/internal/sql/ast/between_expr.go new file mode 100644 index 0000000000..a160f1892c --- /dev/null +++ b/internal/sql/ast/between_expr.go @@ -0,0 +1,34 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +type BetweenExpr struct { + // Expr is the value expression to be compared. + Expr Node + // Left is the left expression in the between statement. + Left Node + // Right is the right expression in the between statement. + Right Node + // Not is true, the expression is "not between". + Not bool + Location int +} + +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/bool_expr.go b/internal/sql/ast/bool_expr.go index 41ddba949b..f2c0243a9c 100644 --- a/internal/sql/ast/bool_expr.go +++ b/internal/sql/ast/bool_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type BoolExpr struct { Xpr Node Boolop BoolExprType @@ -10,3 +12,38 @@ type BoolExpr struct { func (n *BoolExpr) Pos() int { return n.Location } + +func (n *BoolExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + 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: + buf.WriteString("(") + if items(n.Args) { + switch n.Boolop { + case BoolExprTypeAnd: + buf.join(n.Args, d, " AND ") + case BoolExprTypeOr: + buf.join(n.Args, d, " OR ") + } + } + buf.WriteString(")") + } +} diff --git a/internal/sql/ast/bool_expr_type.go b/internal/sql/ast/bool_expr_type.go index 29f8c881e9..7a4068d102 100644 --- a/internal/sql/ast/bool_expr_type.go +++ b/internal/sql/ast/bool_expr_type.go @@ -1,5 +1,17 @@ package ast +// https://github.com/pganalyze/libpg_query/blob/13-latest/protobuf/pg_query.proto#L2783-L2789 +const ( + _ BoolExprType = iota + BoolExprTypeAnd + BoolExprTypeOr + BoolExprTypeNot + + // Added for MySQL + BoolExprTypeIsNull + BoolExprTypeIsNotNull +) + type BoolExprType uint func (n *BoolExprType) Pos() int { diff --git a/internal/sql/ast/boolean.go b/internal/sql/ast/boolean.go new file mode 100644 index 0000000000..16a6db54da --- /dev/null +++ b/internal/sql/ast/boolean.go @@ -0,0 +1,26 @@ +package ast + +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + +type Boolean struct { + Boolval bool +} + +func (n *Boolean) Pos() int { + return 0 +} + +func (n *Boolean) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Boolval { + fmt.Fprintf(buf, "true") + } else { + fmt.Fprintf(buf, "false") + } +} diff --git a/internal/sql/ast/call_stmt.go b/internal/sql/ast/call_stmt.go new file mode 100644 index 0000000000..6cba39986e --- /dev/null +++ b/internal/sql/ast/call_stmt.go @@ -0,0 +1,19 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +type CallStmt struct { + FuncCall *FuncCall +} + +func (n *CallStmt) Pos() int { + if n.FuncCall == nil { + return 0 + } + return n.FuncCall.Pos() +} + +func (n *CallStmt) Format(buf *TrackedBuffer, d format.Dialect) { + buf.WriteString("CALL ") + buf.astFormat(n.FuncCall, d) +} diff --git a/internal/sql/ast/case_expr.go b/internal/sql/ast/case_expr.go index c23ffae2a4..52692b297b 100644 --- a/internal/sql/ast/case_expr.go +++ b/internal/sql/ast/case_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CaseExpr struct { Xpr Node Casetype Oid @@ -13,3 +15,20 @@ type CaseExpr struct { func (n *CaseExpr) Pos() int { return n.Location } + +func (n *CaseExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("CASE ") + 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_when.go b/internal/sql/ast/case_when.go index 9b8a488955..9636d24a97 100644 --- a/internal/sql/ast/case_when.go +++ b/internal/sql/ast/case_when.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CaseWhen struct { Xpr Node Expr Node @@ -10,3 +12,13 @@ type CaseWhen struct { func (n *CaseWhen) Pos() int { return n.Location } + +func (n *CaseWhen) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("WHEN ") + buf.astFormat(n.Expr, d) + buf.WriteString(" THEN ") + buf.astFormat(n.Result, d) +} diff --git a/internal/sql/ast/coalesce_expr.go b/internal/sql/ast/coalesce_expr.go index 513b495445..0faee5bf4c 100644 --- a/internal/sql/ast/coalesce_expr.go +++ b/internal/sql/ast/coalesce_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CoalesceExpr struct { Xpr Node Coalescetype Oid @@ -11,3 +13,12 @@ type CoalesceExpr struct { func (n *CoalesceExpr) Pos() int { return n.Location } + +func (n *CoalesceExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("COALESCE(") + buf.astFormat(n.Args, d) + buf.WriteString(")") +} diff --git a/internal/sql/ast/collate_expr.go b/internal/sql/ast/collate_expr.go index 6c32eece77..80483f75ce 100644 --- a/internal/sql/ast/collate_expr.go +++ b/internal/sql/ast/collate_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CollateExpr struct { Xpr Node Arg Node @@ -10,3 +12,12 @@ type CollateExpr struct { 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 279f97bf48..225cdd4779 100644 --- a/internal/sql/ast/column_def.go +++ b/internal/sql/ast/column_def.go @@ -1,12 +1,17 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ColumnDef struct { - Colname string - TypeName *TypeName - IsNotNull bool - IsArray bool - Vals *List - Length *int + Colname string + TypeName *TypeName + IsNotNull bool + IsUnsigned bool + IsArray bool + ArrayDims int + Vals *List + Length *int + PrimaryKey bool // From pg.ColumnDef Inhcount int @@ -28,3 +33,23 @@ type ColumnDef struct { func (n *ColumnDef) Pos() int { return n.Location } + +func (n *ColumnDef) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString(n.Colname) + buf.WriteString(" ") + buf.astFormat(n.TypeName, d) + // 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, d) +} diff --git a/internal/sql/ast/column_ref.go b/internal/sql/ast/column_ref.go index 891fa163f7..943311799d 100644 --- a/internal/sql/ast/column_ref.go +++ b/internal/sql/ast/column_ref.go @@ -1,5 +1,11 @@ package ast +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + type ColumnRef struct { Name string @@ -11,3 +17,22 @@ type ColumnRef struct { func (n *ColumnRef) Pos() int { return n.Location } + +func (n *ColumnRef) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + if n.Fields != nil { + var items []string + for _, item := range n.Fields.Items { + switch nn := item.(type) { + case *String: + items = append(items, d.QuoteIdent(nn.Str)) + case *A_Star: + items = append(items, "*") + } + } + buf.WriteString(strings.Join(items, ".")) + } +} diff --git a/internal/sql/ast/comment_on_view_stmt.go b/internal/sql/ast/comment_on_view_stmt.go new file mode 100644 index 0000000000..2648d87918 --- /dev/null +++ b/internal/sql/ast/comment_on_view_stmt.go @@ -0,0 +1,10 @@ +package ast + +type CommentOnViewStmt struct { + View *TableName + Comment *string +} + +func (n *CommentOnViewStmt) Pos() int { + return 0 +} diff --git a/internal/sql/ast/common_table_expr.go b/internal/sql/ast/common_table_expr.go index d5ae01f040..aa334167ce 100644 --- a/internal/sql/ast/common_table_expr.go +++ b/internal/sql/ast/common_table_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CommonTableExpr struct { Ctename *string Aliascolnames *List @@ -16,3 +18,20 @@ type CommonTableExpr struct { func (n *CommonTableExpr) Pos() int { return n.Location } + +func (n *CommonTableExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Ctename != nil { + buf.WriteString(*n.Ctename) + } + if items(n.Aliascolnames) { + buf.WriteString("(") + buf.join(n.Aliascolnames, d, ", ") + buf.WriteString(")") + } + buf.WriteString(" AS (") + buf.astFormat(n.Ctequery, d) + buf.WriteString(")") +} diff --git a/internal/sql/ast/create_extension_stmt.go b/internal/sql/ast/create_extension_stmt.go index 2fe8755b6a..140a10da4c 100644 --- a/internal/sql/ast/create_extension_stmt.go +++ b/internal/sql/ast/create_extension_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CreateExtensionStmt struct { Extname *string IfNotExists bool @@ -9,3 +11,16 @@ type CreateExtensionStmt struct { 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_function_stmt.go b/internal/sql/ast/create_function_stmt.go index a1e0b8f728..f5200085ee 100644 --- a/internal/sql/ast/create_function_stmt.go +++ b/internal/sql/ast/create_function_stmt.go @@ -1,11 +1,13 @@ 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 + // TODO: Understand these two fields Options *List WithClause *List } @@ -13,3 +15,31 @@ type CreateFunctionStmt struct { 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_table_stmt.go b/internal/sql/ast/create_table_stmt.go index 96512ea3fa..f7ab2f9f60 100644 --- a/internal/sql/ast/create_table_stmt.go +++ b/internal/sql/ast/create_table_stmt.go @@ -1,13 +1,33 @@ 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 } func (n *CreateTableStmt) Pos() int { return 0 } + +func (n *CreateTableStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("CREATE TABLE ") + buf.astFormat(n.Name, d) + + buf.WriteString("(") + for i, col := range n.Cols { + if i > 0 { + buf.WriteString(", ") + } + buf.astFormat(col, d) + } + buf.WriteString(")") +} diff --git a/internal/sql/ast/def_elem.go b/internal/sql/ast/def_elem.go index 03ecf88e77..33aacaaa03 100644 --- a/internal/sql/ast/def_elem.go +++ b/internal/sql/ast/def_elem.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DefElem struct { Defnamespace *string Defname *string @@ -11,3 +13,56 @@ type DefElem struct { 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/delete_stmt.go b/internal/sql/ast/delete_stmt.go index 3e28add176..d23617881a 100644 --- a/internal/sql/ast/delete_stmt.go +++ b/internal/sql/ast/delete_stmt.go @@ -1,13 +1,68 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DeleteStmt struct { - Relation *RangeVar + Relations *List UsingClause *List WhereClause Node + LimitCount Node ReturningList *List WithClause *WithClause + // MySQL multi-table DELETE support + Targets *List // Tables to delete from (e.g., jt.*, pt.*) + FromClause Node // FROM clause with JOINs (Node to support JoinExpr) } func (n *DeleteStmt) Pos() int { return 0 } + +func (n *DeleteStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause, d) + buf.WriteString(" ") + } + + 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) + } + } + + if items(n.UsingClause) { + buf.WriteString(" USING ") + buf.join(n.UsingClause, d, ", ") + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause, d) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount, d) + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList, d) + } +} diff --git a/internal/sql/ast/do_stmt.go b/internal/sql/ast/do_stmt.go index edc831f15c..9becfb8e64 100644 --- a/internal/sql/ast/do_stmt.go +++ b/internal/sql/ast/do_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DoStmt struct { Args *List } @@ -7,3 +9,22 @@ type DoStmt struct { 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/float.go b/internal/sql/ast/float.go index 8e5ef10f97..94e8c2652f 100644 --- a/internal/sql/ast/float.go +++ b/internal/sql/ast/float.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Float struct { Str string } @@ -7,3 +9,10 @@ type Float struct { func (n *Float) Pos() int { return 0 } + +func (n *Float) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString(n.Str) +} diff --git a/internal/sql/ast/func_call.go b/internal/sql/ast/func_call.go index f3feb82225..cb4f210fe4 100644 --- a/internal/sql/ast/func_call.go +++ b/internal/sql/ast/func_call.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type FuncCall struct { Func *FuncName Funcname *List @@ -11,9 +13,54 @@ type FuncCall struct { AggDistinct bool FuncVariadic bool Over *WindowDef + Separator *string // MySQL GROUP_CONCAT SEPARATOR Location int } func (n *FuncCall) Pos() int { return n.Location } + +func (n *FuncCall) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Func, d) + buf.WriteString("(") + if n.AggDistinct { + buf.WriteString("DISTINCT ") + } + if n.AggStar { + buf.WriteString("*") + } else { + 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_name.go b/internal/sql/ast/func_name.go index e8b93a752c..cdf3e23d33 100644 --- a/internal/sql/ast/func_name.go +++ b/internal/sql/ast/func_name.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type FuncName struct { Catalog string Schema string @@ -9,3 +11,16 @@ type FuncName struct { func (n *FuncName) Pos() int { return 0 } + +func (n *FuncName) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Schema != "" { + buf.WriteString(n.Schema) + buf.WriteString(".") + } + if n.Name != "" { + buf.WriteString(n.Name) + } +} diff --git a/internal/sql/ast/func_param.go b/internal/sql/ast/func_param.go index faee6ede37..5881a1441f 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 ( @@ -8,6 +10,7 @@ const ( FuncParamInOut FuncParamVariadic FuncParamTable + FuncParamDefault ) type FuncParam struct { @@ -20,3 +23,25 @@ type FuncParam struct { 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/grant_role_stmt.go b/internal/sql/ast/grant_role_stmt.go index 5d785efa7e..5e0b2a8e87 100644 --- a/internal/sql/ast/grant_role_stmt.go +++ b/internal/sql/ast/grant_role_stmt.go @@ -4,7 +4,6 @@ type GrantRoleStmt struct { GrantedRoles *List GranteeRoles *List IsGrant bool - AdminOpt bool Grantor *RoleSpec Behavior DropBehavior } diff --git a/internal/sql/ast/in.go b/internal/sql/ast/in.go new file mode 100644 index 0000000000..9bdad67eeb --- /dev/null +++ b/internal/sql/ast/in.go @@ -0,0 +1,48 @@ +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 { + // Expr is the value expression to be compared. + Expr Node + // List is the list expression in compare list. + List []Node + // Not is true, the expression is "not in". + Not bool + // Sel is the subquery, may be rewritten to other type of expression. + Sel Node + Location int +} + +// 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..acc2a7fc23 100644 --- a/internal/sql/ast/index_elem.go +++ b/internal/sql/ast/index_elem.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type IndexElem struct { Name *string Expr Node @@ -13,3 +15,14 @@ type IndexElem struct { 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..fe0f03593c 100644 --- a/internal/sql/ast/index_stmt.go +++ b/internal/sql/ast/index_stmt.go @@ -11,7 +11,6 @@ type IndexStmt struct { ExcludeOpNames *List Idxcomment *string IndexOid Oid - OldNode Oid Unique bool Primary bool Isconstraint bool diff --git a/internal/sql/ast/infer_clause.go b/internal/sql/ast/infer_clause.go index 1e1d93c3d8..6df0db4a86 100644 --- a/internal/sql/ast/infer_clause.go +++ b/internal/sql/ast/infer_clause.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type InferClause struct { IndexElems *List WhereClause Node @@ -10,3 +12,21 @@ type InferClause struct { 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/insert_stmt.go b/internal/sql/ast/insert_stmt.go index 12ee24846c..4d5c8d1df2 100644 --- a/internal/sql/ast/insert_stmt.go +++ b/internal/sql/ast/insert_stmt.go @@ -1,15 +1,62 @@ 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 + Relation *RangeVar + Cols *List + SelectStmt Node + OnConflictClause *OnConflictClause + OnDuplicateKeyUpdate *OnDuplicateKeyUpdate // MySQL-specific + ReturningList *List + WithClause *WithClause + Override OverridingKind + DefaultValues bool // SQLite-specific: INSERT INTO ... DEFAULT VALUES } func (n *InsertStmt) Pos() int { return 0 } + +func (n *InsertStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause, d) + buf.WriteString(" ") + } + + buf.WriteString("INSERT INTO ") + if n.Relation != nil { + buf.astFormat(n.Relation, d) + } + if items(n.Cols) { + buf.WriteString(" (") + buf.astFormat(n.Cols, d) + buf.WriteString(")") + } + + if n.DefaultValues { + buf.WriteString(" DEFAULT VALUES") + } else if set(n.SelectStmt) { + buf.WriteString(" ") + buf.astFormat(n.SelectStmt, d) + } + + if n.OnConflictClause != nil { + buf.WriteString(" ") + buf.astFormat(n.OnConflictClause, d) + } + + if n.OnDuplicateKeyUpdate != nil { + buf.WriteString(" ") + buf.astFormat(n.OnDuplicateKeyUpdate, d) + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList, d) + } +} diff --git a/internal/sql/ast/integer.go b/internal/sql/ast/integer.go index a00e906b22..c0c360f2f2 100644 --- a/internal/sql/ast/integer.go +++ b/internal/sql/ast/integer.go @@ -1,5 +1,11 @@ package ast +import ( + "strconv" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + type Integer struct { Ival int64 } @@ -7,3 +13,10 @@ type Integer struct { func (n *Integer) Pos() int { return 0 } + +func (n *Integer) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString(strconv.FormatInt(n.Ival, 10)) +} diff --git a/internal/sql/ast/interval_expr.go b/internal/sql/ast/interval_expr.go new file mode 100644 index 0000000000..dac73a0557 --- /dev/null +++ b/internal/sql/ast/interval_expr.go @@ -0,0 +1,24 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// IntervalExpr represents a MySQL INTERVAL expression like "INTERVAL 1 DAY" +type IntervalExpr struct { + Value Node + Unit string + Location int +} + +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/join_expr.go b/internal/sql/ast/join_expr.go index 86e38d2d3b..8ac059d006 100644 --- a/internal/sql/ast/join_expr.go +++ b/internal/sql/ast/join_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type JoinExpr struct { Jointype JoinType IsNatural bool @@ -14,3 +16,39 @@ type JoinExpr struct { func (n *JoinExpr) Pos() int { return 0 } + +func (n *JoinExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Larg, d) + 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 JoinTypeInner: + // CROSS JOIN has no ON or USING clause + if !items(n.UsingClause) && !set(n.Quals) { + buf.WriteString(" CROSS JOIN ") + } else { + buf.WriteString(" 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.astFormat(n.Quals, d) + } +} diff --git a/internal/sql/ast/join_type.go b/internal/sql/ast/join_type.go index 0c77e40875..824e0b357f 100644 --- a/internal/sql/ast/join_type.go +++ b/internal/sql/ast/join_type.go @@ -1,5 +1,19 @@ package ast +// JoinType is the reported type of the join +// Enum copies https://github.com/pganalyze/libpg_query/blob/13-latest/protobuf/pg_query.proto#L2890-L2901 +const ( + _ JoinType = iota + JoinTypeInner + JoinTypeLeft + JoinTypeFull + JoinTypeRight + JoinTypeSemi + JoinTypeAnti + JoinTypeUniqueOuter + JoinTypeUniqueInner +) + type JoinType uint func (n *JoinType) Pos() int { diff --git a/internal/sql/ast/list.go b/internal/sql/ast/list.go index ae49b0c429..3bb9d90dcd 100644 --- a/internal/sql/ast/list.go +++ b/internal/sql/ast/list.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type List struct { Items []Node } @@ -7,3 +9,10 @@ type List struct { func (n *List) Pos() int { return 0 } + +func (n *List) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.join(n, d, ", ") +} diff --git a/internal/sql/ast/listen_stmt.go b/internal/sql/ast/listen_stmt.go index cbd51dd90a..48c38419a8 100644 --- a/internal/sql/ast/listen_stmt.go +++ b/internal/sql/ast/listen_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ListenStmt struct { Conditionname *string } @@ -7,3 +9,13 @@ type ListenStmt struct { func (n *ListenStmt) Pos() int { return 0 } + +func (n *ListenStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("LISTEN ") + if n.Conditionname != nil { + buf.WriteString(*n.Conditionname) + } +} diff --git a/internal/sql/ast/locking_clause.go b/internal/sql/ast/locking_clause.go index 5800a03806..6202b4ae02 100644 --- a/internal/sql/ast/locking_clause.go +++ b/internal/sql/ast/locking_clause.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type LockingClause struct { LockedRels *List Strength LockClauseStrength @@ -9,3 +11,47 @@ type LockingClause struct { func (n *LockingClause) Pos() int { return 0 } + +// 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 LockClauseStrengthForKeyShare: + buf.WriteString("KEY SHARE") + case LockClauseStrengthForShare: + buf.WriteString("SHARE") + 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/multi_assign_ref.go b/internal/sql/ast/multi_assign_ref.go index ef0d5554c3..94b783bcc1 100644 --- a/internal/sql/ast/multi_assign_ref.go +++ b/internal/sql/ast/multi_assign_ref.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type MultiAssignRef struct { Source Node Colno int @@ -9,3 +11,10 @@ type MultiAssignRef struct { func (n *MultiAssignRef) Pos() int { return 0 } + +func (n *MultiAssignRef) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Source, d) +} diff --git a/internal/sql/ast/named_arg_expr.go b/internal/sql/ast/named_arg_expr.go index 1c802bdd26..a711fd2712 100644 --- a/internal/sql/ast/named_arg_expr.go +++ b/internal/sql/ast/named_arg_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NamedArgExpr struct { Xpr Node Arg Node @@ -11,3 +13,14 @@ type NamedArgExpr struct { func (n *NamedArgExpr) Pos() int { return n.Location } + +func (n *NamedArgExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Name != nil { + buf.WriteString(*n.Name) + } + buf.WriteString(" => ") + buf.astFormat(n.Arg, d) +} diff --git a/internal/sql/ast/notify_stmt.go b/internal/sql/ast/notify_stmt.go index ef3058df56..abecb94360 100644 --- a/internal/sql/ast/notify_stmt.go +++ b/internal/sql/ast/notify_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NotifyStmt struct { Conditionname *string Payload *string @@ -8,3 +10,18 @@ type NotifyStmt struct { func (n *NotifyStmt) Pos() int { return 0 } + +func (n *NotifyStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("NOTIFY ") + if n.Conditionname != nil { + buf.WriteString(*n.Conditionname) + } + if n.Payload != nil { + buf.WriteString(", '") + buf.WriteString(*n.Payload) + buf.WriteString("'") + } +} diff --git a/internal/sql/ast/null.go b/internal/sql/ast/null.go index 92abc76c02..e3606e2d7f 100644 --- a/internal/sql/ast/null.go +++ b/internal/sql/ast/null.go @@ -1,8 +1,13 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Null struct { } func (n *Null) Pos() int { return 0 } +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..3436bff0a5 100644 --- a/internal/sql/ast/null_test_expr.go +++ b/internal/sql/ast/null_test_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NullTest struct { Xpr Node Arg Node @@ -11,3 +13,22 @@ type NullTest struct { 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/on_conflict_clause.go b/internal/sql/ast/on_conflict_clause.go index 25333d6d59..a71bae0a23 100644 --- a/internal/sql/ast/on_conflict_clause.go +++ b/internal/sql/ast/on_conflict_clause.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type OnConflictClause struct { Action OnConflictAction Infer *InferClause @@ -11,3 +13,49 @@ type OnConflictClause struct { 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 ") + // Format as assignment list: name = val + 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) + } + } + } + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause, d) + } + } +} 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..a11ce1ab18 --- /dev/null +++ b/internal/sql/ast/on_duplicate_key_update.go @@ -0,0 +1,37 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// OnDuplicateKeyUpdate represents MySQL's ON DUPLICATE KEY UPDATE clause +type OnDuplicateKeyUpdate struct { + // TargetList contains the assignments (column = value pairs) + TargetList *List + Location int +} + +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..0c7c21726e 100644 --- a/internal/sql/ast/op_expr.go +++ b/internal/sql/ast/op_expr.go @@ -3,7 +3,6 @@ package ast type OpExpr struct { Xpr Node Opno Oid - Opfuncid Oid Opresulttype Oid Opretset bool Opcollid Oid diff --git a/internal/sql/ast/param_ref.go b/internal/sql/ast/param_ref.go index cc17dc065d..7ebc897a95 100644 --- a/internal/sql/ast/param_ref.go +++ b/internal/sql/ast/param_ref.go @@ -1,10 +1,20 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ParamRef struct { Number int Location int + Dollar bool } func (n *ParamRef) Pos() int { return n.Location } + +func (n *ParamRef) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString(d.Param(n.Number)) +} diff --git a/internal/sql/ast/paren_expr.go b/internal/sql/ast/paren_expr.go new file mode 100644 index 0000000000..831d461f3e --- /dev/null +++ b/internal/sql/ast/paren_expr.go @@ -0,0 +1,22 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// ParenExpr represents a parenthesized expression +type ParenExpr struct { + Expr Node + Location int +} + +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/print.go b/internal/sql/ast/print.go new file mode 100644 index 0000000000..87f6107622 --- /dev/null +++ b/internal/sql/ast/print.go @@ -0,0 +1,81 @@ +package ast + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + +type nodeFormatter interface { + Format(*TrackedBuffer, format.Dialect) +} + +type TrackedBuffer struct { + *strings.Builder +} + +// NewTrackedBuffer creates a new TrackedBuffer. +func NewTrackedBuffer() *TrackedBuffer { + return &TrackedBuffer{ + Builder: new(strings.Builder), + } +} + +func (t *TrackedBuffer) astFormat(n Node, d format.Dialect) { + if ft, ok := n.(nodeFormatter); ok { + ft.Format(t, d) + } else { + debug.Dump(n) + } +} + +func (t *TrackedBuffer) join(n *List, d format.Dialect, sep string) { + if n == nil { + return + } + for i, item := range n.Items { + if _, ok := item.(*TODO); ok { + continue + } + if i > 0 { + t.WriteString(sep) + } + t.astFormat(item, d) + } +} + +func Format(n Node, d format.Dialect) string { + tb := NewTrackedBuffer() + if ft, ok := n.(nodeFormatter); ok { + ft.Format(tb, d) + } + return tb.String() +} + +func set(n Node) bool { + if n == nil { + return false + } + _, ok := n.(*TODO) + if ok { + return false + } + return true +} + +func items(n *List) bool { + if n == nil { + return false + } + return len(n.Items) > 0 +} + +func todo(n *List) bool { + for _, item := range n.Items { + if _, ok := item.(*TODO); !ok { + return false + } + } + return true +} diff --git a/internal/sql/ast/range_function.go b/internal/sql/ast/range_function.go index dd92870aa4..dca63595d8 100644 --- a/internal/sql/ast/range_function.go +++ b/internal/sql/ast/range_function.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeFunction struct { Lateral bool Ordinality bool @@ -12,3 +14,20 @@ type RangeFunction struct { func (n *RangeFunction) Pos() int { return 0 } + +func (n *RangeFunction) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Lateral { + buf.WriteString("LATERAL ") + } + buf.astFormat(n.Functions, d) + if n.Ordinality { + buf.WriteString(" WITH ORDINALITY") + } + if n.Alias != nil { + buf.WriteString(" AS ") + buf.astFormat(n.Alias, d) + } +} diff --git a/internal/sql/ast/range_subselect.go b/internal/sql/ast/range_subselect.go index aaf4d5adaf..51a8825e2b 100644 --- a/internal/sql/ast/range_subselect.go +++ b/internal/sql/ast/range_subselect.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeSubselect struct { Lateral bool Subquery Node @@ -9,3 +11,19 @@ type RangeSubselect struct { func (n *RangeSubselect) Pos() int { return 0 } + +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, d) + buf.WriteString(")") + if n.Alias != nil { + buf.WriteString(" AS ") + buf.astFormat(n.Alias, d) + } +} diff --git a/internal/sql/ast/range_var.go b/internal/sql/ast/range_var.go index 3b648ff7c3..250b2b3bbf 100644 --- a/internal/sql/ast/range_var.go +++ b/internal/sql/ast/range_var.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeVar struct { Catalogname *string Schemaname *string @@ -13,3 +15,20 @@ type RangeVar struct { func (n *RangeVar) Pos() int { return n.Location } + +func (n *RangeVar) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Schemaname != nil && *n.Schemaname != "" { + buf.WriteString(d.QuoteIdent(*n.Schemaname)) + buf.WriteString(".") + } + if n.Relname != nil { + buf.WriteString(d.QuoteIdent(*n.Relname)) + } + if n.Alias != nil { + 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 3e9e89329f..fe02bed803 100644 --- a/internal/sql/ast/raw_stmt.go +++ b/internal/sql/ast/raw_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RawStmt struct { Stmt Node StmtLocation int @@ -9,3 +11,10 @@ type RawStmt struct { func (n *RawStmt) Pos() int { return n.StmtLocation } + +func (n *RawStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n.Stmt != nil { + buf.astFormat(n.Stmt, d) + } + buf.WriteString(";") +} diff --git a/internal/sql/ast/refresh_mat_view_stmt.go b/internal/sql/ast/refresh_mat_view_stmt.go index 9284c343de..f627e7bf21 100644 --- a/internal/sql/ast/refresh_mat_view_stmt.go +++ b/internal/sql/ast/refresh_mat_view_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RefreshMatViewStmt struct { Concurrent bool SkipData bool @@ -9,3 +11,11 @@ type RefreshMatViewStmt struct { func (n *RefreshMatViewStmt) Pos() int { return 0 } + +func (n *RefreshMatViewStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("REFRESH MATERIALIZED VIEW ") + buf.astFormat(n.Relation, d) +} diff --git a/internal/sql/ast/rename_column_stmt.go b/internal/sql/ast/rename_column_stmt.go index e85c91e673..498b89d6ef 100644 --- a/internal/sql/ast/rename_column_stmt.go +++ b/internal/sql/ast/rename_column_stmt.go @@ -1,9 +1,10 @@ package ast type RenameColumnStmt struct { - Table *TableName - Col *ColumnRef - NewName *string + Table *TableName + Col *ColumnRef + NewName *string + MissingOk bool } func (n *RenameColumnStmt) Pos() int { diff --git a/internal/sql/ast/rename_table_stmt.go b/internal/sql/ast/rename_table_stmt.go index 53464c7795..b879ddb0b7 100644 --- a/internal/sql/ast/rename_table_stmt.go +++ b/internal/sql/ast/rename_table_stmt.go @@ -1,8 +1,9 @@ package ast type RenameTableStmt struct { - Table *TableName - NewName *string + Table *TableName + NewName *string + MissingOk bool } func (n *RenameTableStmt) Pos() int { diff --git a/internal/sql/ast/rename_type_stmt.go b/internal/sql/ast/rename_type_stmt.go new file mode 100644 index 0000000000..67472d02f2 --- /dev/null +++ b/internal/sql/ast/rename_type_stmt.go @@ -0,0 +1,10 @@ +package ast + +type RenameTypeStmt struct { + Type *TypeName + NewName *string +} + +func (n *RenameTypeStmt) Pos() int { + return 0 +} diff --git a/internal/sql/ast/res_target.go b/internal/sql/ast/res_target.go index f9428e3885..dc34879942 100644 --- a/internal/sql/ast/res_target.go +++ b/internal/sql/ast/res_target.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ResTarget struct { Name *string Indirection *List @@ -10,3 +12,20 @@ type ResTarget struct { func (n *ResTarget) Pos() int { return n.Location } + +func (n *ResTarget) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if set(n.Val) { + buf.astFormat(n.Val, d) + if n.Name != nil { + buf.WriteString(" AS ") + buf.WriteString(d.QuoteIdent(*n.Name)) + } + } else { + if n.Name != nil { + buf.WriteString(d.QuoteIdent(*n.Name)) + } + } +} diff --git a/internal/sql/ast/row_expr.go b/internal/sql/ast/row_expr.go index 7e996b0e93..0f8578355a 100644 --- a/internal/sql/ast/row_expr.go +++ b/internal/sql/ast/row_expr.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RowExpr struct { Xpr Node Args *List @@ -12,3 +14,18 @@ type RowExpr struct { func (n *RowExpr) Pos() int { return n.Location } + +func (n *RowExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if items(n.Args) { + buf.WriteString("args") + buf.astFormat(n.Args, d) + } + buf.astFormat(n.Xpr, d) + if items(n.Colnames) { + buf.WriteString("cols") + buf.astFormat(n.Colnames, d) + } +} diff --git a/internal/sql/ast/scalar_array_op_expr.go b/internal/sql/ast/scalar_array_op_expr.go index 6b9ad6ad8b..b4f36548b3 100644 --- a/internal/sql/ast/scalar_array_op_expr.go +++ b/internal/sql/ast/scalar_array_op_expr.go @@ -1,9 +1,10 @@ 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 @@ -13,3 +14,22 @@ type ScalarArrayOpExpr struct { 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/select_stmt.go b/internal/sql/ast/select_stmt.go index 75a109c931..62e6f1c9cf 100644 --- a/internal/sql/ast/select_stmt.go +++ b/internal/sql/ast/select_stmt.go @@ -1,5 +1,11 @@ package ast +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + type SelectStmt struct { DistinctClause *List IntoClause *IntoClause @@ -24,3 +30,97 @@ type SelectStmt struct { func (n *SelectStmt) Pos() int { return 0 } + +func (n *SelectStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + if items(n.ValuesLists) { + 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.astFormat(row, d) + buf.WriteString(")") + } + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause, d) + buf.WriteString(" ") + } + + if n.Larg != nil && n.Rarg != nil { + buf.astFormat(n.Larg, d) + switch n.Op { + case Union: + buf.WriteString(" UNION ") + case Except: + buf.WriteString(" EXCEPT ") + case Intersect: + buf.WriteString(" INTERSECT ") + } + if n.All { + buf.WriteString("ALL ") + } + 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, d) + fmt.Fprintf(buf, ")") + } + } + buf.astFormat(n.TargetList, d) + + if items(n.FromClause) { + buf.WriteString(" FROM ") + buf.astFormat(n.FromClause, d) + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause, d) + } + + if items(n.GroupClause) { + buf.WriteString(" GROUP BY ") + buf.astFormat(n.GroupClause, d) + } + + if set(n.HavingClause) { + buf.WriteString(" HAVING ") + buf.astFormat(n.HavingClause, d) + } + + if items(n.SortClause) { + buf.WriteString(" ORDER BY ") + buf.astFormat(n.SortClause, d) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount, d) + } + + if set(n.LimitOffset) { + buf.WriteString(" OFFSET ") + buf.astFormat(n.LimitOffset, d) + } + + if items(n.LockingClause) { + buf.WriteString(" ") + buf.astFormat(n.LockingClause, d) + } + +} diff --git a/internal/sql/ast/sort_by.go b/internal/sql/ast/sort_by.go index 49c4004f28..b8634b7d6d 100644 --- a/internal/sql/ast/sort_by.go +++ b/internal/sql/ast/sort_by.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type SortBy struct { Node Node SortbyDir SortByDir @@ -11,3 +13,22 @@ type SortBy struct { func (n *SortBy) Pos() int { return n.Location } + +func (n *SortBy) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + 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_by_dir.go b/internal/sql/ast/sort_by_dir.go index f7f8d53950..3ebd212a79 100644 --- a/internal/sql/ast/sort_by_dir.go +++ b/internal/sql/ast/sort_by_dir.go @@ -5,3 +5,11 @@ type SortByDir uint func (n *SortByDir) Pos() int { return 0 } + +const ( + SortByDirUndefined SortByDir = 0 + SortByDirDefault SortByDir = 1 + SortByDirAsc SortByDir = 2 + SortByDirDesc SortByDir = 3 + SortByDirUsing SortByDir = 4 +) diff --git a/internal/sql/ast/sort_by_nulls.go b/internal/sql/ast/sort_by_nulls.go index c4d67c5d7f..512b5a14e1 100644 --- a/internal/sql/ast/sort_by_nulls.go +++ b/internal/sql/ast/sort_by_nulls.go @@ -5,3 +5,10 @@ type SortByNulls uint func (n *SortByNulls) Pos() int { return 0 } + +const ( + SortByNullsUndefined SortByNulls = 0 + SortByNullsDefault SortByNulls = 1 + SortByNullsFirst SortByNulls = 2 + SortByNullsLast SortByNulls = 3 +) diff --git a/internal/sql/ast/sql_value_function.go b/internal/sql/ast/sql_value_function.go index a2e5214cb0..31bd008245 100644 --- a/internal/sql/ast/sql_value_function.go +++ b/internal/sql/ast/sql_value_function.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type SQLValueFunction struct { Xpr Node Op SQLValueFunctionOp @@ -11,3 +13,27 @@ type SQLValueFunction struct { func (n *SQLValueFunction) Pos() int { return n.Location } + +func (n *SQLValueFunction) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + switch n.Op { + case SVFOpCurrentDate: + buf.WriteString("CURRENT_DATE") + case SVFOpCurrentTime: + case SVFOpCurrentTimeN: + case SVFOpCurrentTimestamp: + case SVFOpCurrentTimestampN: + case SVFOpLocaltime: + case SVFOpLocaltimeN: + case SVFOpLocaltimestamp: + case SVFOpLocaltimestampN: + case SVFOpCurrentRole: + case SVFOpCurrentUser: + case SVFOpUser: + case SVFOpSessionUser: + case SVFOpCurrentCatalog: + case SVFOpCurrentSchema: + } +} diff --git a/internal/sql/ast/sql_value_function_op.go b/internal/sql/ast/sql_value_function_op.go index e781109c8e..5d99afa0d3 100644 --- a/internal/sql/ast/sql_value_function_op.go +++ b/internal/sql/ast/sql_value_function_op.go @@ -2,6 +2,26 @@ package ast type SQLValueFunctionOp uint +const ( + // https://github.com/pganalyze/libpg_query/blob/15-latest/protobuf/pg_query.proto#L2984C1-L3003C1 + _ SQLValueFunctionOp = iota + SVFOpCurrentDate + SVFOpCurrentTime + SVFOpCurrentTimeN + SVFOpCurrentTimestamp + SVFOpCurrentTimestampN + SVFOpLocaltime + SVFOpLocaltimeN + SVFOpLocaltimestamp + SVFOpLocaltimestampN + SVFOpCurrentRole + SVFOpCurrentUser + SVFOpUser + SVFOpSessionUser + SVFOpCurrentCatalog + SVFOpCurrentSchema +) + func (n *SQLValueFunctionOp) Pos() int { return 0 } diff --git a/internal/sql/ast/string.go b/internal/sql/ast/string.go index 619c786db9..d167ef4575 100644 --- a/internal/sql/ast/string.go +++ b/internal/sql/ast/string.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type String struct { Str string } @@ -7,3 +9,10 @@ type String struct { func (n *String) Pos() int { return 0 } + +func (n *String) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString(n.Str) +} diff --git a/internal/sql/ast/sub_link.go b/internal/sql/ast/sub_link.go index d61a629785..99b8458afe 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 ( @@ -26,3 +28,32 @@ type SubLink struct { func (n *SubLink) Pos() int { return n.Location } + +func (n *SubLink) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + // 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 (") + case ANY_SUBLINK: + if hasTestExpr { + buf.WriteString(" IN (") + } else { + buf.WriteString("IN (") + } + default: + if hasTestExpr { + buf.WriteString(" (") + } else { + buf.WriteString("(") + } + } + buf.astFormat(n.Subselect, d) + buf.WriteString(")") +} diff --git a/internal/sql/ast/table_name.go b/internal/sql/ast/table_name.go index ea77308b73..4f494a67e0 100644 --- a/internal/sql/ast/table_name.go +++ b/internal/sql/ast/table_name.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TableName struct { Catalog string Schema string @@ -9,3 +11,16 @@ type TableName struct { func (n *TableName) Pos() int { return 0 } + +func (n *TableName) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Schema != "" { + buf.WriteString(n.Schema) + buf.WriteString(".") + } + if n.Name != "" { + buf.WriteString(n.Name) + } +} diff --git a/internal/sql/ast/truncate_stmt.go b/internal/sql/ast/truncate_stmt.go index 6518fccdbc..6636e9f9e8 100644 --- a/internal/sql/ast/truncate_stmt.go +++ b/internal/sql/ast/truncate_stmt.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TruncateStmt struct { Relations *List RestartSeqs bool @@ -9,3 +11,11 @@ type TruncateStmt struct { func (n *TruncateStmt) Pos() int { return 0 } + +func (n *TruncateStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("TRUNCATE ") + buf.astFormat(n.Relations, d) +} diff --git a/internal/sql/ast/type_cast.go b/internal/sql/ast/type_cast.go index 8390f5b621..fe5b321abf 100644 --- a/internal/sql/ast/type_cast.go +++ b/internal/sql/ast/type_cast.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TypeCast struct { Arg Node TypeName *TypeName @@ -9,3 +11,17 @@ type TypeCast struct { func (n *TypeCast) Pos() int { return n.Location } + +func (n *TypeCast) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + // 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 eb67dddbcc..d8d91f4f87 100644 --- a/internal/sql/ast/type_name.go +++ b/internal/sql/ast/type_name.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TypeName struct { Catalog string Schema string @@ -19,3 +21,40 @@ type TypeName struct { func (n *TypeName) Pos() int { return n.Location } + +func (n *TypeName) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if items(n.Names) { + // 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/update_stmt.go b/internal/sql/ast/update_stmt.go index dd476a3587..5376a8c6ce 100644 --- a/internal/sql/ast/update_stmt.go +++ b/internal/sql/ast/update_stmt.go @@ -1,10 +1,17 @@ package ast +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + type UpdateStmt struct { - Relation *RangeVar + Relations *List TargetList *List WhereClause Node FromClause *List + LimitCount Node ReturningList *List WithClause *WithClause } @@ -12,3 +19,104 @@ type UpdateStmt struct { func (n *UpdateStmt) Pos() int { return 0 } + +func (n *UpdateStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.WithClause != nil { + buf.astFormat(n.WithClause, d) + buf.WriteString(" ") + } + + buf.WriteString("UPDATE ") + if items(n.Relations) { + buf.astFormat(n.Relations, d) + } + + if items(n.TargetList) { + buf.WriteString(" SET ") + + multi := false + for _, item := range n.TargetList.Items { + switch nn := item.(type) { + case *ResTarget: + if _, ok := nn.Val.(*MultiAssignRef); ok { + multi = true + } + } + } + if multi { + names := []string{} + vals := &List{} + for _, item := range n.TargetList.Items { + res, ok := item.(*ResTarget) + if !ok { + continue + } + if res.Name != nil { + names = append(names, *res.Name) + } + multi, ok := res.Val.(*MultiAssignRef) + if !ok { + vals.Items = append(vals.Items, res.Val) + continue + } + row, ok := multi.Source.(*RowExpr) + if !ok { + vals.Items = append(vals.Items, res.Val) + continue + } + vals.Items = append(vals.Items, row.Args.Items[multi.Colno-1]) + } + + buf.WriteString("(") + buf.WriteString(strings.Join(names, ",")) + buf.WriteString(") = (") + buf.join(vals, d, ",") + buf.WriteString(")") + } else { + for i, item := range n.TargetList.Items { + if i > 0 { + buf.WriteString(", ") + } + switch nn := item.(type) { + case *ResTarget: + if nn.Name != nil { + 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, d) + default: + buf.astFormat(item, d) + } + } + } + } + + if items(n.FromClause) { + buf.WriteString(" FROM ") + buf.astFormat(n.FromClause, d) + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause, d) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount, d) + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList, d) + } +} diff --git a/internal/sql/ast/varatt_external.go b/internal/sql/ast/varatt_external.go deleted file mode 100644 index 44d789e29a..0000000000 --- a/internal/sql/ast/varatt_external.go +++ /dev/null @@ -1,12 +0,0 @@ -package ast - -type varatt_external struct { - VaRawsize int32 - VaExtsize int32 - VaValueid Oid - VaToastrelid Oid -} - -func (n *varatt_external) Pos() int { - return 0 -} diff --git a/internal/sql/ast/variable_expr.go b/internal/sql/ast/variable_expr.go new file mode 100644 index 0000000000..83223b482b --- /dev/null +++ b/internal/sql/ast/variable_expr.go @@ -0,0 +1,22 @@ +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 { + Name string + Location int +} + +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/vartag_external.go b/internal/sql/ast/vartag_external.go deleted file mode 100644 index 86bef3d0a1..0000000000 --- a/internal/sql/ast/vartag_external.go +++ /dev/null @@ -1,7 +0,0 @@ -package ast - -type vartag_external uint - -func (n *vartag_external) Pos() int { - return 0 -} diff --git a/internal/sql/ast/window_def.go b/internal/sql/ast/window_def.go index 29840767c9..caba3e643c 100644 --- a/internal/sql/ast/window_def.go +++ b/internal/sql/ast/window_def.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type WindowDef struct { Name *string Refname *string @@ -14,3 +16,99 @@ type WindowDef struct { 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/with_clause.go b/internal/sql/ast/with_clause.go index 6334930439..0def53d382 100644 --- a/internal/sql/ast/with_clause.go +++ b/internal/sql/ast/with_clause.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type WithClause struct { Ctes *List Recursive bool @@ -9,3 +11,14 @@ type WithClause struct { func (n *WithClause) Pos() int { return n.Location } + +func (n *WithClause) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("WITH ") + if n.Recursive { + buf.WriteString("RECURSIVE ") + } + buf.join(n.Ctes, d, ", ") +} diff --git a/internal/sql/astutils/CLAUDE.md b/internal/sql/astutils/CLAUDE.md new file mode 100644 index 0000000000..b7903542c5 --- /dev/null +++ b/internal/sql/astutils/CLAUDE.md @@ -0,0 +1,117 @@ +# 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 +``` + +### Replacing Named Parameters +The `rewrite/parameters.go` uses Apply to replace `sqlc.arg()` calls with `ParamRef`: +```go +astutils.Apply(root, func(cr *astutils.Cursor) bool { + if named.IsParamFunc(cr.Node()) { + cr.Replace(&ast.ParamRef{Number: nextParam()}) + } + return true +}, nil) +``` + +## 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/join.go b/internal/sql/astutils/join.go index 7d2f7829b6..5535d72f7c 100644 --- a/internal/sql/astutils/join.go +++ b/internal/sql/astutils/join.go @@ -3,11 +3,15 @@ package astutils import ( "strings" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) func Join(list *ast.List, sep string) string { - items := []string{} + if list == nil { + return "" + } + + var items []string for _, item := range list.Items { if n, ok := item.(*ast.String); ok { items = append(items, n.Str) diff --git a/internal/sql/astutils/rewrite.go b/internal/sql/astutils/rewrite.go index f8a55eece9..fc7996b5f5 100644 --- a/internal/sql/astutils/rewrite.go +++ b/internal/sql/astutils/rewrite.go @@ -8,7 +8,7 @@ import ( "fmt" "reflect" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) // An ApplyFunc is invoked by Apply for each node n, even if n is nil, @@ -39,7 +39,6 @@ type ApplyFunc func(*Cursor) bool // Children are traversed in the order in which they appear in the // respective node's struct definition. A package's files are // traversed in the filenames' alphabetical order. -// func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) { parent := &struct{ ast.Node }{root} defer func() { @@ -63,8 +62,8 @@ var abort = new(int) // singleton, to signal termination of Apply // c.Parent(), and f is the field identifier with name c.Name(), // the following invariants hold: // -// p.f == c.Node() if c.Index() < 0 -// p.f[c.Index()] == c.Node() if c.Index() >= 0 +// p.f == c.Node() if c.Index() < 0 +// p.f[c.Index()] == c.Node() if c.Index() >= 0 // // The methods Replace, Delete, InsertBefore, and InsertAfter // can be used to change the AST without disrupting Apply. @@ -165,6 +164,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.CommentOnTypeStmt: a.apply(n, "Type", nil, n.Type) + case *ast.CommentOnViewStmt: + a.apply(n, "View", nil, n.View) + case *ast.CreateTableStmt: a.apply(n, "Name", nil, n.Name) @@ -190,6 +192,10 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.FuncSpec: a.apply(n, "Name", nil, n.Name) + case *ast.In: + a.applyList(n, "List") + a.apply(n, "Sel", nil, n.Sel) + case *ast.List: // Since item is a slice a.applyList(n, "Items") @@ -204,6 +210,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.RenameTableStmt: a.apply(n, "Table", nil, n.Table) + case *ast.RenameTypeStmt: + a.apply(n, "Type", nil, n.Type) + case *ast.Statement: a.apply(n, "Raw", nil, n.Raw) @@ -391,12 +400,20 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Refexpr", nil, n.Refexpr) a.apply(n, "Refassgnexpr", nil, n.Refassgnexpr) + case *ast.BetweenExpr: + a.apply(n, "Expr", nil, n.Expr) + a.apply(n, "Left", nil, n.Left) + a.apply(n, "Right", nil, n.Right) + case *ast.BitString: // pass case *ast.BlockIdData: // pass + case *ast.Boolean: + // pass + case *ast.BoolExpr: a.apply(n, "Xpr", nil, n.Xpr) a.apply(n, "Args", nil, n.Args) @@ -405,6 +422,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Xpr", nil, n.Xpr) a.apply(n, "Arg", nil, n.Arg) + case *ast.CallStmt: + a.apply(n, "FuncCall", nil, n.FuncCall) + case *ast.CaseExpr: a.apply(n, "Xpr", nil, n.Xpr) a.apply(n, "Arg", nil, n.Arg) @@ -662,11 +682,13 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Definition", nil, n.Definition) case *ast.DeleteStmt: - a.apply(n, "Relation", nil, n.Relation) + a.apply(n, "Relations", nil, n.Relations) a.apply(n, "UsingClause", nil, n.UsingClause) 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 @@ -792,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) @@ -863,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) @@ -882,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) @@ -1135,7 +1170,7 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. // pass case *ast.UpdateStmt: - a.apply(n, "Relation", nil, n.Relation) + a.apply(n, "Relations", nil, n.Relations) a.apply(n, "TargetList", nil, n.TargetList) a.apply(n, "WhereClause", nil, n.WhereClause) a.apply(n, "FromClause", nil, n.FromClause) diff --git a/internal/sql/astutils/search.go b/internal/sql/astutils/search.go index 5aeacfb9d9..d61ee1345a 100644 --- a/internal/sql/astutils/search.go +++ b/internal/sql/astutils/search.go @@ -1,6 +1,6 @@ package astutils -import "github.com/kyleconroy/sqlc/internal/sql/ast" +import "github.com/sqlc-dev/sqlc/internal/sql/ast" type nodeSearch struct { list *ast.List diff --git a/internal/sql/astutils/walk.go b/internal/sql/astutils/walk.go index 77ab5616f6..6d5e80bdc3 100644 --- a/internal/sql/astutils/walk.go +++ b/internal/sql/astutils/walk.go @@ -3,7 +3,7 @@ package astutils import ( "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) type Visitor interface { @@ -44,6 +44,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Type) } + case *ast.AlterTypeSetSchemaStmt: + if n.Type != nil { + Walk(f, n.Type) + } + case *ast.AlterTypeRenameValueStmt: if n.Type != nil { Walk(f, n.Type) @@ -72,6 +77,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Type) } + case *ast.CommentOnViewStmt: + if n.View != nil { + Walk(f, n.View) + } + case *ast.CompositeTypeStmt: if n.TypeName != nil { Walk(f, n.TypeName) @@ -128,6 +138,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Table) } + case *ast.RenameTypeStmt: + if n.Type != nil { + Walk(f, n.Type) + } + case *ast.Statement: if n.Raw != nil { Walk(f, n.Raw) @@ -473,6 +488,17 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Refassgnexpr) } + case *ast.BetweenExpr: + if n.Expr != nil { + Walk(f, n.Expr) + } + if n.Left != nil { + Walk(f, n.Left) + } + if n.Right != nil { + Walk(f, n.Right) + } + case *ast.BitString: // pass @@ -487,6 +513,9 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Args) } + case *ast.Boolean: + // pass + case *ast.BooleanTest: if n.Xpr != nil { Walk(f, n.Xpr) @@ -495,6 +524,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.Arg) } + case *ast.CallStmt: + if n.FuncCall != nil { + Walk(f, n.FuncCall) + } + case *ast.CaseExpr: if n.Xpr != nil { Walk(f, n.Xpr) @@ -1025,8 +1059,8 @@ func Walk(f Visitor, node ast.Node) { } case *ast.DeleteStmt: - if n.Relation != nil { - Walk(f, n.Relation) + if n.Relations != nil { + Walk(f, n.Relations) } if n.UsingClause != nil { Walk(f, n.UsingClause) @@ -1034,12 +1068,21 @@ func Walk(f Visitor, node ast.Node) { if n.WhereClause != nil { Walk(f, n.WhereClause) } + if n.LimitCount != nil { + Walk(f, n.LimitCount) + } if n.ReturningList != nil { Walk(f, n.ReturningList) } 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 @@ -1275,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) } @@ -1299,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) @@ -1408,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) @@ -1433,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) @@ -1992,8 +2056,8 @@ func Walk(f Visitor, node ast.Node) { // pass case *ast.UpdateStmt: - if n.Relation != nil { - Walk(f, n.Relation) + if n.Relations != nil { + Walk(f, n.Relations) } if n.TargetList != nil { Walk(f, n.TargetList) @@ -2004,6 +2068,9 @@ func Walk(f Visitor, node ast.Node) { if n.FromClause != nil { Walk(f, n.FromClause) } + if n.LimitCount != nil { + Walk(f, n.LimitCount) + } if n.ReturningList != nil { Walk(f, n.ReturningList) } @@ -2117,6 +2184,14 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.TypeName) } + case *ast.In: + for _, l := range n.List { + Walk(f, l) + } + if n.Sel != nil { + Walk(f, n.Sel) + } + default: panic(fmt.Sprintf("walk: unexpected node type %T", n)) } diff --git a/internal/sql/catalog/catalog.go b/internal/sql/catalog/catalog.go index 2263ec5b6e..278ea8797d 100644 --- a/internal/sql/catalog/catalog.go +++ b/internal/sql/catalog/catalog.go @@ -1,22 +1,10 @@ package catalog import ( - "strings" - - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) -func stringSlice(list *ast.List) []string { - items := []string{} - for _, item := range list.Items { - if n, ok := item.(*ast.String); ok { - items = append(items, n.Str) - } - } - return items -} - +// Catalog describes a database instance consisting of metadata in which database objects are defined type Catalog struct { Comment string DefaultSchema string @@ -29,257 +17,38 @@ type Catalog struct { Extensions map[string]struct{} } -func (c *Catalog) getSchema(name string) (*Schema, error) { - for i := range c.Schemas { - if c.Schemas[i].Name == name { - return c.Schemas[i], nil - } - } - return nil, sqlerr.SchemaNotFound(name) -} +// New creates a new catalog +func New(defaultSchema string) *Catalog { -func (c *Catalog) getFunc(rel *ast.FuncName, tns []*ast.TypeName) (*Function, int, error) { - ns := rel.Schema - if ns == "" { - ns = c.DefaultSchema - } - s, err := c.getSchema(ns) - if err != nil { - return nil, -1, err + newCatalog := &Catalog{ + DefaultSchema: defaultSchema, + Schemas: make([]*Schema, 0), + Extensions: make(map[string]struct{}), } - return s.getFunc(rel, tns) -} -func (c *Catalog) getTable(name *ast.TableName) (*Schema, *Table, error) { - ns := name.Schema - if ns == "" { - ns = c.DefaultSchema - } - var s *Schema - for i := range c.Schemas { - if c.Schemas[i].Name == ns { - s = c.Schemas[i] - break - } + if newCatalog.DefaultSchema != "" { + newCatalog.Schemas = append(newCatalog.Schemas, &Schema{Name: defaultSchema}) } - if s == nil { - return nil, nil, sqlerr.SchemaNotFound(ns) - } - t, _, err := s.getTable(name) - if err != nil { - return nil, nil, err - } - return s, t, nil -} -func (c *Catalog) getType(rel *ast.TypeName) (Type, int, error) { - ns := rel.Schema - if ns == "" { - ns = c.DefaultSchema - } - s, err := c.getSchema(ns) - if err != nil { - return nil, -1, err - } - return s.getType(rel) -} - -type Schema struct { - Name string - Tables []*Table - Types []Type - Funcs []*Function - - Comment string -} - -func sameType(a, b *ast.TypeName) bool { - if a.Catalog != b.Catalog { - return false - } - // The pg_catalog schema is searched by default, so take that into - // account when comparing schemas - aSchema := a.Schema - bSchema := b.Schema - if aSchema == "pg_catalog" { - aSchema = "" - } - if bSchema == "pg_catalog" { - bSchema = "" - } - if aSchema != bSchema { - return false - } - if a.Name != b.Name { - return false - } - return true -} - -func (s *Schema) getFunc(rel *ast.FuncName, tns []*ast.TypeName) (*Function, int, error) { - for i := range s.Funcs { - if strings.ToLower(s.Funcs[i].Name) != strings.ToLower(rel.Name) { - continue - } - - args := s.Funcs[i].InArgs() - if len(args) != len(tns) { - continue - } - found := true - for j := range args { - if !sameType(s.Funcs[i].Args[j].Type, tns[j]) { - found = false - break - } - } - if !found { - continue - } - return s.Funcs[i], i, nil - } - return nil, -1, sqlerr.RelationNotFound(rel.Name) -} - -func (s *Schema) getFuncByName(rel *ast.FuncName) (*Function, int, error) { - idx := -1 - name := strings.ToLower(rel.Name) - for i := range s.Funcs { - lowered := strings.ToLower(s.Funcs[i].Name) - if lowered == name && idx >= 0 { - return nil, -1, sqlerr.FunctionNotUnique(rel.Name) - } - if lowered == name { - idx = i - } - } - if idx < 0 { - return nil, -1, sqlerr.RelationNotFound(rel.Name) - } - return s.Funcs[idx], idx, nil -} - -func (s *Schema) getTable(rel *ast.TableName) (*Table, int, error) { - for i := range s.Tables { - if s.Tables[i].Rel.Name == rel.Name { - return s.Tables[i], i, nil - } - } - return nil, -1, sqlerr.RelationNotFound(rel.Name) -} - -func (s *Schema) getType(rel *ast.TypeName) (Type, int, error) { - for i := range s.Types { - switch typ := s.Types[i].(type) { - case *Enum: - if typ.Name == rel.Name { - return s.Types[i], i, nil - } - } - } - return nil, -1, sqlerr.TypeNotFound(rel.Name) -} - -type Table struct { - Rel *ast.TableName - Columns []*Column - Comment string -} - -// TODO: Should this just be ast Nodes? -type Column struct { - Name string - Type ast.TypeName - IsNotNull bool - IsArray bool - Comment string - Length *int -} - -type Type interface { - isType() - - SetComment(string) -} - -type Enum struct { - Name string - Vals []string - Comment string -} - -func (e *Enum) SetComment(c string) { - e.Comment = c -} - -func (e *Enum) isType() { -} - -type CompositeType struct { - Name string - Comment string -} - -func (ct *CompositeType) isType() { -} - -func (ct *CompositeType) SetComment(c string) { - ct.Comment = c -} - -type Function struct { - Name string - Args []*Argument - ReturnType *ast.TypeName - Comment string - Desc string -} - -func (f *Function) InArgs() []*Argument { - var args []*Argument - for _, a := range f.Args { - switch a.Mode { - case ast.FuncParamTable, ast.FuncParamOut: - continue - default: - args = append(args, a) - } - } - return args -} - -type Argument struct { - Name string - Type *ast.TypeName - HasDefault bool - Mode ast.FuncParamMode -} - -func New(def string) *Catalog { - return &Catalog{ - DefaultSchema: def, - Schemas: []*Schema{ - {Name: def}, - }, - Extensions: map[string]struct{}{}, - } + return newCatalog } func (c *Catalog) Build(stmts []ast.Statement) error { for i := range stmts { - if err := c.Update(stmts[i]); err != nil { + if err := c.Update(stmts[i], nil); err != nil { return err } } return nil } -func (c *Catalog) Update(stmt ast.Statement) error { +func (c *Catalog) Update(stmt ast.Statement, colGen columnGenerator) error { if stmt.Raw == nil { return nil } var err error switch n := stmt.Raw.Stmt.(type) { + case *ast.AlterTableStmt: err = c.alterTable(n) @@ -292,6 +61,9 @@ func (c *Catalog) Update(stmt ast.Statement) error { case *ast.AlterTypeRenameValueStmt: err = c.alterTypeRenameValue(n) + case *ast.AlterTypeSetSchemaStmt: + err = c.alterTypeSetSchema(n) + case *ast.CommentOnColumnStmt: err = c.commentOnColumn(n) @@ -304,6 +76,9 @@ func (c *Catalog) Update(stmt ast.Statement) error { case *ast.CommentOnTypeStmt: err = c.commentOnType(n) + case *ast.CommentOnViewStmt: + err = c.commentOnView(n) + case *ast.CompositeTypeStmt: err = c.createCompositeType(n) @@ -322,6 +97,12 @@ func (c *Catalog) Update(stmt ast.Statement) error { case *ast.CreateTableStmt: err = c.createTable(n) + case *ast.CreateTableAsStmt: + err = c.createTableAs(n, colGen) + + case *ast.ViewStmt: + err = c.createView(n, colGen) + case *ast.DropFunctionStmt: err = c.dropFunction(n) @@ -340,6 +121,22 @@ func (c *Catalog) Update(stmt ast.Statement) error { case *ast.RenameTableStmt: err = c.renameTable(n) + case *ast.RenameTypeStmt: + err = c.renameType(n) + + case *ast.List: + for _, nn := range n.Items { + if err = c.Update(ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: nn, + StmtLocation: stmt.Raw.StmtLocation, + StmtLen: stmt.Raw.StmtLen, + }, + }, colGen); err != nil { + return err + } + } + } return err } diff --git a/internal/sql/catalog/comment_on.go b/internal/sql/catalog/comment_on.go index 21bc91bb7c..49c7144913 100644 --- a/internal/sql/catalog/comment_on.go +++ b/internal/sql/catalog/comment_on.go @@ -1,8 +1,8 @@ package catalog import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) func (c *Catalog) commentOnColumn(stmt *ast.CommentOnColumnStmt) error { @@ -61,3 +61,16 @@ func (c *Catalog) commentOnType(stmt *ast.CommentOnTypeStmt) error { } return nil } + +func (c *Catalog) commentOnView(stmt *ast.CommentOnViewStmt) error { + _, t, err := c.getTable(stmt.View) + if err != nil { + return err + } + if stmt.Comment != nil { + t.Comment = *stmt.Comment + } else { + t.Comment = "" + } + return nil +} diff --git a/internal/sql/catalog/extension.go b/internal/sql/catalog/extension.go index b569f5b8a8..fdb717f2d2 100644 --- a/internal/sql/catalog/extension.go +++ b/internal/sql/catalog/extension.go @@ -1,7 +1,7 @@ package catalog import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) func (c *Catalog) createExtension(stmt *ast.CreateExtensionStmt) error { diff --git a/internal/sql/catalog/func.go b/internal/sql/catalog/func.go index 760144c135..e170777311 100644 --- a/internal/sql/catalog/func.go +++ b/internal/sql/catalog/func.go @@ -3,10 +3,53 @@ package catalog import ( "errors" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) +// Function describes a database function +// +// A database function is a method written to perform a specific operation on data within the database. +type Function struct { + Name string + Args []*Argument + ReturnType *ast.TypeName + Comment string + Desc string + ReturnTypeNullable bool +} + +type Argument struct { + Name string + Type *ast.TypeName + HasDefault bool + Mode ast.FuncParamMode +} + +func (f *Function) InArgs() []*Argument { + var args []*Argument + for _, a := range f.Args { + switch a.Mode { + case ast.FuncParamTable, ast.FuncParamOut: + continue + default: + args = append(args, a) + } + } + 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/public.go b/internal/sql/catalog/public.go index 19ccd84005..19fd50722f 100644 --- a/internal/sql/catalog/public.go +++ b/internal/sql/catalog/public.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) func (c *Catalog) schemasToSearch(ns string) []string { diff --git a/internal/sql/catalog/schema.go b/internal/sql/catalog/schema.go index a0189c6c05..72a32a6ff8 100644 --- a/internal/sql/catalog/schema.go +++ b/internal/sql/catalog/schema.go @@ -2,16 +2,109 @@ package catalog import ( "fmt" + "strings" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) +// Schema describes how the data in a relational database may relate to other tables or other data models +type Schema struct { + Name string + Tables []*Table + Types []Type + Funcs []*Function + + Comment string +} + +func (s *Schema) getFunc(rel *ast.FuncName, tns []*ast.TypeName) (*Function, int, error) { + for i := range s.Funcs { + if !strings.EqualFold(s.Funcs[i].Name, rel.Name) { + continue + } + + args := s.Funcs[i].InArgs() + if len(args) != len(tns) { + continue + } + found := true + for j := range args { + if !sameType(s.Funcs[i].Args[j].Type, tns[j]) { + found = false + break + } + } + if !found { + continue + } + return s.Funcs[i], i, nil + } + return nil, -1, sqlerr.RelationNotFound(rel.Name) +} + +func (s *Schema) getFuncByName(rel *ast.FuncName) (*Function, int, error) { + idx := -1 + name := strings.ToLower(rel.Name) + for i := range s.Funcs { + lowered := strings.ToLower(s.Funcs[i].Name) + if lowered == name && idx >= 0 { + return nil, -1, sqlerr.FunctionNotUnique(rel.Name) + } + if lowered == name { + idx = i + } + } + if idx < 0 { + return nil, -1, sqlerr.RelationNotFound(rel.Name) + } + return s.Funcs[idx], idx, nil +} + +func (s *Schema) getTable(rel *ast.TableName) (*Table, int, error) { + for i := range s.Tables { + if s.Tables[i].Rel.Name == rel.Name { + return s.Tables[i], i, nil + } + } + return nil, -1, sqlerr.RelationNotFound(rel.Name) +} + +func (s *Schema) getType(rel *ast.TypeName) (Type, int, error) { + for i := range s.Types { + switch typ := s.Types[i].(type) { + case *Enum: + if typ.Name == rel.Name { + return s.Types[i], i, nil + } + case *CompositeType: + if typ.Name == rel.Name { + return s.Types[i], i, nil + } + } + } + return nil, -1, sqlerr.TypeNotFound(rel.Name) +} + +func (c *Catalog) getSchema(name string) (*Schema, error) { + for i := range c.Schemas { + if c.Schemas[i].Name == name { + return c.Schemas[i], nil + } + } + return nil, sqlerr.SchemaNotFound(name) +} + func (c *Catalog) createSchema(stmt *ast.CreateSchemaStmt) error { if stmt.Name == nil { return fmt.Errorf("create schema: empty name") } if _, err := c.getSchema(*stmt.Name); err == nil { + // If the default schema already exists, treat additional CREATE SCHEMA + // statements as no-ops. + if *stmt.Name == c.DefaultSchema { + return nil + } if !stmt.IfNotExists { return sqlerr.SchemaExists(*stmt.Name) } diff --git a/internal/sql/catalog/table.go b/internal/sql/catalog/table.go index a91404c8d8..dc30acfa1e 100644 --- a/internal/sql/catalog/table.go +++ b/internal/sql/catalog/table.go @@ -4,11 +4,164 @@ import ( "errors" "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) -func (c *Catalog) alterTable(stmt *ast.AlterTableStmt) error { +// Table describes a relational database table +// +// A database table is a collection of related data held in a table format within a database. +// It consists of columns and rows. +type Table struct { + Rel *ast.TableName + Columns []*Column + Comment string +} + +func checkMissing(err error, missingOK bool) error { + var serr *sqlerr.Error + if errors.As(err, &serr) { + if serr.Err == sqlerr.NotFound && missingOK { + return nil + } + } + return err +} + +func (table *Table) isExistColumn(cmd *ast.AlterTableCmd) (int, error) { + for i, c := range table.Columns { + if c.Name == *cmd.Name { + return i, nil + } + } + if !cmd.MissingOk { + return -1, sqlerr.ColumnNotFound(table.Rel.Name, *cmd.Name) + } + // Missing column is allowed + return -1, nil +} + +func (c *Catalog) addColumn(table *Table, cmd *ast.AlterTableCmd) error { + for _, c := range table.Columns { + if c.Name == cmd.Def.Colname { + if !cmd.MissingOk { + return sqlerr.ColumnExists(table.Rel.Name, cmd.Def.Colname) + } + return nil + } + } + tc, err := c.defineColumn(table.Rel, cmd.Def) + if err != nil { + return err + } + table.Columns = append(table.Columns, tc) + return nil +} + +func (table *Table) alterColumnType(cmd *ast.AlterTableCmd) error { + index, err := table.isExistColumn(cmd) + if err != nil { + return err + } + if index >= 0 { + table.Columns[index].Type = *cmd.Def.TypeName + table.Columns[index].IsArray = cmd.Def.IsArray + table.Columns[index].ArrayDims = cmd.Def.ArrayDims + } + return nil +} + +func (c *Catalog) dropColumn(table *Table, cmd *ast.AlterTableCmd) error { + index, err := table.isExistColumn(cmd) + if err != nil { + return err + } + if index < 0 { + return nil + } + col := table.Columns[index] + if col.linkedType { + drop := &ast.DropTypeStmt{ + Types: []*ast.TypeName{ + &col.Type, + }, + } + if err := c.dropType(drop); err != nil { + return err + } + } + table.Columns = append(table.Columns[:index], table.Columns[index+1:]...) + return nil +} + +func (table *Table) dropNotNull(cmd *ast.AlterTableCmd) error { + index, err := table.isExistColumn(cmd) + if err != nil { + return err + } + if index >= 0 { + table.Columns[index].IsNotNull = false + } + return nil +} + +func (table *Table) setNotNull(cmd *ast.AlterTableCmd) error { + index, err := table.isExistColumn(cmd) + if err != nil { + return err + } + if index >= 0 { + table.Columns[index].IsNotNull = true + } + return nil +} + +// Column describes a set of data values of a particular type in a relational database table +// +// TODO: Should this just be ast Nodes? +type Column struct { + Name string + Type ast.TypeName + IsNotNull bool + IsUnsigned bool + IsArray bool + ArrayDims int + Comment string + Length *int + + linkedType bool +} + +// An interface is used to resolve a circular import between the catalog and compiler packages. +// The createView function requires access to functions in the compiler package to parse the SELECT +// statement that defines the view. +type columnGenerator interface { + OutputColumns(node ast.Node) ([]*Column, error) +} + +func (c *Catalog) getTable(tableName *ast.TableName) (*Schema, *Table, error) { + schemaName := tableName.Schema + if schemaName == "" { + schemaName = c.DefaultSchema + } + var schema *Schema + for i := range c.Schemas { + if c.Schemas[i].Name == schemaName { + schema = c.Schemas[i] + break + } + } + if schema == nil { + return nil, nil, sqlerr.SchemaNotFound(schemaName) + } + table, _, err := schema.getTable(tableName) + if err != nil { + return nil, nil, err + } + return schema, table, nil +} + +func isStmtImplemented(stmt *ast.AlterTableStmt) bool { var implemented bool for _, item := range stmt.Cmds.Items { switch cmd := item.(type) { @@ -27,73 +180,44 @@ func (c *Catalog) alterTable(stmt *ast.AlterTableStmt) error { } } } - if !implemented { + return implemented +} + +func (c *Catalog) alterTable(stmt *ast.AlterTableStmt) error { + if !isStmtImplemented(stmt) { return nil } _, table, err := c.getTable(stmt.Table) if err != nil { - return err + return checkMissing(err, stmt.MissingOk) } - - for _, cmd := range stmt.Cmds.Items { - switch cmd := cmd.(type) { + for _, item := range stmt.Cmds.Items { + switch cmd := item.(type) { case *ast.AlterTableCmd: - idx := -1 - - // Lookup column names for column-related commands switch cmd.Subtype { - case ast.AT_AlterColumnType, - ast.AT_DropColumn, - ast.AT_DropNotNull, - ast.AT_SetNotNull: - for i, c := range table.Columns { - if c.Name == *cmd.Name { - idx = i - break - } - } - if idx < 0 && !cmd.MissingOk { - return sqlerr.ColumnNotFound(table.Rel.Name, *cmd.Name) - } - // If a missing column is allowed, skip this command - if idx < 0 && cmd.MissingOk { - continue - } - } - - switch cmd.Subtype { - case ast.AT_AddColumn: - for _, c := range table.Columns { - if c.Name == cmd.Def.Colname { - return sqlerr.ColumnExists(table.Rel.Name, c.Name) - } + if err := c.addColumn(table, cmd); err != nil { + return err } - table.Columns = append(table.Columns, &Column{ - Name: cmd.Def.Colname, - Type: *cmd.Def.TypeName, - IsNotNull: cmd.Def.IsNotNull, - IsArray: cmd.Def.IsArray, - Length: cmd.Def.Length, - }) - case ast.AT_AlterColumnType: - table.Columns[idx].Type = *cmd.Def.TypeName - table.Columns[idx].IsArray = cmd.Def.IsArray - + if err := table.alterColumnType(cmd); err != nil { + return err + } case ast.AT_DropColumn: - table.Columns = append(table.Columns[:idx], table.Columns[idx+1:]...) - + if err := c.dropColumn(table, cmd); err != nil { + return err + } case ast.AT_DropNotNull: - table.Columns[idx].IsNotNull = false - + if err := table.dropNotNull(cmd); err != nil { + return err + } case ast.AT_SetNotNull: - table.Columns[idx].IsNotNull = true - + if err := table.setNotNull(cmd); err != nil { + return err + } } } } - return nil } @@ -104,12 +228,13 @@ func (c *Catalog) alterTableSetSchema(stmt *ast.AlterTableSetSchemaStmt) error { } oldSchema, err := c.getSchema(ns) if err != nil { - return err + return checkMissing(err, stmt.MissingOk) } tbl, idx, err := oldSchema.getTable(stmt.Table) if err != nil { - return err + return checkMissing(err, stmt.MissingOk) } + tbl.Rel.Schema = *stmt.NewSchema newSchema, err := c.getSchema(*stmt.NewSchema) if err != nil { return err @@ -139,9 +264,29 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { } tbl := Table{Rel: stmt.Name, Comment: stmt.Comment} + coltype := make(map[string]ast.TypeName) // used to check for duplicate column names + seen := make(map[string]bool) // used to check for duplicate column names + for _, inheritTable := range stmt.Inherits { + t, _, err := schema.getTable(inheritTable) + if err != nil { + return err + } + // check and ignore duplicate columns + for _, col := range t.Columns { + if notNull, ok := seen[col.Name]; ok { + seen[col.Name] = notNull || col.IsNotNull + if a, ok := coltype[col.Name]; ok { + if !sameType(&a, &col.Type) { + return fmt.Errorf("column %q has a type conflict", col.Name) + } + } + continue + } - if stmt.ReferTable != nil && len(stmt.Cols) != 0 { - return errors.New("create table node cannot have both a ReferTable and Cols") + seen[col.Name] = col.IsNotNull + coltype[col.Name] = col.Type + tbl.Columns = append(tbl.Columns, col) + } } if stmt.ReferTable != nil { @@ -153,33 +298,61 @@ 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 { - tc := &Column{ - Name: col.Colname, - Type: *col.TypeName, - IsNotNull: col.IsNotNull, - IsArray: col.IsArray, - Comment: col.Comment, - Length: col.Length, - } - if col.Vals != nil { - typeName := ast.TypeName{ - Name: fmt.Sprintf("%s_%s", stmt.Name.Name, col.Colname), - } - s := &ast.CreateEnumStmt{TypeName: &typeName, Vals: col.Vals} - if err := c.createEnum(s); err != nil { - return err + } + + 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) } - tc.Type = typeName } - 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 + for i := range tbl.Columns { + if notNull, ok := seen[tbl.Columns[i].Name]; ok { + tbl.Columns[i].IsNotNull = notNull + } + } + schema.Tables = append(schema.Tables, &tbl) return nil } +func (c *Catalog) defineColumn(table *ast.TableName, col *ast.ColumnDef) (*Column, error) { + tc := &Column{ + Name: col.Colname, + Type: *col.TypeName, + IsNotNull: col.IsNotNull, + IsUnsigned: col.IsUnsigned, + IsArray: col.IsArray, + ArrayDims: col.ArrayDims, + Comment: col.Comment, + Length: col.Length, + } + if col.Vals != nil { + typeName := ast.TypeName{ + Name: fmt.Sprintf("%s_%s", table.Name, col.Colname), + } + s := &ast.CreateEnumStmt{TypeName: &typeName, Vals: col.Vals} + if err := c.createEnum(s); err != nil { + return nil, err + } + tc.Type = typeName + tc.linkedType = true + } + return tc, nil +} + func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { for _, name := range stmt.Tables { ns := name.Schema @@ -193,13 +366,24 @@ func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { return err } - _, idx, err := schema.getTable(name) + tbl, idx, err := schema.getTable(name) if errors.Is(err, sqlerr.NotFound) && stmt.IfExists { continue } else if err != nil { return err } + drop := &ast.DropTypeStmt{} + for _, col := range tbl.Columns { + if !col.linkedType { + continue + } + drop.Types = append(drop.Types, &col.Type) + } + if err := c.dropType(drop); err != nil { + return err + } + schema.Tables = append(schema.Tables[:idx], schema.Tables[idx+1:]...) } return nil @@ -208,7 +392,7 @@ func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { func (c *Catalog) renameColumn(stmt *ast.RenameColumnStmt) error { _, tbl, err := c.getTable(stmt.Table) if err != nil { - return err + return checkMissing(err, stmt.MissingOk) } idx := -1 for i := range tbl.Columns { @@ -223,13 +407,25 @@ func (c *Catalog) renameColumn(stmt *ast.RenameColumnStmt) error { return sqlerr.ColumnNotFound(tbl.Rel.Name, stmt.Col.Name) } tbl.Columns[idx].Name = *stmt.NewName + + if tbl.Columns[idx].linkedType { + name := fmt.Sprintf("%s_%s", tbl.Rel.Name, *stmt.NewName) + rename := &ast.RenameTypeStmt{ + Type: &tbl.Columns[idx].Type, + NewName: &name, + } + if err := c.renameType(rename); err != nil { + return err + } + } + return nil } func (c *Catalog) renameTable(stmt *ast.RenameTableStmt) error { sch, tbl, err := c.getTable(stmt.Table) if err != nil { - return err + return checkMissing(err, stmt.MissingOk) } if _, _, err := sch.getTable(&ast.TableName{Name: *stmt.NewName}); err == nil { return sqlerr.RelationExists(*stmt.NewName) @@ -237,5 +433,61 @@ func (c *Catalog) renameTable(stmt *ast.RenameTableStmt) error { if stmt.NewName != nil { tbl.Rel.Name = *stmt.NewName } + + for idx := range tbl.Columns { + if tbl.Columns[idx].linkedType { + name := fmt.Sprintf("%s_%s", *stmt.NewName, tbl.Columns[idx].Name) + rename := &ast.RenameTypeStmt{ + Type: &tbl.Columns[idx].Type, + NewName: &name, + } + if err := c.renameType(rename); err != nil { + return err + } + } + } + + return nil +} + +func (c *Catalog) createTableAs(stmt *ast.CreateTableAsStmt, colGen columnGenerator) error { + cols, err := colGen.OutputColumns(stmt.Query) + if err != nil { + return err + } + + catName := "" + if stmt.Into.Rel.Catalogname != nil { + catName = *stmt.Into.Rel.Catalogname + } + schemaName := "" + if stmt.Into.Rel.Schemaname != nil { + schemaName = *stmt.Into.Rel.Schemaname + } + + tbl := Table{ + Rel: &ast.TableName{ + Catalog: catName, + Schema: schemaName, + Name: *stmt.Into.Rel.Relname, + }, + Columns: cols, + } + + ns := tbl.Rel.Schema + if ns == "" { + ns = c.DefaultSchema + } + schema, err := c.getSchema(ns) + if err != nil { + return err + } + _, _, err = schema.getTable(tbl.Rel) + if err == nil { + return sqlerr.RelationExists(tbl.Rel.Name) + } + + schema.Tables = append(schema.Tables, &tbl) + return nil } diff --git a/internal/sql/catalog/types.go b/internal/sql/catalog/types.go index 5330ea4fa2..464472bcf2 100644 --- a/internal/sql/catalog/types.go +++ b/internal/sql/catalog/types.go @@ -4,10 +4,64 @@ import ( "errors" "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) +type Type interface { + isType() + + SetComment(string) +} + +type Enum struct { + Name string + Vals []string + Comment string +} + +func (e *Enum) SetComment(c string) { + e.Comment = c +} + +func (e *Enum) isType() { +} + +type CompositeType struct { + Name string + Comment string +} + +func (ct *CompositeType) isType() { +} + +func (ct *CompositeType) SetComment(c string) { + ct.Comment = c +} + +func sameType(a, b *ast.TypeName) bool { + if a.Catalog != b.Catalog { + return false + } + // The pg_catalog schema is searched by default, so take that into + // account when comparing schemas + aSchema := a.Schema + bSchema := b.Schema + if aSchema == "pg_catalog" { + aSchema = "" + } + if bSchema == "pg_catalog" { + bSchema = "" + } + if aSchema != bSchema { + return false + } + if a.Name != b.Name { + return false + } + return true +} + func (c *Catalog) createEnum(stmt *ast.CreateEnumStmt) error { ns := stmt.TypeName.Schema if ns == "" { @@ -37,6 +91,28 @@ func (c *Catalog) createEnum(stmt *ast.CreateEnumStmt) error { return nil } +func stringSlice(list *ast.List) []string { + items := []string{} + for _, item := range list.Items { + if n, ok := item.(*ast.String); ok { + items = append(items, n.Str) + } + } + return items +} + +func (c *Catalog) getType(rel *ast.TypeName) (Type, int, error) { + ns := rel.Schema + if ns == "" { + ns = c.DefaultSchema + } + s, err := c.getSchema(ns) + if err != nil { + return nil, -1, err + } + return s.getType(rel) +} + func (c *Catalog) createCompositeType(stmt *ast.CompositeTypeStmt) error { ns := stmt.TypeName.Schema if ns == "" { @@ -121,20 +197,96 @@ func (c *Catalog) alterTypeAddValue(stmt *ast.AlterTypeAddValueStmt) error { return fmt.Errorf("type is not an enum: %T", stmt.Type) } - newIndex := -1 + existingIndex := -1 for i, val := range enum.Vals { if val == *stmt.NewValue { - newIndex = i + existingIndex = i } } - if newIndex >= 0 { + + if existingIndex >= 0 { if !stmt.SkipIfNewValExists { - return fmt.Errorf("type %T already has value %s", stmt.Type, *stmt.NewValue) + return fmt.Errorf("enum %s already has value %s", enum.Name, *stmt.NewValue) } else { return nil } } - enum.Vals = append(enum.Vals, *stmt.NewValue) + + insertIndex := len(enum.Vals) + if stmt.NewValHasNeighbor { + foundNeighbor := false + for i, val := range enum.Vals { + if val == *stmt.NewValNeighbor { + if stmt.NewValIsAfter { + insertIndex = i + 1 + } else { + insertIndex = i + } + foundNeighbor = true + break + } + } + + if !foundNeighbor { + return fmt.Errorf("enum %s unable to find existing neighbor value %s for new value %s", enum.Name, *stmt.NewValNeighbor, *stmt.NewValue) + } + } + + if insertIndex == len(enum.Vals) { + enum.Vals = append(enum.Vals, *stmt.NewValue) + } else { + enum.Vals = append(enum.Vals[:insertIndex+1], enum.Vals[insertIndex:]...) + enum.Vals[insertIndex] = *stmt.NewValue + } + + return nil +} + +func (c *Catalog) alterTypeSetSchema(stmt *ast.AlterTypeSetSchemaStmt) error { + ns := stmt.Type.Schema + if ns == "" { + ns = c.DefaultSchema + } + oldSchema, err := c.getSchema(ns) + if err != nil { + return err + } + typ, idx, err := oldSchema.getType(stmt.Type) + if err != nil { + return err + } + oldType := *stmt.Type + stmt.Type.Schema = *stmt.NewSchema + newSchema, err := c.getSchema(*stmt.NewSchema) + if err != nil { + return err + } + // Because tables have associated data types, the type name must also + // be distinct from the name of any existing table in the same + // schema. + // https://www.postgresql.org/docs/current/sql-createtype.html + tbl := &ast.TableName{ + Name: stmt.Type.Name, + } + if _, _, err := newSchema.getTable(tbl); err == nil { + return sqlerr.RelationExists(tbl.Name) + } + if _, _, err := newSchema.getType(stmt.Type); err == nil { + return sqlerr.TypeExists(stmt.Type.Name) + } + oldSchema.Types = append(oldSchema.Types[:idx], oldSchema.Types[idx+1:]...) + newSchema.Types = append(newSchema.Types, typ) + + // Update all the table columns with the new type + for _, schema := range c.Schemas { + for _, table := range schema.Tables { + for _, column := range table.Columns { + if column.Type == oldType { + column.Type.Schema = *stmt.NewSchema + } + } + } + } return nil } @@ -162,3 +314,61 @@ func (c *Catalog) dropType(stmt *ast.DropTypeStmt) error { } return nil } + +func (c *Catalog) renameType(stmt *ast.RenameTypeStmt) error { + if stmt.NewName == nil { + return fmt.Errorf("rename type: empty name") + } + newName := *stmt.NewName + ns := stmt.Type.Schema + if ns == "" { + ns = c.DefaultSchema + } + schema, err := c.getSchema(ns) + if err != nil { + return err + } + ityp, idx, err := schema.getType(stmt.Type) + if err != nil { + return err + } + if _, _, err := schema.getTable(&ast.TableName{Name: newName}); err == nil { + return sqlerr.RelationExists(newName) + } + if _, _, err := schema.getType(&ast.TypeName{Name: newName}); err == nil { + return sqlerr.TypeExists(newName) + } + + switch typ := ityp.(type) { + + case *CompositeType: + schema.Types[idx] = &CompositeType{ + Name: newName, + Comment: typ.Comment, + } + + case *Enum: + schema.Types[idx] = &Enum{ + Name: newName, + Vals: typ.Vals, + Comment: typ.Comment, + } + + default: + return fmt.Errorf("unsupported type: %T", typ) + + } + + // Update all the table columns with the new type + for _, schema := range c.Schemas { + for _, table := range schema.Tables { + for _, column := range table.Columns { + if column.Type == *stmt.Type { + column.Type.Name = newName + } + } + } + } + + return nil +} diff --git a/internal/sql/catalog/view.go b/internal/sql/catalog/view.go new file mode 100644 index 0000000000..d5222c4d03 --- /dev/null +++ b/internal/sql/catalog/view.go @@ -0,0 +1,52 @@ +package catalog + +import ( + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +func (c *Catalog) createView(stmt *ast.ViewStmt, colGen columnGenerator) error { + cols, err := colGen.OutputColumns(stmt.Query) + if err != nil { + return err + } + + catName := "" + if stmt.View.Catalogname != nil { + catName = *stmt.View.Catalogname + } + schemaName := "" + if stmt.View.Schemaname != nil { + schemaName = *stmt.View.Schemaname + } + + tbl := Table{ + Rel: &ast.TableName{ + Catalog: catName, + Schema: schemaName, + Name: *stmt.View.Relname, + }, + Columns: cols, + } + + ns := tbl.Rel.Schema + if ns == "" { + ns = c.DefaultSchema + } + schema, err := c.getSchema(ns) + if err != nil { + return err + } + _, existingIdx, err := schema.getTable(tbl.Rel) + if err == nil && !stmt.Replace { + return sqlerr.RelationExists(tbl.Rel.Name) + } + + if stmt.Replace && err == nil { + schema.Tables[existingIdx] = &tbl + } else { + schema.Tables = append(schema.Tables, &tbl) + } + + return nil +} diff --git a/internal/sql/format/format.go b/internal/sql/format/format.go new file mode 100644 index 0000000000..b900c227ed --- /dev/null +++ b/internal/sql/format/format.go @@ -0,0 +1,24 @@ +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 parameter placeholder for the given parameter number. + // PostgreSQL uses $1, $2, etc. MySQL uses ? + Param(n int) string + + // NamedParam returns the named parameter placeholder for the given name. + // PostgreSQL uses @name, SQLite uses :name + NamedParam(name string) 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/info/info.go b/internal/sql/info/info.go index 0bebaf251d..48484ef38c 100644 --- a/internal/sql/info/info.go +++ b/internal/sql/info/info.go @@ -1,7 +1,7 @@ package info import ( - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) // Provide a read-only view into the catalog diff --git a/internal/sql/named/CLAUDE.md b/internal/sql/named/CLAUDE.md new file mode 100644 index 0000000000..05ba358ee9 --- /dev/null +++ b/internal/sql/named/CLAUDE.md @@ -0,0 +1,94 @@ +# Named Parameters Package - Claude Code Guide + +This package provides utilities for identifying sqlc's named parameter syntax. + +## Named Parameter Styles + +sqlc supports two styles of named parameters: + +### 1. Function-style: `sqlc.arg(name)`, `sqlc.narg(name)`, `sqlc.slice(name)` +Identified by `IsParamFunc()`: +```go +func IsParamFunc(node ast.Node) bool { + call, ok := node.(*ast.FuncCall) + if !ok { + return false + } + return call.Func.Schema == "sqlc" && + (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice") +} +``` + +### 2. At-sign style: `@param_name` (PostgreSQL only) +Identified by `IsParamSign()`: +```go +func IsParamSign(node ast.Node) bool { + expr, ok := node.(*ast.A_Expr) + return ok && astutils.Join(expr.Name, ".") == "@" +} +``` + +## Important Distinction: sqlc @param vs MySQL @variable + +**sqlc named parameters** (`@param` in PostgreSQL queries): +- Represented as `A_Expr` with `Kind=A_Expr_Kind_OP` and `Name=["@"]` +- Detected by `IsParamSign()` +- Replaced with positional parameters (`$1`, `$2` for PostgreSQL, `?` for MySQL) + +**MySQL user variables** (`@user_id` in MySQL queries): +- Represented as `VariableExpr` +- NOT detected by `IsParamSign()` (it checks for `A_Expr`, not `VariableExpr`) +- Preserved as-is in the output SQL + +This distinction is critical: +```sql +-- PostgreSQL with sqlc @param syntax: +SELECT * FROM users WHERE id = @user_id +-- Becomes: 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 +``` + +## Usage in Parameter Rewriting + +The `rewrite/parameters.go` package uses these functions to find and replace named parameters: + +```go +// Find all named parameters +params := astutils.Search(root, func(node ast.Node) bool { + return named.IsParamFunc(node) || named.IsParamSign(node) +}) + +// Replace with positional parameters +astutils.Apply(root, func(cr *astutils.Cursor) bool { + if named.IsParamFunc(cr.Node()) || named.IsParamSign(cr.Node()) { + cr.Replace(&ast.ParamRef{Number: nextParam()}) + } + return true +}, nil) +``` + +## Converting MySQL @variable Correctly + +When converting TiDB's `VariableExpr` in `dolphin/convert.go`: + +```go +// CORRECT - preserves MySQL user variable as-is +func (c *cc) convertVariableExpr(n *pcast.VariableExpr) ast.Node { + return &ast.VariableExpr{ + Name: n.Name, + Location: n.OriginTextPosition(), + } +} + +// WRONG - would be treated as sqlc named parameter +func (c *cc) convertVariableExpr(n *pcast.VariableExpr) ast.Node { + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "@"}}}, + Rexpr: &ast.String{Str: n.Name}, + } +} +``` diff --git a/internal/sql/named/is.go b/internal/sql/named/is.go index 5421a85bb1..d53c1d9905 100644 --- a/internal/sql/named/is.go +++ b/internal/sql/named/is.go @@ -1,19 +1,23 @@ package named import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" + "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 } - return call.Func.Schema == "sqlc" && call.Func.Name == "arg" + + 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 { diff --git a/internal/sql/named/param.go b/internal/sql/named/param.go new file mode 100644 index 0000000000..42f9b855a3 --- /dev/null +++ b/internal/sql/named/param.go @@ -0,0 +1,129 @@ +package named + +// nullability represents the nullability of a named parameter. +// The nullability can be: +// 1. unspecified +// 2. inferred +// 3. user-defined +// A user-specified nullability carries a higher precedence than an inferred one +// +// The representation is such that you can bitwise OR together nullability types to +// combine them together. +type nullability int + +const ( + nullUnspecified nullability = 0b0000 + inferredNull nullability = 0b0001 + inferredNotNull nullability = 0b0010 + nullable nullability = 0b0100 + notNullable nullability = 0b1000 +) + +// String implements the Stringer interface +func (n nullability) String() string { + switch n { + case nullUnspecified: + return "NullUnspecified" + case inferredNull: + return "InferredNull" + case inferredNotNull: + return "InferredNotNull" + case nullable: + return "Nullable" + case notNullable: + return "NotNullable" + default: + return "NullInvalid" + } +} + +// Param represents a input argument to the query which can be specified using: +// - positional parameters $1 +// - named parameter operator @param +// - named parameter function calls sqlc.arg(param) +type Param struct { + name string + nullability nullability + isSqlcSlice bool +} + +// NewParam builds a new params with unspecified nullability +func NewParam(name string) Param { + return Param{name: name, nullability: nullUnspecified} +} + +// NewInferredParam builds a new params with inferred nullability +func NewInferredParam(name string, notNull bool) Param { + if notNull { + return Param{name: name, nullability: inferredNotNull} + } + + return Param{name: name, nullability: inferredNull} +} + +// NewUserNullableParam is a parameter that has been overridden +// by the user to be nullable. +func NewUserNullableParam(name string) Param { + return Param{name: name, nullability: nullable} +} + +// NewSqlcSlice is a sqlc.slice() parameter. +func NewSqlcSlice(name string) Param { + return Param{name: name, nullability: nullUnspecified, isSqlcSlice: true} +} + +// Name is the user defined name to use for this parameter +func (p Param) Name() string { + return p.name +} + +// is checks if this params object has the specified nullability bit set +func (p Param) is(n nullability) bool { + return (p.nullability & n) == n +} + +// NonNull determines whether this param should be "not null" in its current state +func (p Param) NotNull() bool { + const null = false + const notNull = true + + if p.is(notNullable) { + return notNull + } + + if p.is(nullable) { + return null + } + + if p.is(inferredNotNull) { + return notNull + } + + if p.is(inferredNull) { + return null + } + + // This param is unspecified, so by default we choose nullable + // which matches the default behavior of most databases + return null +} + +// IsSlice returns whether this param is a sqlc.slice() param. +func (p Param) IsSqlcSlice() bool { + return p.isSqlcSlice +} + +// mergeParam creates a new param from 2 partially specified params +// If the parameters have different names, the first is preferred +func mergeParam(a, b Param) Param { + name := a.name + if name == "" { + name = b.name + } + + return Param{ + name: name, + nullability: a.nullability | b.nullability, + isSqlcSlice: a.isSqlcSlice || b.isSqlcSlice, + } +} diff --git a/internal/sql/named/param_set.go b/internal/sql/named/param_set.go new file mode 100644 index 0000000000..d47617a39e --- /dev/null +++ b/internal/sql/named/param_set.go @@ -0,0 +1,85 @@ +package named + +// ParamSet represents a set of parameters for a single query +type ParamSet struct { + // does this engine support named parameters? + hasNamedSupport bool + // the set of currently tracked named parameters + namedParams map[string]Param + // the locations of each of the named parameters + namedLocs map[string][]int + // a map of positions currently used + positionToName map[int]string + // argn keeps track of the last checked positional parameter used + argn int +} + +// Return the name for a given parameter number and a boolean indicating if it +// was found. +func (p *ParamSet) NameFor(idx int) (string, bool) { + name, ok := p.positionToName[idx] + return name, ok +} + +func (p *ParamSet) nextArgNum() int { + for { + if _, ok := p.positionToName[p.argn]; !ok { + return p.argn + } + + p.argn++ + } +} + +// Add adds a parameter to this set and returns the numbered location used for it +func (p *ParamSet) Add(param Param) int { + name := param.name + existing, ok := p.namedParams[name] + + p.namedParams[name] = mergeParam(existing, param) + if ok && p.hasNamedSupport { + return p.namedLocs[name][0] + } + + argn := p.nextArgNum() + p.positionToName[argn] = name + p.namedLocs[name] = append(p.namedLocs[name], argn) + return argn +} + +// FetchMerge fetches an indexed parameter, and merges `mergeP` into it +// Returns: the merged parameter and whether it was a named parameter +func (p *ParamSet) FetchMerge(idx int, mergeP Param) (param Param, isNamed bool) { + name, exists := p.positionToName[idx] + if !exists || name == "" { + return mergeP, false + } + + param, ok := p.namedParams[name] + if !ok { + return mergeP, false + } + + return mergeParam(param, mergeP), true +} + +// NewParamSet creates a set of parameters with the given list of already used positions +func NewParamSet(positionsUsed map[int]bool, hasNamedSupport bool) *ParamSet { + positionToName := make(map[int]string, len(positionsUsed)) + for index, used := range positionsUsed { + if !used { + continue + } + + // assume the previously used params have no name + positionToName[index] = "" + } + + return &ParamSet{ + argn: 1, + namedParams: make(map[string]Param), + namedLocs: make(map[string][]int), + hasNamedSupport: hasNamedSupport, + positionToName: positionToName, + } +} diff --git a/internal/sql/named/param_set_test.go b/internal/sql/named/param_set_test.go new file mode 100644 index 0000000000..99b7ed0575 --- /dev/null +++ b/internal/sql/named/param_set_test.go @@ -0,0 +1,58 @@ +package named + +import "testing" + +func TestParamSet_Add(t *testing.T) { + t.Parallel() + + type test struct { + pset *ParamSet + param Param + expected int + } + + named := NewParamSet(nil, true) + populatedNamed := NewParamSet(map[int]bool{1: true, 2: true, 4: true, 5: true, 6: true}, true) + populatedUnnamed := NewParamSet(map[int]bool{1: true, 2: true, 4: true, 5: true, 6: true}, false) + unnamed := NewParamSet(nil, false) + p1 := NewParam("hello") + p2 := NewParam("world") + + tests := []test{ + // First parameter should be 1 + {named, p1, 1}, + // Duplicate first parameters should be 1 + {named, p1, 1}, + // A new parameter receives a new parameter number + {named, p2, 2}, + // An additional new parameter does _not_ receive a new + {named, p2, 2}, + + // First parameter should be 1 + {unnamed, p1, 1}, + // Duplicate first parameters should increment argn + {unnamed, p1, 2}, + // A new parameter receives a new parameter number + {unnamed, p2, 3}, + // An additional new parameter still does receive a new argn + {unnamed, p2, 4}, + + // First parameter of a pre-populated should be 3 + {populatedNamed, p1, 3}, + {populatedNamed, p1, 3}, + {populatedNamed, p2, 7}, + {populatedNamed, p2, 7}, + + {populatedUnnamed, p1, 3}, + {populatedUnnamed, p1, 7}, + {populatedUnnamed, p2, 8}, + {populatedUnnamed, p2, 9}, + } + + for _, spec := range tests { + actual := spec.pset.Add(spec.param) + if actual != spec.expected { + t.Errorf("ParamSet.Add(%s) expected %v; got %v", spec.param.name, spec.expected, actual) + } + } +} diff --git a/internal/sql/named/param_test.go b/internal/sql/named/param_test.go new file mode 100644 index 0000000000..2643f8b308 --- /dev/null +++ b/internal/sql/named/param_test.go @@ -0,0 +1,82 @@ +package named + +import "testing" + +func TestMergeParamNullability(t *testing.T) { + type test struct { + a Param + b Param + notNull bool + message string + } + + name := "name" + unspec := NewParam(name) + inferredNotNull := NewInferredParam(name, true) + inferredNull := NewInferredParam(name, false) + userDefNull := NewUserNullableParam(name) + + const notNull = true + const null = false + + tests := []test{ + // Unspecified nullability parameter works + {unspec, inferredNotNull, notNull, "Unspec + inferred(not null) = not null"}, + {unspec, inferredNull, null, "Unspec + inferred(not null) = null"}, + {unspec, userDefNull, null, "Unspec + userdef(null) = null"}, + + // Inferred nullability agreeing with user defined nullabilty + {inferredNull, userDefNull, null, "inferred(null) + userdef(null) = null"}, + + // Inferred nullability disagreeing with user defined nullabilty + {inferredNotNull, userDefNull, null, "inferred(not null) + userdef(null) = null"}, + } + + for _, spec := range tests { + a := spec.a + b := spec.b + actual := mergeParam(a, b).NotNull() + expected := spec.notNull + if actual != expected { + t.Errorf("Combine(%s,%s) expected %v; got %v", a.nullability, b.nullability, expected, actual) + } + + // We have already tried Combine(a, b) the same result should be true for Combine(b, a) + actual = mergeParam(b, a).NotNull() + if actual != expected { + t.Errorf("Combine(%s,%s) expected %v; got %v", b.nullability, a.nullability, expected, actual) + } + } +} + +func TestMergeParamName(t *testing.T) { + type test struct { + a Param + b Param + name string + } + + a := NewParam("a") + b := NewParam("b") + blank := NewParam("") + + tests := []test{ + // should prefer the first param's name if both specified + {a, b, "a"}, + {b, a, "b"}, + + // should prefer non-blank names + {a, blank, "a"}, + {blank, a, "a"}, + } + + for _, spec := range tests { + a := spec.a + b := spec.b + actual := mergeParam(a, b).Name() + expected := spec.name + if actual != expected { + t.Errorf("Combine(%s,%s) expected %v; got %v", a.name, b.name, expected, actual) + } + } +} diff --git a/internal/sql/rewrite/CLAUDE.md b/internal/sql/rewrite/CLAUDE.md new file mode 100644 index 0000000000..6ea885016e --- /dev/null +++ b/internal/sql/rewrite/CLAUDE.md @@ -0,0 +1,104 @@ +# SQL Rewrite Package - Claude Code Guide + +This package handles AST transformations, primarily for parameter handling. + +## Key Functions + +### NamedParameters +`NamedParameters(engine config.Engine, raw *ast.RawStmt, ...) (*ast.RawStmt, map[int]Parameter, error)` + +Finds and replaces named parameters (`sqlc.arg()`, `@param`) with positional parameters. + +The function: +1. Searches for named parameters using `named.IsParamFunc()` and `named.IsParamSign()` +2. Extracts parameter names and types +3. Replaces them with `ast.ParamRef` nodes +4. Returns a map of parameter positions to their metadata + +### Expand +`Expand(raw *ast.RawStmt, expected int) error` + +Expands `sqlc.slice()` parameters into the correct number of positional parameters. + +## How Parameter Rewriting Works + +### Step 1: Find Named Parameters +```go +refs := astutils.Search(raw.Stmt, func(node ast.Node) bool { + return named.IsParamFunc(node) || named.IsParamSign(node) +}) +``` + +### Step 2: Replace with ParamRef +```go +astutils.Apply(raw.Stmt, func(cr *astutils.Cursor) bool { + if named.IsParamFunc(cr.Node()) { + // Extract name from sqlc.arg(name) + call := cr.Node().(*ast.FuncCall) + name := extractName(call.Args) + + cr.Replace(&ast.ParamRef{ + Number: nextParam(), + Location: call.Location, + }) + } + return true +}, nil) +``` + +## Important: AST Node Requirements + +For parameter rewriting to work correctly, the AST must be walkable. This means: + +1. All node types must have cases in `astutils/walk.go` +2. All node types must have cases in `astutils/rewrite.go` +3. New container types (like `OnDuplicateKeyUpdate`) must be traversed + +### Example: OnDuplicateKeyUpdate + +MySQL's `ON DUPLICATE KEY UPDATE` clause can contain `sqlc.arg()`: +```sql +INSERT INTO t (a) VALUES (sqlc.arg(val)) +ON DUPLICATE KEY UPDATE a = sqlc.arg(new_val) +``` + +For the parameter in `ON DUPLICATE KEY UPDATE` to be found and replaced: + +1. `InsertStmt` in `rewrite.go` must traverse `OnDuplicateKeyUpdate`: +```go +case *ast.InsertStmt: + a.apply(n, "Relation", nil, n.Relation) + 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) // Critical! + a.apply(n, "ReturningList", nil, n.ReturningList) + a.apply(n, "WithClause", nil, n.WithClause) +``` + +2. `OnDuplicateKeyUpdate` must have its own case: +```go +case *ast.OnDuplicateKeyUpdate: + a.apply(n, "List", nil, n.List) +``` + +## Debugging Parameter Issues + +If a `sqlc.arg()` isn't being converted to `?`: + +1. Check that the containing node type has a case in `rewrite.go` +2. Check that the case traverses all child fields +3. Add debug logging to see if the node is being visited: +```go +case *ast.YourType: + fmt.Printf("Visiting YourType with fields: %+v\n", n) + a.apply(n, "ChildField", nil, n.ChildField) +``` + +## Parameter Output Format by Engine + +- PostgreSQL: `$1`, `$2`, `$3`, ... +- MySQL: `?`, `?`, `?`, ... +- SQLite: `?`, `?`, `?`, ... + +The format is determined by the `Dialect.Param()` method in each engine. diff --git a/internal/sql/rewrite/embeds.go b/internal/sql/rewrite/embeds.go new file mode 100644 index 0000000000..596c03be89 --- /dev/null +++ b/internal/sql/rewrite/embeds.go @@ -0,0 +1,91 @@ +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 index 7c79e9b6d9..d1ea1a22cc 100644 --- a/internal/sql/rewrite/parameters.go +++ b/internal/sql/rewrite/parameters.go @@ -2,12 +2,13 @@ package rewrite import ( "fmt" + "strings" - "github.com/kyleconroy/sqlc/internal/config" - "github.com/kyleconroy/sqlc/internal/source" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/named" + "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 @@ -41,53 +42,85 @@ func isNamedParamSignCast(node ast.Node) bool { return astutils.Join(expr.Name, ".") == "@" && cast } -func NamedParameters(engine config.Engine, raw *ast.RawStmt) (*ast.RawStmt, map[int]string, []source.Edit) { +// 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, map[int]string{}, nil + return raw, allParams, nil } - hasNamedParameterSupport := engine != config.EngineMySQL - - args := map[string]int{} - argn := 0 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, isConst := flatten(fun.Args) - if num, ok := args[param]; ok && hasNamedParameterSupport { - cr.Replace(&ast.ParamRef{ - Number: num, - Location: fun.Location, - }) - } else { - argn += 1 - args[param] = argn - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: fun.Location, - }) - } - // TODO: This code assumes that sqlc.arg(name) is on a single line - var old, replace string - if isConst { - old = fmt.Sprintf("sqlc.arg('%s')", param) - } else { - old = fmt.Sprintf("sqlc.arg(%s)", param) - } - if engine == config.EngineMySQL { - replace = "?" + 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", args[param]) + replace = fmt.Sprintf("$%d", argn) } + edits = append(edits, source.Edit{ Location: fun.Location - raw.StmtLocation, - Old: old, + Old: origText, New: replace, }) return false @@ -95,51 +128,58 @@ func NamedParameters(engine config.Engine, raw *ast.RawStmt) (*ast.RawStmt, map[ case isNamedParamSignCast(node): expr := node.(*ast.A_Expr) cast := expr.Rexpr.(*ast.TypeCast) - param, _ := flatten(cast.Arg) - if num, ok := args[param]; ok { - cast.Arg = &ast.ParamRef{ - Number: num, - Location: expr.Location, - } - cr.Replace(cast) - } else { - argn += 1 - args[param] = argn - cast.Arg = &ast.ParamRef{ - Number: argn, - Location: expr.Location, - } - cr.Replace(cast) + 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", param), - New: fmt.Sprintf("$%d", args[param]), + Old: fmt.Sprintf("@%s", paramName), + New: replace, }) return false case named.IsParamSign(node): expr := node.(*ast.A_Expr) - param, _ := flatten(expr.Rexpr) - if num, ok := args[param]; ok { - cr.Replace(&ast.ParamRef{ - Number: num, - Location: expr.Location, - }) + 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 { - argn += 1 - args[param] = argn - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: expr.Location, - }) + replace = fmt.Sprintf("$%d", argn) } - // TODO: This code assumes that @foo is on a single line + edits = append(edits, source.Edit{ Location: expr.Location - raw.StmtLocation, - Old: fmt.Sprintf("@%s", param), - New: fmt.Sprintf("$%d", args[param]), + Old: fmt.Sprintf("@%s", paramName), + New: replace, }) return false @@ -148,9 +188,5 @@ func NamedParameters(engine config.Engine, raw *ast.RawStmt) (*ast.RawStmt, map[ } }, nil) - named := map[int]string{} - for k, v := range args { - named[v] = k - } - return node.(*ast.RawStmt), named, edits + return node.(*ast.RawStmt), allParams, edits } diff --git a/internal/sql/sqlerr/errors.go b/internal/sql/sqlerr/errors.go index 13c38ef1ae..c9cf58dfa0 100644 --- a/internal/sql/sqlerr/errors.go +++ b/internal/sql/sqlerr/errors.go @@ -35,7 +35,7 @@ func ColumnExists(rel, col string) *Error { return &Error{ Err: Exists, Code: "42701", - Message: fmt.Sprintf("column \"%s\" of relation \"%s\"", col, rel), + Message: fmt.Sprintf("column %q of relation %q", col, rel), } } @@ -43,7 +43,7 @@ func ColumnNotFound(rel, col string) *Error { return &Error{ Err: NotFound, Code: "42703", - Message: fmt.Sprintf("column \"%s\" of relation \"%s\"", col, rel), + Message: fmt.Sprintf("column %q of relation %q", col, rel), } } @@ -51,7 +51,7 @@ func RelationExists(rel string) *Error { return &Error{ Err: Exists, Code: "42P07", - Message: fmt.Sprintf("relation \"%s\"", rel), + Message: fmt.Sprintf("relation %q", rel), } } @@ -59,7 +59,7 @@ func RelationNotFound(rel string) *Error { return &Error{ Err: NotFound, Code: "42P01", - Message: fmt.Sprintf("relation \"%s\"", rel), + Message: fmt.Sprintf("relation %q", rel), } } @@ -67,7 +67,7 @@ func SchemaExists(name string) *Error { return &Error{ Err: Exists, Code: "42P06", - Message: fmt.Sprintf("schema \"%s\"", name), + Message: fmt.Sprintf("schema %q", name), } } @@ -75,7 +75,7 @@ func SchemaNotFound(sch string) *Error { return &Error{ Err: NotFound, Code: "3F000", - Message: fmt.Sprintf("schema \"%s\"", sch), + Message: fmt.Sprintf("schema %q", sch), } } @@ -83,7 +83,7 @@ func TypeExists(typ string) *Error { return &Error{ Err: Exists, Code: "42710", - Message: fmt.Sprintf("type \"%s\"", typ), + Message: fmt.Sprintf("type %q", typ), } } @@ -91,7 +91,7 @@ func TypeNotFound(typ string) *Error { return &Error{ Err: NotFound, Code: "42704", - Message: fmt.Sprintf("type \"%s\"", typ), + Message: fmt.Sprintf("type %q", typ), } } @@ -99,13 +99,13 @@ func FunctionNotFound(fun string) *Error { return &Error{ Err: NotFound, Code: "42704", - Message: fmt.Sprintf("function \"%s\"", fun), + Message: fmt.Sprintf("function %q", fun), } } func FunctionNotUnique(fn string) *Error { return &Error{ Err: NotUnique, - Message: fmt.Sprintf("function name \"%s\"", fn), + Message: fmt.Sprintf("function name %q", fn), } } 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/internal/sql/sqlfile/testdata/empty_input/input.sql b/internal/sql/sqlfile/testdata/empty_input/input.sql new file mode 100644 index 0000000000..e69de29bb2 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 81dd8aadaa..278ebf3a05 100644 --- a/internal/sql/sqlpath/read.go +++ b/internal/sql/sqlpath/read.go @@ -2,25 +2,43 @@ package sqlpath import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" - "github.com/kyleconroy/sqlc/internal/migrations" + "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 := ioutil.ReadDir(path) + listing, err := os.ReadDir(path) if err != nil { return nil, err } @@ -28,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/internal/sql/sqlpath/testdata/.hidden.sql b/internal/sql/sqlpath/testdata/.hidden.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/.hiddendir/file1.sql b/internal/sql/sqlpath/testdata/.hiddendir/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/extra.txt b/internal/sql/sqlpath/testdata/extra.txt new file mode 100644 index 0000000000..e69de29bb2 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 6c9a60b298..66e849de6c 100644 --- a/internal/sql/validate/cmd.go +++ b/internal/sql/validate/cmd.go @@ -1,14 +1,77 @@ package validate import ( + "errors" "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "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 { + stmt, ok := n.(*ast.InsertStmt) + if !ok { + return errors.New(":copyfrom requires an INSERT INTO statement") + } + if stmt.OnConflictClause != nil { + return errors.New(":copyfrom is not compatible with ON CONFLICT") + } + if stmt.WithClause != nil { + return errors.New(":copyfrom is not compatible with WITH clauses") + } + if stmt.ReturningList != nil && len(stmt.ReturningList.Items) > 0 { + return errors.New(":copyfrom is not compatible with RETURNING") + } + sel, ok := stmt.SelectStmt.(*ast.SelectStmt) + if !ok { + return nil + } + if len(sel.FromClause.Items) > 0 { + return errors.New(":copyfrom is not compatible with INSERT INTO ... SELECT") + } + if sel.ValuesLists == nil || len(sel.ValuesLists.Items) != 1 { + return errors.New(":copyfrom requires exactly one example row to be inserted") + } + sublist, ok := sel.ValuesLists.Items[0].(*ast.List) + if !ok { + return nil + } + for _, v := range sublist.Items { + _, ok := v.(*ast.ParamRef) + ok = ok || named.IsParamFunc(v) + ok = ok || named.IsParamSign(v) + if !ok { + return errors.New(":copyfrom doesn't support non-parameter values") + } + } + return nil +} + +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 { + return errors.New(":batch* commands require parameters") + } + return nil +} + func Cmd(n ast.Node, name, cmd string) error { - // TODO: Convert cmd to an enum - if !(cmd == ":many" || cmd == ":one") { + if cmd == metadata.CmdCopyFrom { + return validateCopyfrom(n) + } + if (cmd == metadata.CmdBatchExec || cmd == metadata.CmdBatchMany) || cmd == metadata.CmdBatchOne { + if err := validateBatch(n); err != nil { + return err + } + } + 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 157f835f28..dad621eb12 100644 --- a/internal/sql/validate/func_call.go +++ b/internal/sql/validate/func_call.go @@ -2,17 +2,18 @@ package validate import ( "errors" - "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/catalog" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) type funcCallVisitor struct { - catalog *catalog.Catalog - err error + catalog *catalog.Catalog + settings config.CombinedSettings + err error } func (v *funcCallVisitor) Visit(node ast.Node) astutils.Visitor { @@ -29,46 +30,23 @@ func (v *funcCallVisitor) Visit(node ast.Node) astutils.Visitor { return v } - // Custom validation for sqlc.arg - // TODO: Replace this once type-checking is implemented if fn.Schema == "sqlc" { - if fn.Name != "arg" { - v.err = sqlerr.FunctionNotFound("sqlc." + fn.Name) - return nil - } - if call.Args == nil || len(call.Args.Items) == 0 { - return v - } - if len(call.Args.Items) > 1 { - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected 1 parameter to sqlc.arg; got %d", 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.arg to be string or reference; got %T", n), - Location: call.Pos(), - } - return nil - } + return nil } fun, err := v.catalog.ResolveFuncCall(call) - if fun != nil || errors.Is(err, sqlerr.NotFound) { + if fun != nil { + return v + } + if errors.Is(err, sqlerr.NotFound) && !v.settings.Package.StrictFunctionChecks { return v } - v.err = err return nil } -func FuncCall(c *catalog.Catalog, n ast.Node) error { - visitor := funcCallVisitor{catalog: c} +func FuncCall(c *catalog.Catalog, cs config.CombinedSettings, n ast.Node) error { + visitor := funcCallVisitor{catalog: c, settings: cs} astutils.Walk(&visitor, n) return visitor.err } diff --git a/internal/sql/validate/in.go b/internal/sql/validate/in.go new file mode 100644 index 0000000000..56bcee125d --- /dev/null +++ b/internal/sql/validate/in.go @@ -0,0 +1,86 @@ +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 e86de4f46a..dd8041ea23 100644 --- a/internal/sql/validate/insert_stmt.go +++ b/internal/sql/validate/insert_stmt.go @@ -1,8 +1,8 @@ package validate import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) func InsertStmt(stmt *ast.InsertStmt) error { diff --git a/internal/sql/validate/param_ref.go b/internal/sql/validate/param_ref.go index eacdb64fad..ab9413f40f 100644 --- a/internal/sql/validate/param_ref.go +++ b/internal/sql/validate/param_ref.go @@ -1,36 +1,48 @@ package validate import ( + "errors" "fmt" - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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) error { +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]struct{}{} + seen := map[int]bool{} for _, r := range allrefs { - seen[r.Number] = struct{}{} + if r.Number > 0 { + seen[r.Number] = true + } } - for i := 1; i <= len(seen); i += 1 { if _, ok := seen[i]; !ok { - return &sqlerr.Error{ + return seen, !nodollar, &sqlerr.Error{ Code: "42P18", Message: fmt.Sprintf("could not determine data type of parameter $%d", i), } } } - return nil + return seen, !nodollar, nil } diff --git a/internal/sql/validate/param_style.go b/internal/sql/validate/param_style.go index 870f460f66..1182051d20 100644 --- a/internal/sql/validate/param_style.go +++ b/internal/sql/validate/param_style.go @@ -1,34 +1,68 @@ package validate import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/astutils" - "github.com/kyleconroy/sqlc/internal/sql/named" - "github.com/kyleconroy/sqlc/internal/sql/sqlerr" + "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" ) -// A query can use one (and only one) of the following formats: -// - positional parameters $1 -// - named parameter operator @param -// - named parameter function calls sqlc.arg(param) -func ParamStyle(n ast.Node) error { - positional := astutils.Search(n, func(node ast.Node) bool { - _, ok := node.(*ast.ParamRef) - return ok - }) - namedFunc := astutils.Search(n, named.IsParamFunc) - namedSign := astutils.Search(n, named.IsParamSign) - for _, check := range []bool{ - len(positional.Items) > 0 && len(namedSign.Items)+len(namedFunc.Items) > 0, - len(namedFunc.Items) > 0 && len(namedSign.Items)+len(positional.Items) > 0, - len(namedSign.Items) > 0 && len(positional.Items)+len(namedFunc.Items) > 0, - } { - if check { - return &sqlerr.Error{ - Code: "", // TODO: Pick a new error code - Message: "query mixes positional parameters ($1) and named parameters (sqlc.arg or @arg)", +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/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..39a1af6160 --- /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() (interface{}, 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..1b2d842c70 --- /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() (interface{}, 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/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..243a7133ab --- /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() (interface{}, 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 f793e42a59..bddfe0042c 100644 --- a/internal/sqltest/mysql.go +++ b/internal/sqltest/mysql.go @@ -3,17 +3,22 @@ package sqltest import ( "database/sql" "fmt" - "io/ioutil" "os" "path/filepath" "testing" - "github.com/kyleconroy/sqlc/internal/sql/sqlpath" - _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { + // For each test, pick a new database name at random. + name := "sqltest_mysql_" + id() + return CreateMySQLDatabase(t, name, migrations) +} + +func CreateMySQLDatabase(t *testing.T, name string, migrations []string) (*sql.DB, func()) { t.Helper() data := os.Getenv("MYSQL_DATABASE") @@ -50,13 +55,11 @@ func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { t.Fatal(err) } - // For each test, pick a new database name at random. - dbName := "sqltest_mysql_" + id() - if _, err := db.Exec("CREATE DATABASE " + dbName); err != nil { + if _, err := db.Exec("CREATE DATABASE " + name); err != nil { t.Fatal(err) } - source = fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?multiStatements=true&parseTime=true", user, pass, host, port, dbName) + source = fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?multiStatements=true&parseTime=true", user, pass, host, port, name) sdb, err := sql.Open("mysql", source) if err != nil { t.Fatal(err) @@ -67,7 +70,7 @@ func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { t.Fatal(err) } for _, f := range files { - blob, err := ioutil.ReadFile(f) + blob, err := os.ReadFile(f) if err != nil { t.Fatal(err) } @@ -78,7 +81,7 @@ func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { return sdb, func() { // Drop the test db after test runs - if _, err := db.Exec("DROP DATABASE " + dbName); err != nil { + if _, err := db.Exec("DROP DATABASE " + name); err != nil { t.Fatal(err) } } 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..69482bace6 --- /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() (interface{}, 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..f805a40a1c --- /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() (interface{}, 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 new file mode 100644 index 0000000000..73e01701bd --- /dev/null +++ b/internal/sqltest/pgx.go @@ -0,0 +1,88 @@ +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 index f85e933f43..edf6272d41 100644 --- a/internal/sqltest/postgres.go +++ b/internal/sqltest/postgres.go @@ -3,14 +3,13 @@ package sqltest import ( "database/sql" "fmt" - "io/ioutil" "math/rand" "os" "path/filepath" "testing" "time" - "github.com/kyleconroy/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" _ "github.com/lib/pq" ) @@ -32,6 +31,14 @@ func id() string { 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") @@ -67,12 +74,22 @@ func PostgreSQL(t *testing.T, migrations []string) (*sql.DB, func()) { } // For each test, pick a new schema name at random. - schema := "sqltest_postgresql_" + id() - if _, err := db.Exec("CREATE SCHEMA " + schema); err != nil { - t.Fatal(err) + 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", source+"&search_path="+schema) + sdb, err := sql.Open("postgres", newsource) if err != nil { t.Fatal(err) } @@ -82,7 +99,7 @@ func PostgreSQL(t *testing.T, migrations []string) (*sql.DB, func()) { t.Fatal(err) } for _, f := range files { - blob, err := ioutil.ReadFile(f) + blob, err := os.ReadFile(f) if err != nil { t.Fatal(err) } @@ -92,8 +109,9 @@ func PostgreSQL(t *testing.T, migrations []string) (*sql.DB, func()) { } return sdb, func() { - if _, err := db.Exec("DROP SCHEMA " + schema + " CASCADE"); err != nil { + if _, err := db.Exec(dropQuery); err != nil { t.Fatal(err) } + db.Close() } } diff --git a/internal/sqltest/sqlite.go b/internal/sqltest/sqlite.go new file mode 100644 index 0000000000..3ad04bb78d --- /dev/null +++ b/internal/sqltest/sqlite.go @@ -0,0 +1,56 @@ +package sqltest + +import ( + "database/sql" + "os" + "path/filepath" + "testing" + + _ "github.com/ncruces/go-sqlite3/driver" + _ "github.com/ncruces/go-sqlite3/embed" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +func SQLite(t *testing.T, migrations []string) (*sql.DB, func()) { + t.Helper() + // For each test, pick a new database name at random. + source, err := os.CreateTemp("", "sqltest_sqlite_") + if err != nil { + t.Fatal(err) + } + if err := source.Close(); err != nil { + t.Fatal(err) + } + return CreateSQLiteDatabase(t, source.Name(), migrations) +} + +func CreateSQLiteDatabase(t *testing.T, path string, migrations []string) (*sql.DB, func()) { + t.Helper() + + t.Logf("open %s\n", path) + sdb, err := sql.Open("sqlite3", path) + 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 := os.Stat(path); err == nil { + os.Remove(path) + } + } +} diff --git a/internal/tools/sqlc-pg-gen/main.go b/internal/tools/sqlc-pg-gen/main.go index 2500c77692..d70dcb9595 100644 --- a/internal/tools/sqlc-pg-gen/main.go +++ b/internal/tools/sqlc-pg-gen/main.go @@ -3,36 +3,19 @@ package main import ( "bytes" "context" + "flag" "fmt" "go/format" - "io/ioutil" "log" "os" "path/filepath" + "sort" "strings" "text/template" - pgx "github.com/jackc/pgx/v4" - - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "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] -FROM pg_catalog.pg_proc p -LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace -WHERE n.nspname OPERATOR(pg_catalog.~) '^(pg_catalog)$' - AND p.proargmodes IS NULL - AND pg_function_is_visible(p.oid) -ORDER BY 1; -` - // 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 @@ -50,12 +33,13 @@ 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.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 p.proargmodes IS NULL - AND pg_function_is_visible(p.oid) -ORDER BY 1; +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 = ` @@ -64,32 +48,67 @@ const catalogTmpl = ` package {{.Pkg}} import ( - "github.com/kyleconroy/sqlc/internal/sql/ast" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func {{.Name}}() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = []*catalog.Function{ - {{- range .Funcs}} - { +var funcs{{.GenFnName}} = []*catalog.Function { + {{- range .Procs}} + { + Name: "{{.Name}}", + Args: []*catalog.Argument{ + {{range .Args}}{ + {{- if .Name}} Name: "{{.Name}}", - Args: []*catalog.Argument{ - {{range .Args}}{ - {{- if .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}}", - {{- end}} - {{- if .HasDefault}} - HasDefault: true, - {{- end}} - Type: &ast.TypeName{Name: "{{.Type.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}} }, - ReturnType: &ast.TypeName{Name: "{{.ReturnType.Name}}"}, }, {{- end}} } + {{- end }} return s } ` @@ -100,8 +119,8 @@ const loaderFuncTmpl = ` package postgresql import ( - "github.com/kyleconroy/sqlc/internal/engine/postgresql/contrib" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql/contrib" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) func loadExtension(name string) *catalog.Schema { @@ -116,9 +135,11 @@ func loadExtension(name string) *catalog.Schema { ` type tmplCtx struct { - Pkg string - Name string - Funcs []catalog.Function + Pkg string + GenFnName string + SchemaName string + Procs []Proc + Relations []Relation } func main() { @@ -127,14 +148,6 @@ func main() { } } -type Proc struct { - Name string - ReturnType string - ArgTypes []string - ArgNames []string - HasDefault []string -} - func clean(arg string) string { arg = strings.TrimSpace(arg) arg = strings.Replace(arg, "\"any\"", "any", -1) @@ -143,121 +156,150 @@ func clean(arg string) string { return arg } -func (p Proc) Func() catalog.Function { - return catalog.Function{ - Name: p.Name, - Args: p.Args(), - ReturnType: &ast.TypeName{Name: clean(p.ReturnType)}, - } -} - -func (p Proc) Args() []*catalog.Argument { - defaults := map[string]bool{} - var args []*catalog.Argument - if len(p.ArgTypes) == 0 { - return args +// 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 } - for _, name := range p.HasDefault { - defaults[name] = true + code, err := format.Source(out.Bytes()) + if err != nil { + return err } - for i, arg := range p.ArgTypes { - var name string - if i < len(p.ArgNames) { - name = p.ArgNames[i] - } - args = append(args, &catalog.Argument{ - Name: name, - HasDefault: defaults[name], - Type: &ast.TypeName{Name: clean(arg)}, - }) + + err = os.WriteFile(destPath, code, 0644) + if err != nil { + return err } - return args + + return nil } -func scanFuncs(rows pgx.Rows) ([]catalog.Function, error) { - defer rows.Close() - // Iterate through the result set - var funcs []catalog.Function - for rows.Next() { - var p Proc - err := rows.Scan( - &p.Name, - &p.ReturnType, - &p.ArgTypes, - &p.ArgNames, - &p.HasDefault, - ) - if err != nil { - return nil, err +// 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 } - // TODO: Filter these out in SQL - if strings.HasPrefix(p.ReturnType, "SETOF") { - continue + if fnA.Name == "generate_series" && fnB.Name == "generate_series" && len(fnA.ArgTypes) == 2 && fnA.ArgTypes[0] == "numeric" { + return true } - // 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" { + 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 } - funcs = append(funcs, p.Func()) + procs = append(procs, p) } - return funcs, rows.Err() + + 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, os.Getenv("DATABASE_URL")) + conn, err := pgx.Connect(ctx, databaseURL()) if err != nil { return err } defer conn.Close(ctx) - // Generate internal/engine/postgresql/pg_catalog.gen.go - rows, err := conn.Query(ctx, catalogFuncs) - if err != nil { - return err - } - funcs, err := scanFuncs(rows) - if err != nil { - return err - } - out := bytes.NewBuffer([]byte{}) - if err := tmpl.Execute(out, tmplCtx{Pkg: "postgresql", Name: "genPGCatalog", Funcs: funcs}); err != nil { - return err - } - code, err := format.Source(out.Bytes()) - if err != nil { - return err + 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"), + }, } - err = ioutil.WriteFile(filepath.Join("internal", "engine", "postgresql", "pg_catalog.go"), code, 0644) - if err != nil { - return err + + 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) @@ -266,62 +308,74 @@ func run(ctx context.Context) error { funcName += strings.Title(part) } - _, err := conn.Exec(ctx, fmt.Sprintf("CREATE EXTENSION IF NOT EXISTS \"%s\"", extension)) - if err != nil { - log.Printf("error creating %s: %s", extension, err) - continue + 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 } - funcs, err := scanFuncs(rows) + procs, err := scanProcs(rows) if err != nil { return err } - if len(funcs) == 0 { + if len(procs) == 0 { log.Printf("no functions in %s, skipping", extension) continue } - out := bytes.NewBuffer([]byte{}) - if err := tmpl.Execute(out, tmplCtx{Pkg: "contrib", Name: funcName, Funcs: funcs}); err != nil { - return err - } - code, err := format.Source(out.Bytes()) - if err != nil { - return err - } - err = ioutil.WriteFile(filepath.Join("internal", "engine", "postgresql", "contrib", name+".go"), code, 0644) + + // 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 err + return fmt.Errorf("error generating extension %s: %w", extension, err) } loaded = append(loaded, extensionPair{Name: extension, Func: funcName}) } - { - tmpl, err := template.New("").Parse(loaderFuncTmpl) - if err != nil { - return err - } - out := bytes.NewBuffer([]byte{}) - if err := tmpl.Execute(out, loaded); err != nil { - return err - } - code, err := format.Source(out.Bytes()) - if err != nil { - return err - } - err = ioutil.WriteFile(filepath.Join("internal", "engine", "postgresql", "extension.go"), code, 0644) - if err != nil { - return err - } + 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 @@ -331,16 +385,16 @@ type extensionPair struct { var extensions = []string{ "adminpack", "amcheck", - "auth_delay", - "auto_explain", - "bloom", + // "auth_delay", + // "auto_explain", + // "bloom", "btree_gin", "btree_gist", "citext", "cube", "dblink", - "dict_int", - "dict_xsyn", + // "dict_int", + // "dict_xsyn", "earthdistance", "file_fdw", "fuzzystrmatch", @@ -351,26 +405,26 @@ var extensions = []string{ "lo", "ltree", "pageinspect", - "passwordcheck", + // "passwordcheck", "pg_buffercache", - "pgcrypto", "pg_freespacemap", "pg_prewarm", - "pgrowlocks", "pg_stat_statements", - "pgstattuple", "pg_trgm", "pg_visibility", + "pgcrypto", + "pgrowlocks", + "pgstattuple", "postgres_fdw", "seg", - "sepgsql", - "spi", + // "sepgsql", + // "spi", "sslinfo", "tablefunc", "tcn", - "test_decoding", - "tsm_system_rows", - "tsm_system_time", + // "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 new file mode 100644 index 0000000000..07629ed6ea --- /dev/null +++ b/internal/tools/sqlc-pg-gen/proc.go @@ -0,0 +1,167 @@ +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/tools/sqlc-pg-gen/relation.go b/internal/tools/sqlc-pg-gen/relation.go new file mode 100644 index 0000000000..3b61489392 --- /dev/null +++ b/internal/tools/sqlc-pg-gen/relation.go @@ -0,0 +1,111 @@ +package main + +import ( + "context" + + pgx "github.com/jackc/pgx/v4" +) + +// Relations are the relations available in pg_tables and pg_views +// such as pg_catalog.pg_timezone_names +const relationQuery = ` +with relations as ( + select schemaname, tablename as name from pg_catalog.pg_tables + UNION ALL + select schemaname, viewname as name from pg_catalog.pg_views +) +select + relations.schemaname, + 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 +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 +where relations.schemaname = $1 +-- Make sure these columns are always generated in the same order +-- so that the output is stable +order by + relations.schemaname ASC, + relations.name ASC, + pg_attribute.attnum ASC +` + +type Relation struct { + Catalog string + SchemaName string + Name string + Columns []RelationColumn +} + +type RelationColumn struct { + Name string + Type string + IsNotNull bool + IsArray bool + Length *int +} + +func scanRelations(rows pgx.Rows) ([]Relation, error) { + defer rows.Close() + // Iterate through the result set + var relations []Relation + var prevRel *Relation + + for rows.Next() { + var schemaName string + var tableName string + var columnName string + var columnNotNull bool + var columnType string + var columnLength *int + var columnIsArray bool + err := rows.Scan( + &schemaName, + &tableName, + &columnName, + &columnNotNull, + &columnType, + &columnLength, + &columnIsArray, + ) + if err != nil { + return nil, err + } + + if prevRel == nil || tableName != prevRel.Name { + // We are on the same table, just keep adding columns + r := Relation{ + Catalog: "pg_catalog", + SchemaName: schemaName, + Name: tableName, + } + + relations = append(relations, r) + prevRel = &relations[len(relations)-1] + } + + prevRel.Columns = append(prevRel.Columns, RelationColumn{ + Name: columnName, + Type: columnType, + IsNotNull: columnNotNull, + IsArray: columnIsArray, + Length: columnLength, + }) + } + + return relations, rows.Err() +} + +func readRelations(ctx context.Context, conn *pgx.Conn, schemaName string) ([]Relation, error) { + rows, err := conn.Query(ctx, relationQuery, schemaName) + if err != nil { + return nil, err + } + + return scanRelations(rows) +} diff --git a/internal/tracer/trace.go b/internal/tracer/trace.go new file mode 100644 index 0000000000..8252f49b38 --- /dev/null +++ b/internal/tracer/trace.go @@ -0,0 +1,32 @@ +package tracer + +import ( + "context" + "fmt" + "os" + "runtime/trace" + + "github.com/sqlc-dev/sqlc/internal/debug" +) + +// 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. +func Start(base context.Context) (_ context.Context, cleanup func(), _ error) { + f, err := os.Create(debug.Debug.Trace) + if err != nil { + return base, cleanup, fmt.Errorf("failed to create trace output file: %v", err) + } + + if err := trace.Start(f); err != nil { + return base, cleanup, fmt.Errorf("failed to start trace: %v", err) + } + + ctx, task := trace.NewTask(base, "sqlc") + + return ctx, func() { + defer f.Close() + defer trace.Stop() + defer task.End() + }, nil +} diff --git a/internal/vet/vet.pb.go b/internal/vet/vet.pb.go new file mode 100644 index 0000000000..b40f109c10 --- /dev/null +++ b/internal/vet/vet.pb.go @@ -0,0 +1,1649 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: vet/vet.proto + +package vet + +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 Parameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` +} + +func (x *Parameter) Reset() { + *x = Parameter{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[0] + 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_vet_vet_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 Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{0} +} + +func (x *Parameter) GetNumber() int32 { + if x != nil { + return x.Number + } + return 0 +} + +type Config 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"` +} + +func (x *Config) Reset() { + *x = Config{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 Config.ProtoReflect.Descriptor instead. +func (*Config) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{1} +} + +func (x *Config) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Config) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *Config) GetSchema() []string { + if x != nil { + return x.Schema + } + return nil +} + +func (x *Config) GetQueries() []string { + if x != nil { + return x.Queries + } + return nil +} + +type Query struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Params []*Parameter `protobuf:"bytes,4,rep,name=params,json=parameters,proto3" json:"params,omitempty"` +} + +func (x *Query) Reset() { + *x = Query{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Query) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Query) ProtoMessage() {} + +func (x *Query) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 Query.ProtoReflect.Descriptor instead. +func (*Query) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{2} +} + +func (x *Query) GetSql() string { + if x != nil { + return x.Sql + } + return "" +} + +func (x *Query) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Query) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +func (x *Query) GetParams() []*Parameter { + if x != nil { + return x.Params + } + return nil +} + +type PostgreSQL struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Explain *PostgreSQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` +} + +func (x *PostgreSQL) Reset() { + *x = PostgreSQL{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostgreSQL) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostgreSQL) ProtoMessage() {} + +func (x *PostgreSQL) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 PostgreSQL.ProtoReflect.Descriptor instead. +func (*PostgreSQL) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{3} +} + +func (x *PostgreSQL) GetExplain() *PostgreSQLExplain { + if x != nil { + return x.Explain + } + return nil +} + +type PostgreSQLExplain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plan *PostgreSQLExplain_Plan `protobuf:"bytes,1,opt,name=plan,json=Plan,proto3" json:"plan,omitempty"` + Settings map[string]string `protobuf:"bytes,2,rep,name=settings,json=Settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Planning *PostgreSQLExplain_Planning `protobuf:"bytes,3,opt,name=planning,json=Planning,proto3" json:"planning,omitempty"` +} + +func (x *PostgreSQLExplain) Reset() { + *x = PostgreSQLExplain{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostgreSQLExplain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostgreSQLExplain) ProtoMessage() {} + +func (x *PostgreSQLExplain) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_proto_msgTypes[4] + 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 PostgreSQLExplain.ProtoReflect.Descriptor instead. +func (*PostgreSQLExplain) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{4} +} + +func (x *PostgreSQLExplain) GetPlan() *PostgreSQLExplain_Plan { + if x != nil { + return x.Plan + } + return nil +} + +func (x *PostgreSQLExplain) GetSettings() map[string]string { + if x != nil { + return x.Settings + } + return nil +} + +func (x *PostgreSQLExplain) GetPlanning() *PostgreSQLExplain_Planning { + if x != nil { + return x.Planning + } + return nil +} + +type MySQL struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Explain *MySQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` +} + +func (x *MySQL) Reset() { + *x = MySQL{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQL) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQL) ProtoMessage() {} + +func (x *MySQL) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 MySQL.ProtoReflect.Descriptor instead. +func (*MySQL) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{5} +} + +func (x *MySQL) GetExplain() *MySQLExplain { + if x != nil { + return x.Explain + } + return nil +} + +type MySQLExplain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QueryBlock *MySQLExplain_QueryBlock `protobuf:"bytes,1,opt,name=query_block,json=queryBlock,proto3" json:"query_block,omitempty"` +} + +func (x *MySQLExplain) Reset() { + *x = MySQLExplain{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQLExplain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQLExplain) ProtoMessage() {} + +func (x *MySQLExplain) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_proto_msgTypes[6] + 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 MySQLExplain.ProtoReflect.Descriptor instead. +func (*MySQLExplain) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{6} +} + +func (x *MySQLExplain) GetQueryBlock() *MySQLExplain_QueryBlock { + if x != nil { + return x.QueryBlock + } + return nil +} + +type PostgreSQLExplain_Plan struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeType string `protobuf:"bytes,1,opt,name=node_type,json=Node Type,proto3" json:"node_type,omitempty"` + ParentRelationship string `protobuf:"bytes,2,opt,name=parent_relationship,json=Parent Relationship,proto3" json:"parent_relationship,omitempty"` + RelationName string `protobuf:"bytes,3,opt,name=relation_name,json=Relation Name,proto3" json:"relation_name,omitempty"` + Schema string `protobuf:"bytes,4,opt,name=schema,json=Schema,proto3" json:"schema,omitempty"` + Alias string `protobuf:"bytes,5,opt,name=alias,json=Alias,proto3" json:"alias,omitempty"` + ParallelAware bool `protobuf:"varint,6,opt,name=parallel_aware,json=Parallel Aware,proto3" json:"parallel_aware,omitempty"` + AsyncCapable bool `protobuf:"varint,7,opt,name=async_capable,json=Async Capable,proto3" json:"async_capable,omitempty"` + StartupCost float32 `protobuf:"fixed32,8,opt,name=startup_cost,json=Startup Cost,proto3" json:"startup_cost,omitempty"` + TotalCost float32 `protobuf:"fixed32,9,opt,name=total_cost,json=Total Cost,proto3" json:"total_cost,omitempty"` + PlanRows uint64 `protobuf:"varint,10,opt,name=plan_rows,json=Plan Rows,proto3" json:"plan_rows,omitempty"` + PlanWidth uint64 `protobuf:"varint,11,opt,name=plan_width,json=Plan Width,proto3" json:"plan_width,omitempty"` + Output []string `protobuf:"bytes,12,rep,name=output,json=Output,proto3" json:"output,omitempty"` + Plans []*PostgreSQLExplain_Plan `protobuf:"bytes,13,rep,name=plans,json=Plans,proto3" json:"plans,omitempty"` + // Embedded "Blocks" fields + SharedHitBlocks uint64 `protobuf:"varint,14,opt,name=shared_hit_blocks,json=Shared Hit Blocks,proto3" json:"shared_hit_blocks,omitempty"` + SharedReadBlocks uint64 `protobuf:"varint,15,opt,name=shared_read_blocks,json=Shared Read Blocks,proto3" json:"shared_read_blocks,omitempty"` + SharedDirtiedBlocks uint64 `protobuf:"varint,16,opt,name=shared_dirtied_blocks,json=Shared Dirtied Blocks,proto3" json:"shared_dirtied_blocks,omitempty"` + SharedWrittenBlocks uint64 `protobuf:"varint,17,opt,name=shared_written_blocks,json=Shared Written Blocks,proto3" json:"shared_written_blocks,omitempty"` + LocalHitBlocks uint64 `protobuf:"varint,18,opt,name=local_hit_blocks,json=Local Hit Blocks,proto3" json:"local_hit_blocks,omitempty"` + LocalReadBlocks uint64 `protobuf:"varint,19,opt,name=local_read_blocks,json=Local Read Blocks,proto3" json:"local_read_blocks,omitempty"` + LocalDirtiedBlocks uint64 `protobuf:"varint,20,opt,name=local_dirtied_blocks,json=Local Dirtied Blocks,proto3" json:"local_dirtied_blocks,omitempty"` + LocalWrittenBlocks uint64 `protobuf:"varint,21,opt,name=local_written_blocks,json=Local Written Blocks,proto3" json:"local_written_blocks,omitempty"` + TempReadBlocks uint64 `protobuf:"varint,22,opt,name=temp_read_blocks,json=Temp Read Blocks,proto3" json:"temp_read_blocks,omitempty"` + TempWrittenBlocks uint64 `protobuf:"varint,23,opt,name=temp_written_blocks,json=Temp Written Blocks,proto3" json:"temp_written_blocks,omitempty"` + // "Node Type": "Sort" fields + SortKey []string `protobuf:"bytes,24,rep,name=sort_key,json=Sort Key,proto3" json:"sort_key,omitempty"` + // "Node Type": "Hash Join" fields + JoinType string `protobuf:"bytes,25,opt,name=join_type,json=Join Type,proto3" json:"join_type,omitempty"` + InnerUnique bool `protobuf:"varint,26,opt,name=inner_unique,json=Inner Unique,proto3" json:"inner_unique,omitempty"` + HashCond string `protobuf:"bytes,27,opt,name=hash_cond,json=Hash Cond,proto3" json:"hash_cond,omitempty"` + // "Node Type": "Index Scan" fields + IndexName string `protobuf:"bytes,28,opt,name=index_name,json=Index Name,proto3" json:"index_name,omitempty"` + ScanDirection string `protobuf:"bytes,29,opt,name=scan_direction,json=Scan Direction,proto3" json:"scan_direction,omitempty"` + IndexCond string `protobuf:"bytes,30,opt,name=index_cond,json=Index Cond,proto3" json:"index_cond,omitempty"` +} + +func (x *PostgreSQLExplain_Plan) Reset() { + *x = PostgreSQLExplain_Plan{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostgreSQLExplain_Plan) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostgreSQLExplain_Plan) ProtoMessage() {} + +func (x *PostgreSQLExplain_Plan) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 PostgreSQLExplain_Plan.ProtoReflect.Descriptor instead. +func (*PostgreSQLExplain_Plan) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{4, 1} +} + +func (x *PostgreSQLExplain_Plan) GetNodeType() string { + if x != nil { + return x.NodeType + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetParentRelationship() string { + if x != nil { + return x.ParentRelationship + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetRelationName() string { + if x != nil { + return x.RelationName + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetSchema() string { + if x != nil { + return x.Schema + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetAlias() string { + if x != nil { + return x.Alias + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetParallelAware() bool { + if x != nil { + return x.ParallelAware + } + return false +} + +func (x *PostgreSQLExplain_Plan) GetAsyncCapable() bool { + if x != nil { + return x.AsyncCapable + } + return false +} + +func (x *PostgreSQLExplain_Plan) GetStartupCost() float32 { + if x != nil { + return x.StartupCost + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetTotalCost() float32 { + if x != nil { + return x.TotalCost + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetPlanRows() uint64 { + if x != nil { + return x.PlanRows + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetPlanWidth() uint64 { + if x != nil { + return x.PlanWidth + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetOutput() []string { + if x != nil { + return x.Output + } + return nil +} + +func (x *PostgreSQLExplain_Plan) GetPlans() []*PostgreSQLExplain_Plan { + if x != nil { + return x.Plans + } + return nil +} + +func (x *PostgreSQLExplain_Plan) GetSharedHitBlocks() uint64 { + if x != nil { + return x.SharedHitBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetSharedReadBlocks() uint64 { + if x != nil { + return x.SharedReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetSharedDirtiedBlocks() uint64 { + if x != nil { + return x.SharedDirtiedBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetSharedWrittenBlocks() uint64 { + if x != nil { + return x.SharedWrittenBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetLocalHitBlocks() uint64 { + if x != nil { + return x.LocalHitBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetLocalReadBlocks() uint64 { + if x != nil { + return x.LocalReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetLocalDirtiedBlocks() uint64 { + if x != nil { + return x.LocalDirtiedBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetLocalWrittenBlocks() uint64 { + if x != nil { + return x.LocalWrittenBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetTempReadBlocks() uint64 { + if x != nil { + return x.TempReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetTempWrittenBlocks() uint64 { + if x != nil { + return x.TempWrittenBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Plan) GetSortKey() []string { + if x != nil { + return x.SortKey + } + return nil +} + +func (x *PostgreSQLExplain_Plan) GetJoinType() string { + if x != nil { + return x.JoinType + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetInnerUnique() bool { + if x != nil { + return x.InnerUnique + } + return false +} + +func (x *PostgreSQLExplain_Plan) GetHashCond() string { + if x != nil { + return x.HashCond + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetIndexName() string { + if x != nil { + return x.IndexName + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetScanDirection() string { + if x != nil { + return x.ScanDirection + } + return "" +} + +func (x *PostgreSQLExplain_Plan) GetIndexCond() string { + if x != nil { + return x.IndexCond + } + return "" +} + +type PostgreSQLExplain_Planning struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SharedHitBlocks uint64 `protobuf:"varint,1,opt,name=shared_hit_blocks,json=Shared Hit Blocks,proto3" json:"shared_hit_blocks,omitempty"` + SharedReadBlocks uint64 `protobuf:"varint,2,opt,name=shared_read_blocks,json=Shared Read Blocks,proto3" json:"shared_read_blocks,omitempty"` + SharedDirtiedBlocks uint64 `protobuf:"varint,3,opt,name=shared_dirtied_blocks,json=Shared Dirtied Blocks,proto3" json:"shared_dirtied_blocks,omitempty"` + SharedWrittenBlocks uint64 `protobuf:"varint,4,opt,name=shared_written_blocks,json=Shared Written Blocks,proto3" json:"shared_written_blocks,omitempty"` + LocalHitBlocks uint64 `protobuf:"varint,5,opt,name=local_hit_blocks,json=Local Hit Blocks,proto3" json:"local_hit_blocks,omitempty"` + LocalReadBlocks uint64 `protobuf:"varint,6,opt,name=local_read_blocks,json=Local Read Blocks,proto3" json:"local_read_blocks,omitempty"` + LocalDirtiedBlocks uint64 `protobuf:"varint,7,opt,name=local_dirtied_blocks,json=Local Dirtied Blocks,proto3" json:"local_dirtied_blocks,omitempty"` + LocalWrittenBlocks uint64 `protobuf:"varint,8,opt,name=local_written_blocks,json=Local Written Blocks,proto3" json:"local_written_blocks,omitempty"` + TempReadBlocks uint64 `protobuf:"varint,9,opt,name=temp_read_blocks,json=Temp Read Blocks,proto3" json:"temp_read_blocks,omitempty"` + TempWrittenBlocks uint64 `protobuf:"varint,10,opt,name=temp_written_blocks,json=Temp Written Blocks,proto3" json:"temp_written_blocks,omitempty"` +} + +func (x *PostgreSQLExplain_Planning) Reset() { + *x = PostgreSQLExplain_Planning{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostgreSQLExplain_Planning) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostgreSQLExplain_Planning) ProtoMessage() {} + +func (x *PostgreSQLExplain_Planning) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 PostgreSQLExplain_Planning.ProtoReflect.Descriptor instead. +func (*PostgreSQLExplain_Planning) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{4, 2} +} + +func (x *PostgreSQLExplain_Planning) GetSharedHitBlocks() uint64 { + if x != nil { + return x.SharedHitBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetSharedReadBlocks() uint64 { + if x != nil { + return x.SharedReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetSharedDirtiedBlocks() uint64 { + if x != nil { + return x.SharedDirtiedBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetSharedWrittenBlocks() uint64 { + if x != nil { + return x.SharedWrittenBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetLocalHitBlocks() uint64 { + if x != nil { + return x.LocalHitBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetLocalReadBlocks() uint64 { + if x != nil { + return x.LocalReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetLocalDirtiedBlocks() uint64 { + if x != nil { + return x.LocalDirtiedBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetLocalWrittenBlocks() uint64 { + if x != nil { + return x.LocalWrittenBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetTempReadBlocks() uint64 { + if x != nil { + return x.TempReadBlocks + } + return 0 +} + +func (x *PostgreSQLExplain_Planning) GetTempWrittenBlocks() uint64 { + if x != nil { + return x.TempWrittenBlocks + } + return 0 +} + +type MySQLExplain_QueryBlock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SelectId uint64 `protobuf:"varint,1,opt,name=select_id,json=selectId,proto3" json:"select_id,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + CostInfo map[string]string `protobuf:"bytes,3,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Table *MySQLExplain_Table `protobuf:"bytes,4,opt,name=table,proto3" json:"table,omitempty"` + OrderingOperation *MySQLExplain_OrderingOperation `protobuf:"bytes,5,opt,name=ordering_operation,json=orderingOperation,proto3" json:"ordering_operation,omitempty"` + NestedLoop []*MySQLExplain_NestedLoopObj `protobuf:"bytes,6,rep,name=nested_loop,json=nestedLoop,proto3" json:"nested_loop,omitempty"` +} + +func (x *MySQLExplain_QueryBlock) Reset() { + *x = MySQLExplain_QueryBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQLExplain_QueryBlock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQLExplain_QueryBlock) ProtoMessage() {} + +func (x *MySQLExplain_QueryBlock) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 MySQLExplain_QueryBlock.ProtoReflect.Descriptor instead. +func (*MySQLExplain_QueryBlock) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *MySQLExplain_QueryBlock) GetSelectId() uint64 { + if x != nil { + return x.SelectId + } + return 0 +} + +func (x *MySQLExplain_QueryBlock) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *MySQLExplain_QueryBlock) GetCostInfo() map[string]string { + if x != nil { + return x.CostInfo + } + return nil +} + +func (x *MySQLExplain_QueryBlock) GetTable() *MySQLExplain_Table { + if x != nil { + return x.Table + } + return nil +} + +func (x *MySQLExplain_QueryBlock) GetOrderingOperation() *MySQLExplain_OrderingOperation { + if x != nil { + return x.OrderingOperation + } + return nil +} + +func (x *MySQLExplain_QueryBlock) GetNestedLoop() []*MySQLExplain_NestedLoopObj { + if x != nil { + return x.NestedLoop + } + return nil +} + +type MySQLExplain_Table struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + AccessType string `protobuf:"bytes,2,opt,name=access_type,json=accessType,proto3" json:"access_type,omitempty"` + RowsExaminedPerScan uint64 `protobuf:"varint,3,opt,name=rows_examined_per_scan,json=rowsExaminedPerScan,proto3" json:"rows_examined_per_scan,omitempty"` + RowsProducedPerJoin uint64 `protobuf:"varint,4,opt,name=rows_produced_per_join,json=rowsProducedPerJoin,proto3" json:"rows_produced_per_join,omitempty"` + Filtered string `protobuf:"bytes,5,opt,name=filtered,proto3" json:"filtered,omitempty"` + CostInfo map[string]string `protobuf:"bytes,6,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + UsedColumns []string `protobuf:"bytes,7,rep,name=used_columns,json=usedColumns,proto3" json:"used_columns,omitempty"` + Insert bool `protobuf:"varint,8,opt,name=insert,proto3" json:"insert,omitempty"` + PossibleKeys []string `protobuf:"bytes,9,rep,name=possible_keys,json=possibleKeys,proto3" json:"possible_keys,omitempty"` + Key string `protobuf:"bytes,10,opt,name=key,proto3" json:"key,omitempty"` + UsedKeyParts []string `protobuf:"bytes,11,rep,name=used_key_parts,json=usedKeyParts,proto3" json:"used_key_parts,omitempty"` + KeyLength string `protobuf:"bytes,12,opt,name=key_length,json=keyLength,proto3" json:"key_length,omitempty"` + Ref []string `protobuf:"bytes,13,rep,name=ref,proto3" json:"ref,omitempty"` +} + +func (x *MySQLExplain_Table) Reset() { + *x = MySQLExplain_Table{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQLExplain_Table) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQLExplain_Table) ProtoMessage() {} + +func (x *MySQLExplain_Table) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_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 MySQLExplain_Table.ProtoReflect.Descriptor instead. +func (*MySQLExplain_Table) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{6, 1} +} + +func (x *MySQLExplain_Table) GetTableName() string { + if x != nil { + return x.TableName + } + return "" +} + +func (x *MySQLExplain_Table) GetAccessType() string { + if x != nil { + return x.AccessType + } + return "" +} + +func (x *MySQLExplain_Table) GetRowsExaminedPerScan() uint64 { + if x != nil { + return x.RowsExaminedPerScan + } + return 0 +} + +func (x *MySQLExplain_Table) GetRowsProducedPerJoin() uint64 { + if x != nil { + return x.RowsProducedPerJoin + } + return 0 +} + +func (x *MySQLExplain_Table) GetFiltered() string { + if x != nil { + return x.Filtered + } + return "" +} + +func (x *MySQLExplain_Table) GetCostInfo() map[string]string { + if x != nil { + return x.CostInfo + } + return nil +} + +func (x *MySQLExplain_Table) GetUsedColumns() []string { + if x != nil { + return x.UsedColumns + } + return nil +} + +func (x *MySQLExplain_Table) GetInsert() bool { + if x != nil { + return x.Insert + } + return false +} + +func (x *MySQLExplain_Table) GetPossibleKeys() []string { + if x != nil { + return x.PossibleKeys + } + return nil +} + +func (x *MySQLExplain_Table) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *MySQLExplain_Table) GetUsedKeyParts() []string { + if x != nil { + return x.UsedKeyParts + } + return nil +} + +func (x *MySQLExplain_Table) GetKeyLength() string { + if x != nil { + return x.KeyLength + } + return "" +} + +func (x *MySQLExplain_Table) GetRef() []string { + if x != nil { + return x.Ref + } + return nil +} + +type MySQLExplain_NestedLoopObj struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Table *MySQLExplain_Table `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` +} + +func (x *MySQLExplain_NestedLoopObj) Reset() { + *x = MySQLExplain_NestedLoopObj{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQLExplain_NestedLoopObj) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQLExplain_NestedLoopObj) ProtoMessage() {} + +func (x *MySQLExplain_NestedLoopObj) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_proto_msgTypes[12] + 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 MySQLExplain_NestedLoopObj.ProtoReflect.Descriptor instead. +func (*MySQLExplain_NestedLoopObj) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{6, 2} +} + +func (x *MySQLExplain_NestedLoopObj) GetTable() *MySQLExplain_Table { + if x != nil { + return x.Table + } + return nil +} + +type MySQLExplain_OrderingOperation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UsingFilesort bool `protobuf:"varint,1,opt,name=using_filesort,json=usingFilesort,proto3" json:"using_filesort,omitempty"` + CostInfo map[string]string `protobuf:"bytes,2,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Table *MySQLExplain_Table `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"` + NestedLoop []*MySQLExplain_NestedLoopObj `protobuf:"bytes,4,rep,name=nested_loop,json=nestedLoop,proto3" json:"nested_loop,omitempty"` +} + +func (x *MySQLExplain_OrderingOperation) Reset() { + *x = MySQLExplain_OrderingOperation{} + if protoimpl.UnsafeEnabled { + mi := &file_vet_vet_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MySQLExplain_OrderingOperation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MySQLExplain_OrderingOperation) ProtoMessage() {} + +func (x *MySQLExplain_OrderingOperation) ProtoReflect() protoreflect.Message { + mi := &file_vet_vet_proto_msgTypes[13] + 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 MySQLExplain_OrderingOperation.ProtoReflect.Descriptor instead. +func (*MySQLExplain_OrderingOperation) Descriptor() ([]byte, []int) { + return file_vet_vet_proto_rawDescGZIP(), []int{6, 3} +} + +func (x *MySQLExplain_OrderingOperation) GetUsingFilesort() bool { + if x != nil { + return x.UsingFilesort + } + return false +} + +func (x *MySQLExplain_OrderingOperation) GetCostInfo() map[string]string { + if x != nil { + return x.CostInfo + } + return nil +} + +func (x *MySQLExplain_OrderingOperation) GetTable() *MySQLExplain_Table { + if x != nil { + return x.Table + } + return nil +} + +func (x *MySQLExplain_OrderingOperation) GetNestedLoop() []*MySQLExplain_NestedLoopObj { + if x != nil { + return x.NestedLoop + } + return nil +} + +var File_vet_vet_proto protoreflect.FileDescriptor + +var file_vet_vet_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x76, 0x65, 0x74, 0x2f, 0x76, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x03, 0x76, 0x65, 0x74, 0x22, 0x23, 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, 0x22, 0x6c, 0x0a, 0x06, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 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, 0x22, 0x6b, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, + 0x71, 0x6c, 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, 0x2a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x73, 0x22, 0x3e, 0x0a, 0x0a, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, + 0x51, 0x4c, 0x12, 0x30, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x52, 0x07, 0x65, 0x78, 0x70, + 0x6c, 0x61, 0x69, 0x6e, 0x22, 0x8d, 0x0f, 0x0a, 0x11, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, + 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x70, 0x6c, + 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x50, + 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, + 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x04, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x40, 0x0a, 0x08, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x76, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4c, 0x45, 0x78, + 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x3b, 0x0a, + 0x08, 0x70, 0x6c, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4c, + 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, + 0x52, 0x08, 0x50, 0x6c, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 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, 0x1a, 0x93, 0x09, 0x0a, 0x04, 0x50, 0x6c, 0x61, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x20, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, + 0x0a, 0x13, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x68, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x50, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, + 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, + 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, + 0x5f, 0x61, 0x77, 0x61, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x50, 0x61, + 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x20, 0x41, 0x77, 0x61, 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, + 0x61, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x20, 0x43, 0x61, 0x70, 0x61, 0x62, + 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x5f, 0x63, 0x6f, + 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x75, + 0x70, 0x20, 0x43, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x63, 0x6f, 0x73, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x54, 0x6f, 0x74, 0x61, + 0x6c, 0x20, 0x43, 0x6f, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x72, + 0x6f, 0x77, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x50, 0x6c, 0x61, 0x6e, 0x20, + 0x52, 0x6f, 0x77, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x77, 0x69, 0x64, + 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x50, 0x6c, 0x61, 0x6e, 0x20, 0x57, + 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x0c, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x31, 0x0a, 0x05, + 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x76, 0x65, + 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, + 0x61, 0x69, 0x6e, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x05, 0x50, 0x6c, 0x61, 0x6e, 0x73, 0x12, + 0x2c, 0x0a, 0x11, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x68, 0x69, 0x74, 0x5f, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x20, 0x48, 0x69, 0x74, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2e, 0x0a, + 0x12, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x20, 0x52, 0x65, 0x61, 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x34, 0x0a, + 0x15, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x5f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x20, 0x44, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x20, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x73, 0x12, 0x34, 0x0a, 0x15, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x77, 0x72, + 0x69, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x15, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x57, 0x72, 0x69, 0x74, 0x74, + 0x65, 0x6e, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, + 0x61, 0x6c, 0x5f, 0x68, 0x69, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x10, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x48, 0x69, 0x74, 0x20, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x72, + 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x52, 0x65, 0x61, 0x64, 0x20, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x72, + 0x74, 0x69, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x44, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, + 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x5f, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, + 0x15, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x57, 0x72, 0x69, + 0x74, 0x74, 0x65, 0x6e, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x74, + 0x65, 0x6d, 0x70, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x54, 0x65, 0x6d, 0x70, 0x20, 0x52, 0x65, 0x61, 0x64, + 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x74, 0x65, 0x6d, 0x70, 0x5f, + 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x17, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x54, 0x65, 0x6d, 0x70, 0x20, 0x57, 0x72, 0x69, 0x74, 0x74, + 0x65, 0x6e, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6f, 0x72, + 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x18, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x53, 0x6f, 0x72, + 0x74, 0x20, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x20, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x75, 0x6e, 0x69, + 0x71, 0x75, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x49, 0x6e, 0x6e, 0x65, 0x72, + 0x20, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, + 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x48, 0x61, 0x73, 0x68, + 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x63, 0x61, 0x6e, 0x5f, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x53, + 0x63, 0x61, 0x6e, 0x20, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, + 0x0a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x1a, 0xf4, 0x03, + 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x11, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x5f, 0x68, 0x69, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x48, 0x69, + 0x74, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x52, 0x65, 0x61, + 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x34, 0x0a, 0x15, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, + 0x44, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x34, + 0x0a, 0x15, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, + 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x57, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x68, 0x69, + 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x48, 0x69, 0x74, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, + 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x20, 0x52, 0x65, 0x61, 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x32, + 0x0a, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x5f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x20, 0x44, 0x69, 0x72, 0x74, 0x69, 0x65, 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x77, 0x72, 0x69, 0x74, + 0x74, 0x65, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x57, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x72, + 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x10, 0x54, 0x65, 0x6d, 0x70, 0x20, 0x52, 0x65, 0x61, 0x64, 0x20, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x74, + 0x65, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x13, 0x54, 0x65, 0x6d, 0x70, 0x20, 0x57, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x22, 0x34, 0x0a, 0x05, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x12, 0x2b, 0x0a, + 0x07, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, + 0x6e, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x22, 0xf3, 0x0a, 0x0a, 0x0c, 0x4d, + 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x12, 0x3d, 0x0a, 0x0b, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, + 0x61, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x0a, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x8e, 0x03, 0x0a, 0x0a, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6c, + 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x47, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, + 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, + 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x52, 0x0a, 0x12, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, + 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0b, + 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x6f, 0x6f, 0x70, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, + 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, + 0x62, 0x6a, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, 0x6f, 0x6f, 0x70, 0x1a, 0x3b, + 0x0a, 0x0d, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 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, 0x1a, 0x97, 0x04, 0x0a, 0x05, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x16, 0x72, 0x6f, 0x77, 0x73, 0x5f, 0x65, 0x78, + 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x61, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x72, 0x6f, 0x77, 0x73, 0x45, 0x78, 0x61, 0x6d, 0x69, + 0x6e, 0x65, 0x64, 0x50, 0x65, 0x72, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x33, 0x0a, 0x16, 0x72, 0x6f, + 0x77, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, + 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x72, 0x6f, 0x77, 0x73, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x50, 0x65, 0x72, 0x4a, 0x6f, 0x69, 0x6e, 0x12, + 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x12, 0x42, 0x0a, 0x09, 0x63, + 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, + 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x21, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x6f, + 0x73, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0c, 0x70, 0x6f, 0x73, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, + 0x72, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x64, 0x4b, + 0x65, 0x79, 0x50, 0x61, 0x72, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6b, 0x65, 0x79, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, 0x0d, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x66, 0x1a, 0x3b, 0x0a, 0x0d, 0x43, 0x6f, 0x73, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 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, 0x1a, 0x3e, 0x0a, 0x0d, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, + 0x6f, 0x6f, 0x70, 0x4f, 0x62, 0x6a, 0x12, 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, + 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x1a, 0xb8, 0x02, 0x0a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x69, + 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x75, + 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x6f, + 0x72, 0x74, 0x12, 0x4e, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, + 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x6e, + 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x2d, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x70, + 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x40, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x6f, 0x6f, 0x70, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x76, 0x65, 0x74, 0x2e, 0x4d, 0x79, 0x53, + 0x51, 0x4c, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x62, 0x6a, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4c, + 0x6f, 0x6f, 0x70, 0x1a, 0x3b, 0x0a, 0x0d, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 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, + 0x42, 0x66, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x65, 0x74, 0x42, 0x08, 0x56, 0x65, 0x74, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x65, 0x74, 0xa2, 0x02, + 0x03, 0x56, 0x58, 0x58, 0xaa, 0x02, 0x03, 0x56, 0x65, 0x74, 0xca, 0x02, 0x03, 0x56, 0x65, 0x74, + 0xe2, 0x02, 0x0f, 0x56, 0x65, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x03, 0x56, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_vet_vet_proto_rawDescOnce sync.Once + file_vet_vet_proto_rawDescData = file_vet_vet_proto_rawDesc +) + +func file_vet_vet_proto_rawDescGZIP() []byte { + file_vet_vet_proto_rawDescOnce.Do(func() { + file_vet_vet_proto_rawDescData = protoimpl.X.CompressGZIP(file_vet_vet_proto_rawDescData) + }) + return file_vet_vet_proto_rawDescData +} + +var file_vet_vet_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_vet_vet_proto_goTypes = []interface{}{ + (*Parameter)(nil), // 0: vet.Parameter + (*Config)(nil), // 1: vet.Config + (*Query)(nil), // 2: vet.Query + (*PostgreSQL)(nil), // 3: vet.PostgreSQL + (*PostgreSQLExplain)(nil), // 4: vet.PostgreSQLExplain + (*MySQL)(nil), // 5: vet.MySQL + (*MySQLExplain)(nil), // 6: vet.MySQLExplain + nil, // 7: vet.PostgreSQLExplain.SettingsEntry + (*PostgreSQLExplain_Plan)(nil), // 8: vet.PostgreSQLExplain.Plan + (*PostgreSQLExplain_Planning)(nil), // 9: vet.PostgreSQLExplain.Planning + (*MySQLExplain_QueryBlock)(nil), // 10: vet.MySQLExplain.QueryBlock + (*MySQLExplain_Table)(nil), // 11: vet.MySQLExplain.Table + (*MySQLExplain_NestedLoopObj)(nil), // 12: vet.MySQLExplain.NestedLoopObj + (*MySQLExplain_OrderingOperation)(nil), // 13: vet.MySQLExplain.OrderingOperation + nil, // 14: vet.MySQLExplain.QueryBlock.CostInfoEntry + nil, // 15: vet.MySQLExplain.Table.CostInfoEntry + nil, // 16: vet.MySQLExplain.OrderingOperation.CostInfoEntry +} +var file_vet_vet_proto_depIdxs = []int32{ + 0, // 0: vet.Query.params:type_name -> vet.Parameter + 4, // 1: vet.PostgreSQL.explain:type_name -> vet.PostgreSQLExplain + 8, // 2: vet.PostgreSQLExplain.plan:type_name -> vet.PostgreSQLExplain.Plan + 7, // 3: vet.PostgreSQLExplain.settings:type_name -> vet.PostgreSQLExplain.SettingsEntry + 9, // 4: vet.PostgreSQLExplain.planning:type_name -> vet.PostgreSQLExplain.Planning + 6, // 5: vet.MySQL.explain:type_name -> vet.MySQLExplain + 10, // 6: vet.MySQLExplain.query_block:type_name -> vet.MySQLExplain.QueryBlock + 8, // 7: vet.PostgreSQLExplain.Plan.plans:type_name -> vet.PostgreSQLExplain.Plan + 14, // 8: vet.MySQLExplain.QueryBlock.cost_info:type_name -> vet.MySQLExplain.QueryBlock.CostInfoEntry + 11, // 9: vet.MySQLExplain.QueryBlock.table:type_name -> vet.MySQLExplain.Table + 13, // 10: vet.MySQLExplain.QueryBlock.ordering_operation:type_name -> vet.MySQLExplain.OrderingOperation + 12, // 11: vet.MySQLExplain.QueryBlock.nested_loop:type_name -> vet.MySQLExplain.NestedLoopObj + 15, // 12: vet.MySQLExplain.Table.cost_info:type_name -> vet.MySQLExplain.Table.CostInfoEntry + 11, // 13: vet.MySQLExplain.NestedLoopObj.table:type_name -> vet.MySQLExplain.Table + 16, // 14: vet.MySQLExplain.OrderingOperation.cost_info:type_name -> vet.MySQLExplain.OrderingOperation.CostInfoEntry + 11, // 15: vet.MySQLExplain.OrderingOperation.table:type_name -> vet.MySQLExplain.Table + 12, // 16: vet.MySQLExplain.OrderingOperation.nested_loop:type_name -> vet.MySQLExplain.NestedLoopObj + 17, // [17:17] is the sub-list for method output_type + 17, // [17:17] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name +} + +func init() { file_vet_vet_proto_init() } +func file_vet_vet_proto_init() { + if File_vet_vet_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_vet_vet_proto_msgTypes[0].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_vet_vet_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Query); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgreSQL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgreSQLExplain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQLExplain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgreSQLExplain_Plan); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgreSQLExplain_Planning); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQLExplain_QueryBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQLExplain_Table); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQLExplain_NestedLoopObj); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vet_vet_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MySQLExplain_OrderingOperation); 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_vet_vet_proto_rawDesc, + NumEnums: 0, + NumMessages: 17, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_vet_vet_proto_goTypes, + DependencyIndexes: file_vet_vet_proto_depIdxs, + MessageInfos: file_vet_vet_proto_msgTypes, + }.Build() + File_vet_vet_proto = out.File + file_vet_vet_proto_rawDesc = nil + file_vet_vet_proto_goTypes = nil + file_vet_vet_proto_depIdxs = nil +} diff --git a/internal/vet/vet_vtproto.pb.go b/internal/vet/vet_vtproto.pb.go new file mode 100644 index 0000000000..88cf3d0302 --- /dev/null +++ b/internal/vet/vet_vtproto.pb.go @@ -0,0 +1,6886 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.4.0 +// source: vet/vet.proto + +package vet + +import ( + binary "encoding/binary" + fmt "fmt" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + math "math" + 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 *Parameter) CloneVT() *Parameter { + if m == nil { + return (*Parameter)(nil) + } + r := &Parameter{ + Number: m.Number, + } + 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 *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := &Config{ + Version: m.Version, + Engine: m.Engine, + } + 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 len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Query) CloneVT() *Query { + if m == nil { + return (*Query)(nil) + } + r := &Query{ + Sql: m.Sql, + Name: m.Name, + Cmd: m.Cmd, + } + 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 *Query) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *PostgreSQL) CloneVT() *PostgreSQL { + if m == nil { + return (*PostgreSQL)(nil) + } + r := &PostgreSQL{ + Explain: m.Explain.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PostgreSQL) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *PostgreSQLExplain_Plan) CloneVT() *PostgreSQLExplain_Plan { + if m == nil { + return (*PostgreSQLExplain_Plan)(nil) + } + r := &PostgreSQLExplain_Plan{ + NodeType: m.NodeType, + ParentRelationship: m.ParentRelationship, + RelationName: m.RelationName, + Schema: m.Schema, + Alias: m.Alias, + ParallelAware: m.ParallelAware, + AsyncCapable: m.AsyncCapable, + StartupCost: m.StartupCost, + TotalCost: m.TotalCost, + PlanRows: m.PlanRows, + PlanWidth: m.PlanWidth, + SharedHitBlocks: m.SharedHitBlocks, + SharedReadBlocks: m.SharedReadBlocks, + SharedDirtiedBlocks: m.SharedDirtiedBlocks, + SharedWrittenBlocks: m.SharedWrittenBlocks, + LocalHitBlocks: m.LocalHitBlocks, + LocalReadBlocks: m.LocalReadBlocks, + LocalDirtiedBlocks: m.LocalDirtiedBlocks, + LocalWrittenBlocks: m.LocalWrittenBlocks, + TempReadBlocks: m.TempReadBlocks, + TempWrittenBlocks: m.TempWrittenBlocks, + JoinType: m.JoinType, + InnerUnique: m.InnerUnique, + HashCond: m.HashCond, + IndexName: m.IndexName, + ScanDirection: m.ScanDirection, + IndexCond: m.IndexCond, + } + if rhs := m.Output; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.Output = tmpContainer + } + if rhs := m.Plans; rhs != nil { + tmpContainer := make([]*PostgreSQLExplain_Plan, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Plans = tmpContainer + } + if rhs := m.SortKey; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.SortKey = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PostgreSQLExplain_Plan) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *PostgreSQLExplain_Planning) CloneVT() *PostgreSQLExplain_Planning { + if m == nil { + return (*PostgreSQLExplain_Planning)(nil) + } + r := &PostgreSQLExplain_Planning{ + SharedHitBlocks: m.SharedHitBlocks, + SharedReadBlocks: m.SharedReadBlocks, + SharedDirtiedBlocks: m.SharedDirtiedBlocks, + SharedWrittenBlocks: m.SharedWrittenBlocks, + LocalHitBlocks: m.LocalHitBlocks, + LocalReadBlocks: m.LocalReadBlocks, + LocalDirtiedBlocks: m.LocalDirtiedBlocks, + LocalWrittenBlocks: m.LocalWrittenBlocks, + TempReadBlocks: m.TempReadBlocks, + TempWrittenBlocks: m.TempWrittenBlocks, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PostgreSQLExplain_Planning) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *PostgreSQLExplain) CloneVT() *PostgreSQLExplain { + if m == nil { + return (*PostgreSQLExplain)(nil) + } + r := &PostgreSQLExplain{ + Plan: m.Plan.CloneVT(), + Planning: m.Planning.CloneVT(), + } + if rhs := m.Settings; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.Settings = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PostgreSQLExplain) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQL) CloneVT() *MySQL { + if m == nil { + return (*MySQL)(nil) + } + r := &MySQL{ + Explain: m.Explain.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQL) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQLExplain_QueryBlock) CloneVT() *MySQLExplain_QueryBlock { + if m == nil { + return (*MySQLExplain_QueryBlock)(nil) + } + r := &MySQLExplain_QueryBlock{ + SelectId: m.SelectId, + Message: m.Message, + Table: m.Table.CloneVT(), + OrderingOperation: m.OrderingOperation.CloneVT(), + } + if rhs := m.CostInfo; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.CostInfo = tmpContainer + } + if rhs := m.NestedLoop; rhs != nil { + tmpContainer := make([]*MySQLExplain_NestedLoopObj, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.NestedLoop = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQLExplain_QueryBlock) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQLExplain_Table) CloneVT() *MySQLExplain_Table { + if m == nil { + return (*MySQLExplain_Table)(nil) + } + r := &MySQLExplain_Table{ + TableName: m.TableName, + AccessType: m.AccessType, + RowsExaminedPerScan: m.RowsExaminedPerScan, + RowsProducedPerJoin: m.RowsProducedPerJoin, + Filtered: m.Filtered, + Insert: m.Insert, + Key: m.Key, + KeyLength: m.KeyLength, + } + if rhs := m.CostInfo; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.CostInfo = tmpContainer + } + if rhs := m.UsedColumns; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.UsedColumns = tmpContainer + } + if rhs := m.PossibleKeys; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.PossibleKeys = tmpContainer + } + if rhs := m.UsedKeyParts; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.UsedKeyParts = tmpContainer + } + if rhs := m.Ref; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.Ref = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQLExplain_Table) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQLExplain_NestedLoopObj) CloneVT() *MySQLExplain_NestedLoopObj { + if m == nil { + return (*MySQLExplain_NestedLoopObj)(nil) + } + r := &MySQLExplain_NestedLoopObj{ + Table: m.Table.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQLExplain_NestedLoopObj) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQLExplain_OrderingOperation) CloneVT() *MySQLExplain_OrderingOperation { + if m == nil { + return (*MySQLExplain_OrderingOperation)(nil) + } + r := &MySQLExplain_OrderingOperation{ + UsingFilesort: m.UsingFilesort, + Table: m.Table.CloneVT(), + } + if rhs := m.CostInfo; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.CostInfo = tmpContainer + } + if rhs := m.NestedLoop; rhs != nil { + tmpContainer := make([]*MySQLExplain_NestedLoopObj, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.NestedLoop = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQLExplain_OrderingOperation) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *MySQLExplain) CloneVT() *MySQLExplain { + if m == nil { + return (*MySQLExplain)(nil) + } + r := &MySQLExplain{ + QueryBlock: m.QueryBlock.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *MySQLExplain) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +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 + } + 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 *Config) EqualVT(that *Config) 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 + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Config) + 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.Sql != that.Sql { + return false + } + if this.Name != that.Name { + return false + } + if this.Cmd != that.Cmd { + 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 *Query) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Query) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PostgreSQL) EqualVT(that *PostgreSQL) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Explain.EqualVT(that.Explain) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *PostgreSQL) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*PostgreSQL) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PostgreSQLExplain_Plan) EqualVT(that *PostgreSQLExplain_Plan) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.NodeType != that.NodeType { + return false + } + if this.ParentRelationship != that.ParentRelationship { + return false + } + if this.RelationName != that.RelationName { + return false + } + if this.Schema != that.Schema { + return false + } + if this.Alias != that.Alias { + return false + } + if this.ParallelAware != that.ParallelAware { + return false + } + if this.AsyncCapable != that.AsyncCapable { + return false + } + if this.StartupCost != that.StartupCost { + return false + } + if this.TotalCost != that.TotalCost { + return false + } + if this.PlanRows != that.PlanRows { + return false + } + if this.PlanWidth != that.PlanWidth { + return false + } + if len(this.Output) != len(that.Output) { + return false + } + for i, vx := range this.Output { + vy := that.Output[i] + if vx != vy { + return false + } + } + if len(this.Plans) != len(that.Plans) { + return false + } + for i, vx := range this.Plans { + vy := that.Plans[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &PostgreSQLExplain_Plan{} + } + if q == nil { + q = &PostgreSQLExplain_Plan{} + } + if !p.EqualVT(q) { + return false + } + } + } + if this.SharedHitBlocks != that.SharedHitBlocks { + return false + } + if this.SharedReadBlocks != that.SharedReadBlocks { + return false + } + if this.SharedDirtiedBlocks != that.SharedDirtiedBlocks { + return false + } + if this.SharedWrittenBlocks != that.SharedWrittenBlocks { + return false + } + if this.LocalHitBlocks != that.LocalHitBlocks { + return false + } + if this.LocalReadBlocks != that.LocalReadBlocks { + return false + } + if this.LocalDirtiedBlocks != that.LocalDirtiedBlocks { + return false + } + if this.LocalWrittenBlocks != that.LocalWrittenBlocks { + return false + } + if this.TempReadBlocks != that.TempReadBlocks { + return false + } + if this.TempWrittenBlocks != that.TempWrittenBlocks { + return false + } + if len(this.SortKey) != len(that.SortKey) { + return false + } + for i, vx := range this.SortKey { + vy := that.SortKey[i] + if vx != vy { + return false + } + } + if this.JoinType != that.JoinType { + return false + } + if this.InnerUnique != that.InnerUnique { + return false + } + if this.HashCond != that.HashCond { + return false + } + if this.IndexName != that.IndexName { + return false + } + if this.ScanDirection != that.ScanDirection { + return false + } + if this.IndexCond != that.IndexCond { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *PostgreSQLExplain_Plan) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*PostgreSQLExplain_Plan) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PostgreSQLExplain_Planning) EqualVT(that *PostgreSQLExplain_Planning) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.SharedHitBlocks != that.SharedHitBlocks { + return false + } + if this.SharedReadBlocks != that.SharedReadBlocks { + return false + } + if this.SharedDirtiedBlocks != that.SharedDirtiedBlocks { + return false + } + if this.SharedWrittenBlocks != that.SharedWrittenBlocks { + return false + } + if this.LocalHitBlocks != that.LocalHitBlocks { + return false + } + if this.LocalReadBlocks != that.LocalReadBlocks { + return false + } + if this.LocalDirtiedBlocks != that.LocalDirtiedBlocks { + return false + } + if this.LocalWrittenBlocks != that.LocalWrittenBlocks { + return false + } + if this.TempReadBlocks != that.TempReadBlocks { + return false + } + if this.TempWrittenBlocks != that.TempWrittenBlocks { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *PostgreSQLExplain_Planning) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*PostgreSQLExplain_Planning) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PostgreSQLExplain) EqualVT(that *PostgreSQLExplain) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Plan.EqualVT(that.Plan) { + return false + } + if len(this.Settings) != len(that.Settings) { + return false + } + for i, vx := range this.Settings { + vy, ok := that.Settings[i] + if !ok { + return false + } + if vx != vy { + return false + } + } + if !this.Planning.EqualVT(that.Planning) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *PostgreSQLExplain) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*PostgreSQLExplain) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQL) EqualVT(that *MySQL) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Explain.EqualVT(that.Explain) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQL) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQL) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQLExplain_QueryBlock) EqualVT(that *MySQLExplain_QueryBlock) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.SelectId != that.SelectId { + return false + } + if this.Message != that.Message { + return false + } + if len(this.CostInfo) != len(that.CostInfo) { + return false + } + for i, vx := range this.CostInfo { + vy, ok := that.CostInfo[i] + if !ok { + return false + } + if vx != vy { + return false + } + } + if !this.Table.EqualVT(that.Table) { + return false + } + if !this.OrderingOperation.EqualVT(that.OrderingOperation) { + return false + } + if len(this.NestedLoop) != len(that.NestedLoop) { + return false + } + for i, vx := range this.NestedLoop { + vy := that.NestedLoop[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &MySQLExplain_NestedLoopObj{} + } + if q == nil { + q = &MySQLExplain_NestedLoopObj{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQLExplain_QueryBlock) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQLExplain_QueryBlock) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQLExplain_Table) EqualVT(that *MySQLExplain_Table) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.TableName != that.TableName { + return false + } + if this.AccessType != that.AccessType { + return false + } + if this.RowsExaminedPerScan != that.RowsExaminedPerScan { + return false + } + if this.RowsProducedPerJoin != that.RowsProducedPerJoin { + return false + } + if this.Filtered != that.Filtered { + return false + } + if len(this.CostInfo) != len(that.CostInfo) { + return false + } + for i, vx := range this.CostInfo { + vy, ok := that.CostInfo[i] + if !ok { + return false + } + if vx != vy { + return false + } + } + if len(this.UsedColumns) != len(that.UsedColumns) { + return false + } + for i, vx := range this.UsedColumns { + vy := that.UsedColumns[i] + if vx != vy { + return false + } + } + if this.Insert != that.Insert { + return false + } + if len(this.PossibleKeys) != len(that.PossibleKeys) { + return false + } + for i, vx := range this.PossibleKeys { + vy := that.PossibleKeys[i] + if vx != vy { + return false + } + } + if this.Key != that.Key { + return false + } + if len(this.UsedKeyParts) != len(that.UsedKeyParts) { + return false + } + for i, vx := range this.UsedKeyParts { + vy := that.UsedKeyParts[i] + if vx != vy { + return false + } + } + if this.KeyLength != that.KeyLength { + return false + } + if len(this.Ref) != len(that.Ref) { + return false + } + for i, vx := range this.Ref { + vy := that.Ref[i] + if vx != vy { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQLExplain_Table) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQLExplain_Table) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQLExplain_NestedLoopObj) EqualVT(that *MySQLExplain_NestedLoopObj) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Table.EqualVT(that.Table) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQLExplain_NestedLoopObj) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQLExplain_NestedLoopObj) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQLExplain_OrderingOperation) EqualVT(that *MySQLExplain_OrderingOperation) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.UsingFilesort != that.UsingFilesort { + return false + } + if len(this.CostInfo) != len(that.CostInfo) { + return false + } + for i, vx := range this.CostInfo { + vy, ok := that.CostInfo[i] + if !ok { + return false + } + if vx != vy { + return false + } + } + if !this.Table.EqualVT(that.Table) { + return false + } + if len(this.NestedLoop) != len(that.NestedLoop) { + return false + } + for i, vx := range this.NestedLoop { + vy := that.NestedLoop[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &MySQLExplain_NestedLoopObj{} + } + if q == nil { + q = &MySQLExplain_NestedLoopObj{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQLExplain_OrderingOperation) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQLExplain_OrderingOperation) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *MySQLExplain) EqualVT(that *MySQLExplain) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.QueryBlock.EqualVT(that.QueryBlock) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *MySQLExplain) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*MySQLExplain) + if !ok { + return false + } + return this.EqualVT(that) +} +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.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Config) 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 *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) 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.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 *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 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] = 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.Sql) > 0 { + i -= len(m.Sql) + copy(dAtA[i:], m.Sql) + i = encodeVarint(dAtA, i, uint64(len(m.Sql))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQL) 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 *PostgreSQL) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PostgreSQL) 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.Explain != nil { + size, err := m.Explain.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 *PostgreSQLExplain_Plan) 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 *PostgreSQLExplain_Plan) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PostgreSQLExplain_Plan) 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.IndexCond) > 0 { + i -= len(m.IndexCond) + copy(dAtA[i:], m.IndexCond) + i = encodeVarint(dAtA, i, uint64(len(m.IndexCond))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xf2 + } + if len(m.ScanDirection) > 0 { + i -= len(m.ScanDirection) + copy(dAtA[i:], m.ScanDirection) + i = encodeVarint(dAtA, i, uint64(len(m.ScanDirection))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xea + } + if len(m.IndexName) > 0 { + i -= len(m.IndexName) + copy(dAtA[i:], m.IndexName) + i = encodeVarint(dAtA, i, uint64(len(m.IndexName))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xe2 + } + if len(m.HashCond) > 0 { + i -= len(m.HashCond) + copy(dAtA[i:], m.HashCond) + i = encodeVarint(dAtA, i, uint64(len(m.HashCond))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xda + } + if m.InnerUnique { + i-- + if m.InnerUnique { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xd0 + } + if len(m.JoinType) > 0 { + i -= len(m.JoinType) + copy(dAtA[i:], m.JoinType) + i = encodeVarint(dAtA, i, uint64(len(m.JoinType))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xca + } + if len(m.SortKey) > 0 { + for iNdEx := len(m.SortKey) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SortKey[iNdEx]) + copy(dAtA[i:], m.SortKey[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.SortKey[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 + } + } + if m.TempWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb8 + } + if m.TempReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempReadBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb0 + } + if m.LocalWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa8 + } + if m.LocalDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalDirtiedBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa0 + } + if m.LocalReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalReadBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x98 + } + if m.LocalHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalHitBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x90 + } + if m.SharedWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.SharedDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedDirtiedBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.SharedReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedReadBlocks)) + i-- + dAtA[i] = 0x78 + } + if m.SharedHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedHitBlocks)) + i-- + dAtA[i] = 0x70 + } + if len(m.Plans) > 0 { + for iNdEx := len(m.Plans) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Plans[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + } + if len(m.Output) > 0 { + for iNdEx := len(m.Output) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Output[iNdEx]) + copy(dAtA[i:], m.Output[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Output[iNdEx]))) + i-- + dAtA[i] = 0x62 + } + } + if m.PlanWidth != 0 { + i = encodeVarint(dAtA, i, uint64(m.PlanWidth)) + i-- + dAtA[i] = 0x58 + } + if m.PlanRows != 0 { + i = encodeVarint(dAtA, i, uint64(m.PlanRows)) + i-- + dAtA[i] = 0x50 + } + if m.TotalCost != 0 { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.TotalCost)))) + i-- + dAtA[i] = 0x4d + } + if m.StartupCost != 0 { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.StartupCost)))) + i-- + dAtA[i] = 0x45 + } + if m.AsyncCapable { + i-- + if m.AsyncCapable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.ParallelAware { + i-- + if m.ParallelAware { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.Alias) > 0 { + i -= len(m.Alias) + copy(dAtA[i:], m.Alias) + i = encodeVarint(dAtA, i, uint64(len(m.Alias))) + i-- + dAtA[i] = 0x2a + } + 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] = 0x22 + } + if len(m.RelationName) > 0 { + i -= len(m.RelationName) + copy(dAtA[i:], m.RelationName) + i = encodeVarint(dAtA, i, uint64(len(m.RelationName))) + i-- + dAtA[i] = 0x1a + } + if len(m.ParentRelationship) > 0 { + i -= len(m.ParentRelationship) + copy(dAtA[i:], m.ParentRelationship) + i = encodeVarint(dAtA, i, uint64(len(m.ParentRelationship))) + i-- + dAtA[i] = 0x12 + } + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarint(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQLExplain_Planning) 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 *PostgreSQLExplain_Planning) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PostgreSQLExplain_Planning) 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.TempWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempWrittenBlocks)) + i-- + dAtA[i] = 0x50 + } + if m.TempReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempReadBlocks)) + i-- + dAtA[i] = 0x48 + } + if m.LocalWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalWrittenBlocks)) + i-- + dAtA[i] = 0x40 + } + if m.LocalDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalDirtiedBlocks)) + i-- + dAtA[i] = 0x38 + } + if m.LocalReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalReadBlocks)) + i-- + dAtA[i] = 0x30 + } + if m.LocalHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalHitBlocks)) + i-- + dAtA[i] = 0x28 + } + if m.SharedWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedWrittenBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.SharedDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedDirtiedBlocks)) + i-- + dAtA[i] = 0x18 + } + if m.SharedReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedReadBlocks)) + i-- + dAtA[i] = 0x10 + } + if m.SharedHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedHitBlocks)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQLExplain) 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 *PostgreSQLExplain) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PostgreSQLExplain) 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.Planning != nil { + size, err := m.Planning.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Settings) > 0 { + for k := range m.Settings { + v := m.Settings[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] = 0x12 + } + } + if m.Plan != nil { + size, err := m.Plan.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 *MySQL) 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 *MySQL) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQL) 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.Explain != nil { + size, err := m.Explain.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 *MySQLExplain_QueryBlock) 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 *MySQLExplain_QueryBlock) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQLExplain_QueryBlock) 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.NestedLoop) > 0 { + for iNdEx := len(m.NestedLoop) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.NestedLoop[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + } + if m.OrderingOperation != nil { + size, err := m.OrderingOperation.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + 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] = 0x22 + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x1a + } + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarint(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + } + if m.SelectId != 0 { + i = encodeVarint(dAtA, i, uint64(m.SelectId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_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 *MySQLExplain_Table) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQLExplain_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.Ref) > 0 { + for iNdEx := len(m.Ref) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ref[iNdEx]) + copy(dAtA[i:], m.Ref[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Ref[iNdEx]))) + i-- + dAtA[i] = 0x6a + } + } + if len(m.KeyLength) > 0 { + i -= len(m.KeyLength) + copy(dAtA[i:], m.KeyLength) + i = encodeVarint(dAtA, i, uint64(len(m.KeyLength))) + i-- + dAtA[i] = 0x62 + } + if len(m.UsedKeyParts) > 0 { + for iNdEx := len(m.UsedKeyParts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UsedKeyParts[iNdEx]) + copy(dAtA[i:], m.UsedKeyParts[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.UsedKeyParts[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x52 + } + if len(m.PossibleKeys) > 0 { + for iNdEx := len(m.PossibleKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PossibleKeys[iNdEx]) + copy(dAtA[i:], m.PossibleKeys[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.PossibleKeys[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if m.Insert { + i-- + if m.Insert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if len(m.UsedColumns) > 0 { + for iNdEx := len(m.UsedColumns) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UsedColumns[iNdEx]) + copy(dAtA[i:], m.UsedColumns[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.UsedColumns[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x32 + } + } + if len(m.Filtered) > 0 { + i -= len(m.Filtered) + copy(dAtA[i:], m.Filtered) + i = encodeVarint(dAtA, i, uint64(len(m.Filtered))) + i-- + dAtA[i] = 0x2a + } + if m.RowsProducedPerJoin != 0 { + i = encodeVarint(dAtA, i, uint64(m.RowsProducedPerJoin)) + i-- + dAtA[i] = 0x20 + } + if m.RowsExaminedPerScan != 0 { + i = encodeVarint(dAtA, i, uint64(m.RowsExaminedPerScan)) + i-- + dAtA[i] = 0x18 + } + if len(m.AccessType) > 0 { + i -= len(m.AccessType) + copy(dAtA[i:], m.AccessType) + i = encodeVarint(dAtA, i, uint64(len(m.AccessType))) + i-- + dAtA[i] = 0x12 + } + if len(m.TableName) > 0 { + i -= len(m.TableName) + copy(dAtA[i:], m.TableName) + i = encodeVarint(dAtA, i, uint64(len(m.TableName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_NestedLoopObj) 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 *MySQLExplain_NestedLoopObj) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQLExplain_NestedLoopObj) 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.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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_OrderingOperation) 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 *MySQLExplain_OrderingOperation) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQLExplain_OrderingOperation) 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.NestedLoop) > 0 { + for iNdEx := len(m.NestedLoop) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.NestedLoop[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + } + 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] = 0x1a + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x12 + } + } + if m.UsingFilesort { + i-- + if m.UsingFilesort { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain) 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 *MySQLExplain) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *MySQLExplain) 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.QueryBlock != nil { + size, err := m.QueryBlock.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 *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.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Config) 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 *Config) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Config) 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.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 *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 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] = 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.Sql) > 0 { + i -= len(m.Sql) + copy(dAtA[i:], m.Sql) + i = encodeVarint(dAtA, i, uint64(len(m.Sql))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQL) 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 *PostgreSQL) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *PostgreSQL) 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.Explain != nil { + size, err := m.Explain.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 *PostgreSQLExplain_Plan) 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 *PostgreSQLExplain_Plan) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *PostgreSQLExplain_Plan) 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.IndexCond) > 0 { + i -= len(m.IndexCond) + copy(dAtA[i:], m.IndexCond) + i = encodeVarint(dAtA, i, uint64(len(m.IndexCond))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xf2 + } + if len(m.ScanDirection) > 0 { + i -= len(m.ScanDirection) + copy(dAtA[i:], m.ScanDirection) + i = encodeVarint(dAtA, i, uint64(len(m.ScanDirection))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xea + } + if len(m.IndexName) > 0 { + i -= len(m.IndexName) + copy(dAtA[i:], m.IndexName) + i = encodeVarint(dAtA, i, uint64(len(m.IndexName))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xe2 + } + if len(m.HashCond) > 0 { + i -= len(m.HashCond) + copy(dAtA[i:], m.HashCond) + i = encodeVarint(dAtA, i, uint64(len(m.HashCond))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xda + } + if m.InnerUnique { + i-- + if m.InnerUnique { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xd0 + } + if len(m.JoinType) > 0 { + i -= len(m.JoinType) + copy(dAtA[i:], m.JoinType) + i = encodeVarint(dAtA, i, uint64(len(m.JoinType))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xca + } + if len(m.SortKey) > 0 { + for iNdEx := len(m.SortKey) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SortKey[iNdEx]) + copy(dAtA[i:], m.SortKey[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.SortKey[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 + } + } + if m.TempWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb8 + } + if m.TempReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempReadBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb0 + } + if m.LocalWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa8 + } + if m.LocalDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalDirtiedBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa0 + } + if m.LocalReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalReadBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x98 + } + if m.LocalHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalHitBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x90 + } + if m.SharedWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedWrittenBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.SharedDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedDirtiedBlocks)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.SharedReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedReadBlocks)) + i-- + dAtA[i] = 0x78 + } + if m.SharedHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedHitBlocks)) + i-- + dAtA[i] = 0x70 + } + if len(m.Plans) > 0 { + for iNdEx := len(m.Plans) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Plans[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + } + if len(m.Output) > 0 { + for iNdEx := len(m.Output) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Output[iNdEx]) + copy(dAtA[i:], m.Output[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Output[iNdEx]))) + i-- + dAtA[i] = 0x62 + } + } + if m.PlanWidth != 0 { + i = encodeVarint(dAtA, i, uint64(m.PlanWidth)) + i-- + dAtA[i] = 0x58 + } + if m.PlanRows != 0 { + i = encodeVarint(dAtA, i, uint64(m.PlanRows)) + i-- + dAtA[i] = 0x50 + } + if m.TotalCost != 0 { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.TotalCost)))) + i-- + dAtA[i] = 0x4d + } + if m.StartupCost != 0 { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.StartupCost)))) + i-- + dAtA[i] = 0x45 + } + if m.AsyncCapable { + i-- + if m.AsyncCapable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.ParallelAware { + i-- + if m.ParallelAware { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.Alias) > 0 { + i -= len(m.Alias) + copy(dAtA[i:], m.Alias) + i = encodeVarint(dAtA, i, uint64(len(m.Alias))) + i-- + dAtA[i] = 0x2a + } + 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] = 0x22 + } + if len(m.RelationName) > 0 { + i -= len(m.RelationName) + copy(dAtA[i:], m.RelationName) + i = encodeVarint(dAtA, i, uint64(len(m.RelationName))) + i-- + dAtA[i] = 0x1a + } + if len(m.ParentRelationship) > 0 { + i -= len(m.ParentRelationship) + copy(dAtA[i:], m.ParentRelationship) + i = encodeVarint(dAtA, i, uint64(len(m.ParentRelationship))) + i-- + dAtA[i] = 0x12 + } + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarint(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQLExplain_Planning) 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 *PostgreSQLExplain_Planning) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *PostgreSQLExplain_Planning) 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.TempWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempWrittenBlocks)) + i-- + dAtA[i] = 0x50 + } + if m.TempReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.TempReadBlocks)) + i-- + dAtA[i] = 0x48 + } + if m.LocalWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalWrittenBlocks)) + i-- + dAtA[i] = 0x40 + } + if m.LocalDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalDirtiedBlocks)) + i-- + dAtA[i] = 0x38 + } + if m.LocalReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalReadBlocks)) + i-- + dAtA[i] = 0x30 + } + if m.LocalHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.LocalHitBlocks)) + i-- + dAtA[i] = 0x28 + } + if m.SharedWrittenBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedWrittenBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.SharedDirtiedBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedDirtiedBlocks)) + i-- + dAtA[i] = 0x18 + } + if m.SharedReadBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedReadBlocks)) + i-- + dAtA[i] = 0x10 + } + if m.SharedHitBlocks != 0 { + i = encodeVarint(dAtA, i, uint64(m.SharedHitBlocks)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PostgreSQLExplain) 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 *PostgreSQLExplain) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *PostgreSQLExplain) 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.Planning != nil { + size, err := m.Planning.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Settings) > 0 { + for k := range m.Settings { + v := m.Settings[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] = 0x12 + } + } + if m.Plan != nil { + size, err := m.Plan.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 *MySQL) 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 *MySQL) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQL) 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.Explain != nil { + size, err := m.Explain.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 *MySQLExplain_QueryBlock) 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 *MySQLExplain_QueryBlock) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQLExplain_QueryBlock) 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.NestedLoop) > 0 { + for iNdEx := len(m.NestedLoop) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.NestedLoop[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + } + if m.OrderingOperation != nil { + size, err := m.OrderingOperation.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + 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] = 0x22 + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x1a + } + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarint(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + } + if m.SelectId != 0 { + i = encodeVarint(dAtA, i, uint64(m.SelectId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_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 *MySQLExplain_Table) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQLExplain_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.Ref) > 0 { + for iNdEx := len(m.Ref) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ref[iNdEx]) + copy(dAtA[i:], m.Ref[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Ref[iNdEx]))) + i-- + dAtA[i] = 0x6a + } + } + if len(m.KeyLength) > 0 { + i -= len(m.KeyLength) + copy(dAtA[i:], m.KeyLength) + i = encodeVarint(dAtA, i, uint64(len(m.KeyLength))) + i-- + dAtA[i] = 0x62 + } + if len(m.UsedKeyParts) > 0 { + for iNdEx := len(m.UsedKeyParts) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UsedKeyParts[iNdEx]) + copy(dAtA[i:], m.UsedKeyParts[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.UsedKeyParts[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x52 + } + if len(m.PossibleKeys) > 0 { + for iNdEx := len(m.PossibleKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PossibleKeys[iNdEx]) + copy(dAtA[i:], m.PossibleKeys[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.PossibleKeys[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if m.Insert { + i-- + if m.Insert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if len(m.UsedColumns) > 0 { + for iNdEx := len(m.UsedColumns) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UsedColumns[iNdEx]) + copy(dAtA[i:], m.UsedColumns[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.UsedColumns[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x32 + } + } + if len(m.Filtered) > 0 { + i -= len(m.Filtered) + copy(dAtA[i:], m.Filtered) + i = encodeVarint(dAtA, i, uint64(len(m.Filtered))) + i-- + dAtA[i] = 0x2a + } + if m.RowsProducedPerJoin != 0 { + i = encodeVarint(dAtA, i, uint64(m.RowsProducedPerJoin)) + i-- + dAtA[i] = 0x20 + } + if m.RowsExaminedPerScan != 0 { + i = encodeVarint(dAtA, i, uint64(m.RowsExaminedPerScan)) + i-- + dAtA[i] = 0x18 + } + if len(m.AccessType) > 0 { + i -= len(m.AccessType) + copy(dAtA[i:], m.AccessType) + i = encodeVarint(dAtA, i, uint64(len(m.AccessType))) + i-- + dAtA[i] = 0x12 + } + if len(m.TableName) > 0 { + i -= len(m.TableName) + copy(dAtA[i:], m.TableName) + i = encodeVarint(dAtA, i, uint64(len(m.TableName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_NestedLoopObj) 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 *MySQLExplain_NestedLoopObj) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQLExplain_NestedLoopObj) 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.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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain_OrderingOperation) 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 *MySQLExplain_OrderingOperation) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQLExplain_OrderingOperation) 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.NestedLoop) > 0 { + for iNdEx := len(m.NestedLoop) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.NestedLoop[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + } + 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] = 0x1a + } + if len(m.CostInfo) > 0 { + for k := range m.CostInfo { + v := m.CostInfo[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] = 0x12 + } + } + if m.UsingFilesort { + i-- + if m.UsingFilesort { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MySQLExplain) 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 *MySQLExplain) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *MySQLExplain) 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.QueryBlock != nil { + size, err := m.QueryBlock.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 *Parameter) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Number != 0 { + n += 1 + sov(uint64(m.Number)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) 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)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Query) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sql) + 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.Params) > 0 { + for _, e := range m.Params { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *PostgreSQL) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Explain != nil { + l = m.Explain.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *PostgreSQLExplain_Plan) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.ParentRelationship) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.RelationName) + 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.Alias) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.ParallelAware { + n += 2 + } + if m.AsyncCapable { + n += 2 + } + if m.StartupCost != 0 { + n += 5 + } + if m.TotalCost != 0 { + n += 5 + } + if m.PlanRows != 0 { + n += 1 + sov(uint64(m.PlanRows)) + } + if m.PlanWidth != 0 { + n += 1 + sov(uint64(m.PlanWidth)) + } + if len(m.Output) > 0 { + for _, s := range m.Output { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + if len(m.Plans) > 0 { + for _, e := range m.Plans { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + if m.SharedHitBlocks != 0 { + n += 1 + sov(uint64(m.SharedHitBlocks)) + } + if m.SharedReadBlocks != 0 { + n += 1 + sov(uint64(m.SharedReadBlocks)) + } + if m.SharedDirtiedBlocks != 0 { + n += 2 + sov(uint64(m.SharedDirtiedBlocks)) + } + if m.SharedWrittenBlocks != 0 { + n += 2 + sov(uint64(m.SharedWrittenBlocks)) + } + if m.LocalHitBlocks != 0 { + n += 2 + sov(uint64(m.LocalHitBlocks)) + } + if m.LocalReadBlocks != 0 { + n += 2 + sov(uint64(m.LocalReadBlocks)) + } + if m.LocalDirtiedBlocks != 0 { + n += 2 + sov(uint64(m.LocalDirtiedBlocks)) + } + if m.LocalWrittenBlocks != 0 { + n += 2 + sov(uint64(m.LocalWrittenBlocks)) + } + if m.TempReadBlocks != 0 { + n += 2 + sov(uint64(m.TempReadBlocks)) + } + if m.TempWrittenBlocks != 0 { + n += 2 + sov(uint64(m.TempWrittenBlocks)) + } + if len(m.SortKey) > 0 { + for _, s := range m.SortKey { + l = len(s) + n += 2 + l + sov(uint64(l)) + } + } + l = len(m.JoinType) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } + if m.InnerUnique { + n += 3 + } + l = len(m.HashCond) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } + l = len(m.IndexName) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } + l = len(m.ScanDirection) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } + l = len(m.IndexCond) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *PostgreSQLExplain_Planning) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SharedHitBlocks != 0 { + n += 1 + sov(uint64(m.SharedHitBlocks)) + } + if m.SharedReadBlocks != 0 { + n += 1 + sov(uint64(m.SharedReadBlocks)) + } + if m.SharedDirtiedBlocks != 0 { + n += 1 + sov(uint64(m.SharedDirtiedBlocks)) + } + if m.SharedWrittenBlocks != 0 { + n += 1 + sov(uint64(m.SharedWrittenBlocks)) + } + if m.LocalHitBlocks != 0 { + n += 1 + sov(uint64(m.LocalHitBlocks)) + } + if m.LocalReadBlocks != 0 { + n += 1 + sov(uint64(m.LocalReadBlocks)) + } + if m.LocalDirtiedBlocks != 0 { + n += 1 + sov(uint64(m.LocalDirtiedBlocks)) + } + if m.LocalWrittenBlocks != 0 { + n += 1 + sov(uint64(m.LocalWrittenBlocks)) + } + if m.TempReadBlocks != 0 { + n += 1 + sov(uint64(m.TempReadBlocks)) + } + if m.TempWrittenBlocks != 0 { + n += 1 + sov(uint64(m.TempWrittenBlocks)) + } + n += len(m.unknownFields) + return n +} + +func (m *PostgreSQLExplain) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Plan != nil { + l = m.Plan.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if len(m.Settings) > 0 { + for k, v := range m.Settings { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } + } + if m.Planning != nil { + l = m.Planning.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *MySQL) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Explain != nil { + l = m.Explain.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *MySQLExplain_QueryBlock) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SelectId != 0 { + n += 1 + sov(uint64(m.SelectId)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if len(m.CostInfo) > 0 { + for k, v := range m.CostInfo { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } + } + if m.Table != nil { + l = m.Table.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if m.OrderingOperation != nil { + l = m.OrderingOperation.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if len(m.NestedLoop) > 0 { + for _, e := range m.NestedLoop { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *MySQLExplain_Table) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TableName) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.AccessType) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.RowsExaminedPerScan != 0 { + n += 1 + sov(uint64(m.RowsExaminedPerScan)) + } + if m.RowsProducedPerJoin != 0 { + n += 1 + sov(uint64(m.RowsProducedPerJoin)) + } + l = len(m.Filtered) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if len(m.CostInfo) > 0 { + for k, v := range m.CostInfo { + _ = 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.UsedColumns) > 0 { + for _, s := range m.UsedColumns { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + if m.Insert { + n += 2 + } + if len(m.PossibleKeys) > 0 { + for _, s := range m.PossibleKeys { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if len(m.UsedKeyParts) > 0 { + for _, s := range m.UsedKeyParts { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + l = len(m.KeyLength) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if len(m.Ref) > 0 { + for _, s := range m.Ref { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *MySQLExplain_NestedLoopObj) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Table != nil { + l = m.Table.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *MySQLExplain_OrderingOperation) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UsingFilesort { + n += 2 + } + if len(m.CostInfo) > 0 { + for k, v := range m.CostInfo { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } + } + if m.Table != nil { + l = m.Table.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if len(m.NestedLoop) > 0 { + for _, e := range m.NestedLoop { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *MySQLExplain) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.QueryBlock != nil { + l = m.QueryBlock.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 *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 + } + } + 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 *Config) 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: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Config: 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 + 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 Sql", 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.Sql = 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 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 (m *PostgreSQL) 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: PostgreSQL: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PostgreSQL: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Explain", 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.Explain == nil { + m.Explain = &PostgreSQLExplain{} + } + if err := m.Explain.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 *PostgreSQLExplain_Plan) 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: PostgreSQLExplain_Plan: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PostgreSQLExplain_Plan: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", 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.NodeType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentRelationship", 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.ParentRelationship = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelationName", 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.RelationName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alias", 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.Alias = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParallelAware", 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.ParallelAware = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AsyncCapable", 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.AsyncCapable = bool(v != 0) + case 8: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field StartupCost", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.StartupCost = float32(math.Float32frombits(v)) + case 9: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalCost", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.TotalCost = float32(math.Float32frombits(v)) + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PlanRows", wireType) + } + m.PlanRows = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PlanRows |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PlanWidth", wireType) + } + m.PlanWidth = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PlanWidth |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", 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.Output = append(m.Output, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Plans", 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.Plans = append(m.Plans, &PostgreSQLExplain_Plan{}) + if err := m.Plans[len(m.Plans)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedHitBlocks", wireType) + } + m.SharedHitBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedHitBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedReadBlocks", wireType) + } + m.SharedReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedDirtiedBlocks", wireType) + } + m.SharedDirtiedBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedDirtiedBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedWrittenBlocks", wireType) + } + m.SharedWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedWrittenBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalHitBlocks", wireType) + } + m.LocalHitBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalHitBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 19: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalReadBlocks", wireType) + } + m.LocalReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalDirtiedBlocks", wireType) + } + m.LocalDirtiedBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalDirtiedBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalWrittenBlocks", wireType) + } + m.LocalWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalWrittenBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 22: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TempReadBlocks", wireType) + } + m.TempReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TempReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 23: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TempWrittenBlocks", wireType) + } + m.TempWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TempWrittenBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SortKey", 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.SortKey = append(m.SortKey, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JoinType", 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.JoinType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 26: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InnerUnique", 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.InnerUnique = bool(v != 0) + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashCond", 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.HashCond = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 28: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", 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.IndexName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 29: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScanDirection", 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.ScanDirection = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 30: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexCond", 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.IndexCond = 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 *PostgreSQLExplain_Planning) 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: PostgreSQLExplain_Planning: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PostgreSQLExplain_Planning: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedHitBlocks", wireType) + } + m.SharedHitBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedHitBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedReadBlocks", wireType) + } + m.SharedReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedDirtiedBlocks", wireType) + } + m.SharedDirtiedBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedDirtiedBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SharedWrittenBlocks", wireType) + } + m.SharedWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SharedWrittenBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalHitBlocks", wireType) + } + m.LocalHitBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalHitBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalReadBlocks", wireType) + } + m.LocalReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalDirtiedBlocks", wireType) + } + m.LocalDirtiedBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalDirtiedBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LocalWrittenBlocks", wireType) + } + m.LocalWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LocalWrittenBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TempReadBlocks", wireType) + } + m.TempReadBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TempReadBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TempWrittenBlocks", wireType) + } + m.TempWrittenBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TempWrittenBlocks |= uint64(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 *PostgreSQLExplain) 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: PostgreSQLExplain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PostgreSQLExplain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Plan", 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.Plan == nil { + m.Plan = &PostgreSQLExplain_Plan{} + } + if err := m.Plan.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 = 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.Settings[mapkey] = mapvalue + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Planning", 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.Planning == nil { + m.Planning = &PostgreSQLExplain_Planning{} + } + if err := m.Planning.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 *MySQL) 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: MySQL: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQL: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Explain", 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.Explain == nil { + m.Explain = &MySQLExplain{} + } + if err := m.Explain.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 *MySQLExplain_QueryBlock) 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: MySQLExplain_QueryBlock: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQLExplain_QueryBlock: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SelectId", wireType) + } + m.SelectId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SelectId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", 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.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CostInfo", 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.CostInfo == nil { + m.CostInfo = 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.CostInfo[mapkey] = mapvalue + iNdEx = postIndex + case 4: + 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 = &MySQLExplain_Table{} + } + if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderingOperation", 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.OrderingOperation == nil { + m.OrderingOperation = &MySQLExplain_OrderingOperation{} + } + if err := m.OrderingOperation.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NestedLoop", 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.NestedLoop = append(m.NestedLoop, &MySQLExplain_NestedLoopObj{}) + if err := m.NestedLoop[len(m.NestedLoop)-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 *MySQLExplain_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: MySQLExplain_Table: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQLExplain_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 TableName", 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.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessType", 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.AccessType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowsExaminedPerScan", wireType) + } + m.RowsExaminedPerScan = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowsExaminedPerScan |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowsProducedPerJoin", wireType) + } + m.RowsProducedPerJoin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowsProducedPerJoin |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filtered", 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.Filtered = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CostInfo", 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.CostInfo == nil { + m.CostInfo = 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.CostInfo[mapkey] = mapvalue + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UsedColumns", 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.UsedColumns = append(m.UsedColumns, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Insert", 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.Insert = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PossibleKeys", 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.PossibleKeys = append(m.PossibleKeys, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", 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.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UsedKeyParts", 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.UsedKeyParts = append(m.UsedKeyParts, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyLength", 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.KeyLength = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", 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.Ref = append(m.Ref, 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 *MySQLExplain_NestedLoopObj) 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: MySQLExplain_NestedLoopObj: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQLExplain_NestedLoopObj: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 = &MySQLExplain_Table{} + } + if err := m.Table.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 *MySQLExplain_OrderingOperation) 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: MySQLExplain_OrderingOperation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQLExplain_OrderingOperation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UsingFilesort", 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.UsingFilesort = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CostInfo", 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.CostInfo == nil { + m.CostInfo = 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.CostInfo[mapkey] = mapvalue + iNdEx = postIndex + case 3: + 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 = &MySQLExplain_Table{} + } + if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NestedLoop", 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.NestedLoop = append(m.NestedLoop, &MySQLExplain_NestedLoopObj{}) + if err := m.NestedLoop[len(m.NestedLoop)-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 *MySQLExplain) 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: MySQLExplain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MySQLExplain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryBlock", 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.QueryBlock == nil { + m.QueryBlock = &MySQLExplain_QueryBlock{} + } + if err := m.QueryBlock.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/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..52d62c6b5e --- /dev/null +++ b/internal/x/expander/expander_test.go @@ -0,0 +1,456 @@ +package expander + +import ( + "context" + "database/sql" + "database/sql/driver" + "fmt" + "os" + "testing" + + "github.com/go-sql-driver/mysql" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/ncruces/go-sqlite3" + _ "github.com/ncruces/go-sqlite3/embed" + + "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 using the forked driver's StmtMetadata. +type MySQLColumnGetter struct { + db *sql.DB +} + +func (g *MySQLColumnGetter) GetColumnNames(ctx context.Context, query string) ([]string, error) { + conn, err := g.db.Conn(ctx) + if err != nil { + return nil, err + } + defer conn.Close() + + var columns []string + err = conn.Raw(func(driverConn any) error { + preparer, ok := driverConn.(driver.ConnPrepareContext) + if !ok { + return fmt.Errorf("driver connection does not support PrepareContext") + } + + stmt, err := preparer.PrepareContext(ctx, query) + if err != nil { + return err + } + defer stmt.Close() + + meta, ok := stmt.(mysql.StmtMetadata) + if !ok { + return fmt.Errorf("prepared statement does not implement StmtMetadata") + } + + for _, col := range meta.ColumnMetadata() { + columns = append(columns, col.Name) + } + return nil + }) + if err != nil { + return nil, err + } + + return columns, nil +} + +// 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 := 0; i < count; i++ { + 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/pkg/cli/cli.go b/pkg/cli/cli.go new file mode 100644 index 0000000000..c83b699c6e --- /dev/null +++ b/pkg/cli/cli.go @@ -0,0 +1,30 @@ +// package cli exposes the command-line interface for sqlc. It can be used to +// run sqlc from Go without the overhead of creating a child process. +// +// Example usage: +// +// package main +// +// import ( +// "os" +// +// sqlc "github.com/sqlc-dev/sqlc/pkg/cli" +// ) +// +// func main() { +// os.Exit(sqlc.Run(os.Args[1:])) +// } +package cli + +import ( + "os" + + "github.com/sqlc-dev/sqlc/internal/cmd" +) + +// Run the sqlc CLI. It takes an array of command-line arguments +// (excluding the executable argument itself) and returns an exit +// code. +func Run(args []string) int { + return cmd.Do(args, os.Stdin, os.Stdout, os.Stderr) +} diff --git a/placeholder.go b/placeholder.go index a5aac43502..c53616c9fb 100644 --- a/placeholder.go +++ b/placeholder.go @@ -1,6 +1,6 @@ package sqlc // This is a dummy file that allows SQLC to be "installed" as a module and locked using -// go.mod and then run using "go run github.com/kyleconroy/sqlc" +// go.mod and then run using "go run github.com/sqlc-dev/sqlc" type Placeholder struct{} 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 new file mode 100644 index 0000000000..998cf114e8 --- /dev/null +++ b/protos/buf.yaml @@ -0,0 +1,8 @@ +version: v1 +name: buf.build/sqlc/sqlc +breaking: +lint: + use: + - DEFAULT + except: + - PACKAGE_VERSION_SUFFIX diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto new file mode 100644 index 0000000000..e6faf19bad --- /dev/null +++ b/protos/plugin/codegen.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; + +package plugin; + +service CodegenService { + rpc Generate (GenerateRequest) returns (GenerateResponse); +} + +message File { + string name = 1 [json_name = "name"]; + bytes contents = 2 [json_name = "contents"]; +} + +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 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"]; + Codegen codegen = 12 [json_name = "codegen"]; +} + +message Codegen { + message Process { + string cmd = 1; + } + message WASM { + string url = 1; + string sha256 = 2; + } + string out = 1 [json_name = "out"]; + string plugin = 2 [json_name = "plugin"]; + bytes options = 3 [json_name = "options"]; + repeated string env = 4 [json_name = "env"]; + Process process = 5 [json_name = "process"]; + WASM wasm = 6 [json_name = "wasm"]; +} + +message Catalog { + string comment = 1; + string default_schema = 2; + string name = 3; + repeated Schema schemas = 4; +} + +message Schema { + string comment = 1; + string name = 2; + repeated Table tables = 3; + repeated Enum enums = 4; + repeated CompositeType composite_types = 5; +} + +message CompositeType { + string name = 1; + string comment = 2; +} + +message Enum { + string name = 1; + repeated string vals = 2; + string comment = 3; +} + +message Table { + Identifier rel = 1; + repeated Column columns = 2; + string comment = 3; +} + +message Identifier { + string catalog = 1; + string schema = 2; + string name = 3; +} + +message Column { + string name = 1; + bool not_null = 3; + bool is_array = 4; + string comment = 5; + int32 length = 6; + bool is_named_param = 7; + bool is_func_call = 8; + + // XXX: Figure out what PostgreSQL calls `foo.id` + string scope = 9; + Identifier table = 10; + string table_alias = 11; + Identifier type = 12; + bool is_sqlc_slice = 13; + Identifier embed_table = 14; + string original_name = 15; + bool unsigned = 16; + int32 array_dims = 17; +} + +message Query { + string text = 1 [json_name = "text"]; + string name = 2 [json_name = "name"]; + string cmd = 3 [json_name = "cmd"]; + repeated Column columns = 4 [json_name = "columns"]; + repeated Parameter params = 5 [json_name = "parameters"]; + repeated string comments = 6 [json_name = "comments"]; + string filename = 7 [json_name = "filename"]; + Identifier insert_into_table = 8 [json_name = "insert_into_table"]; +} + +message Parameter { + int32 number = 1 [json_name = "number"]; + Column column = 2 [json_name = "column"]; +} + +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 GenerateResponse { + repeated File files = 1 [json_name = "files"]; +} diff --git a/protos/vet/vet.proto b/protos/vet/vet.proto new file mode 100644 index 0000000000..9a5ded68ea --- /dev/null +++ b/protos/vet/vet.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; + +package vet; + +message Parameter { + int32 number = 1 [json_name = "number"]; +} + +message Config { + 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"]; +} + +message Query { + string sql = 1 [json_name = "sql"]; + string name = 2 [json_name = "name"]; + string cmd = 3 [json_name = "cmd"]; + repeated Parameter params = 4 [json_name = "parameters"]; +} + +message PostgreSQL { + PostgreSQLExplain explain = 1; +} + +message PostgreSQLExplain { + Plan plan = 1 [json_name = "Plan"]; + map settings = 2 [json_name = "Settings"]; + Planning planning = 3 [json_name = "Planning"]; + + message Plan { + string node_type = 1 [json_name = "Node Type"]; + string parent_relationship = 2 [json_name = "Parent Relationship"]; + string relation_name = 3 [json_name = "Relation Name"]; + string schema = 4 [json_name = "Schema"]; + string alias = 5 [json_name = "Alias"]; + bool parallel_aware = 6 [json_name = "Parallel Aware"]; + bool async_capable = 7 [json_name = "Async Capable"]; + float startup_cost = 8 [json_name = "Startup Cost"]; + float total_cost = 9 [json_name = "Total Cost"]; + uint64 plan_rows = 10 [json_name = "Plan Rows"]; + uint64 plan_width = 11 [json_name = "Plan Width"]; + repeated string output = 12 [json_name = "Output"]; + repeated Plan plans = 13 [json_name = "Plans"]; + + // Embedded "Blocks" fields + uint64 shared_hit_blocks = 14 [json_name = "Shared Hit Blocks"]; + uint64 shared_read_blocks = 15 [json_name = "Shared Read Blocks"]; + uint64 shared_dirtied_blocks = 16 [json_name = "Shared Dirtied Blocks"]; + uint64 shared_written_blocks = 17 [json_name = "Shared Written Blocks"]; + uint64 local_hit_blocks = 18 [json_name = "Local Hit Blocks"]; + uint64 local_read_blocks = 19 [json_name = "Local Read Blocks"]; + uint64 local_dirtied_blocks = 20 [json_name = "Local Dirtied Blocks"]; + uint64 local_written_blocks = 21 [json_name = "Local Written Blocks"]; + uint64 temp_read_blocks = 22 [json_name = "Temp Read Blocks"]; + uint64 temp_written_blocks = 23 [json_name = "Temp Written Blocks"]; + + // "Node Type": "Sort" fields + repeated string sort_key = 24 [json_name = "Sort Key"]; + + // "Node Type": "Hash Join" fields + string join_type = 25 [json_name = "Join Type"]; + bool inner_unique = 26 [json_name = "Inner Unique"]; + string hash_cond = 27 [json_name = "Hash Cond"]; + + // "Node Type": "Index Scan" fields + string index_name = 28 [json_name = "Index Name"]; + string scan_direction = 29 [json_name = "Scan Direction"]; + string index_cond = 30 [json_name = "Index Cond"]; + } + + message Planning { + uint64 shared_hit_blocks = 1 [json_name = "Shared Hit Blocks"]; + uint64 shared_read_blocks = 2 [json_name = "Shared Read Blocks"]; + uint64 shared_dirtied_blocks = 3 [json_name = "Shared Dirtied Blocks"]; + uint64 shared_written_blocks = 4 [json_name = "Shared Written Blocks"]; + uint64 local_hit_blocks = 5 [json_name = "Local Hit Blocks"]; + uint64 local_read_blocks = 6 [json_name = "Local Read Blocks"]; + uint64 local_dirtied_blocks = 7 [json_name = "Local Dirtied Blocks"]; + uint64 local_written_blocks = 8 [json_name = "Local Written Blocks"]; + uint64 temp_read_blocks = 9 [json_name = "Temp Read Blocks"]; + uint64 temp_written_blocks = 10 [json_name = "Temp Written Blocks"]; + } +} + +message MySQL { + MySQLExplain explain = 1; +} + +message MySQLExplain { + QueryBlock query_block = 1; + + message QueryBlock { + uint64 select_id = 1; + string message = 2; + map cost_info = 3; + Table table = 4; + OrderingOperation ordering_operation = 5; + repeated NestedLoopObj nested_loop = 6; + } + + message Table { + string table_name = 1; + string access_type = 2; + uint64 rows_examined_per_scan = 3; + uint64 rows_produced_per_join = 4; + string filtered = 5; + map cost_info = 6; + repeated string used_columns = 7; + bool insert = 8; + repeated string possible_keys = 9; + string key = 10; + repeated string used_key_parts = 11; + string key_length = 12; + repeated string ref = 13; + } + + message NestedLoopObj { + Table table = 1; + } + + message OrderingOperation { + bool using_filesort = 1; + map cost_info = 2; + Table table = 3; + repeated NestedLoopObj nested_loop = 4; + } +} diff --git a/scripts/build/main.go b/scripts/build/main.go index 3f217deb25..6841c52e74 100755 --- a/scripts/build/main.go +++ b/scripts/build/main.go @@ -28,7 +28,7 @@ func main() { fmt.Printf("::set-output name=version::%s\n", version) - x := "-X github.com/kyleconroy/sqlc/internal/cmd.version=" + version + x := "-X github.com/sqlc-dev/sqlc/internal/cmd.version=" + version args := []string{ "build", "-ldflags", x, diff --git a/scripts/bump-version/main.go b/scripts/bump-version/main.go new file mode 100644 index 0000000000..aaf3f58532 --- /dev/null +++ b/scripts/bump-version/main.go @@ -0,0 +1,150 @@ +package main + +import ( + "flag" + "fmt" + "io/fs" + "log" + "os" + "path/filepath" + "strings" + + "github.com/google/go-cmp/cmp" +) + +func main() { + curr := flag.String("c", "", "current version") + next := flag.String("n", "", "next version") + write := flag.Bool("w", false, "write out changes") + flag.Parse() + if err := run(*curr, *next, *write); err != nil { + log.Fatal(err) + } +} + +func run(current, next string, realmode bool) error { + write := func(path, old, new string) error { + if realmode { + if err := os.WriteFile(path, []byte(new), 0644); err != nil { + return fmt.Errorf("write error: %s: %w", path, err) + } + } else { + if diff := cmp.Diff(old, new); diff != "" { + log.Printf("%s: %s\n", path, diff) + } + } + return nil + } + + { + path := filepath.Join(".github", "ISSUE_TEMPLATE", "BUG_REPORT.yml") + c, err := os.ReadFile(path) + if err != nil { + return err + } + old := string(c) + if !strings.Contains(old, "- "+next) { + item := "- " + current + new := strings.ReplaceAll(old, item, "- "+next+"\n "+item) + if err := write(path, old, new); err != nil { + return err + } + } + } + + { + path := filepath.Join("docs", "overview", "install.md") + c, err := os.ReadFile(path) + if err != nil { + return err + } + old := string(c) + new := strings.ReplaceAll(old, "v"+current, "v"+next) + new = strings.ReplaceAll(new, "sqlc_"+current, "sqlc_"+next) + if err := write(path, old, new); err != nil { + return err + } + } + + { + path := filepath.Join("internal", "info", "facts.go") + c, err := os.ReadFile(path) + if err != nil { + return err + } + old := string(c) + new := strings.ReplaceAll(old, "v"+current, "v"+next) + if err := write(path, old, new); err != nil { + return err + } + } + + { + path := filepath.Join("docs", "conf.py") + c, err := os.ReadFile(path) + if err != nil { + return err + } + old := string(c) + new := strings.ReplaceAll(old, "release = '"+current, "release = '"+next) + if err := write(path, old, new); err != nil { + return err + } + } + + walker := func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + switch filepath.Ext(path) { + case ".go", ".kt", ".py", ".json", ".md": + c, err := os.ReadFile(path) + if err != nil { + return err + } + old := string(c) + new := strings.ReplaceAll(old, + `"sqlc_version": "v`+current, + `"sqlc_version": "v`+next) + new = strings.ReplaceAll(new, + `sqlc-version: "`+current, + `sqlc-version: "`+next) + new = strings.ReplaceAll(new, + `sqlc-version: '`+current, + `sqlc-version: '`+next) + new = strings.ReplaceAll(new, "sqlc v"+current, "sqlc v"+next) + new = strings.ReplaceAll(new, "SQLC_VERSION=v"+current, "SQLC_VERSION=v"+next) + if err := write(path, old, new); err != nil { + return err + } + default: + } + return nil + } + + { + p := filepath.Join("internal", "endtoend", "testdata") + if err := filepath.Walk(p, walker); err != nil { + return err + } + } + + { + p := filepath.Join("examples") + if err := filepath.Walk(p, walker); err != nil { + return err + } + } + + { + p := filepath.Join("docs") + if err := filepath.Walk(p, walker); err != nil { + return err + } + } + + return nil +} 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 bfc951d338..0000000000 --- a/scripts/regenerate/main.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "strings" -) - -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") { - cwd := filepath.Dir(path) - cmd := exec.Command("sqlc-dev", "generate") - cmd.Dir = cwd - failed := cmd.Run() - if _, err := os.Stat(filepath.Join(cwd, "stderr.txt")); os.IsNotExist(err) && failed != nil { - return fmt.Errorf("%s: sqlc-dev generate failed", cwd) - } - } - 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/release.go b/scripts/release.go index 125f02d8b8..a8651a6ee7 100755 --- a/scripts/release.go +++ b/scripts/release.go @@ -10,13 +10,11 @@ import ( ) func main() { - draft := flag.Bool("draft", false, "create a draft release") docker := flag.Bool("docker", false, "create a docker release") flag.Parse() version := os.Getenv("VERSION") sha := os.Getenv("GITHUB_SHA") - ref := os.Getenv("GITHUB_REF") if version == "" { cmd := exec.Command("git", "show", "--no-patch", "--no-notes", "--pretty=%ci", sha) @@ -34,7 +32,7 @@ func main() { } if *docker { - x := "-extldflags \"-static\" -X github.com/kyleconroy/sqlc/internal/cmd.version=" + version + x := "-extldflags \"-static\" -X github.com/sqlc-dev/sqlc/internal/cmd.version=" + version args := []string{ "build", "-a", @@ -57,41 +55,5 @@ func main() { log.Fatalf("missing platform_arch argument") } - xname := "./equinox" - if _, err := os.Stat("./equinox"); os.IsNotExist(err) { - xname = "equinox" - } - - channel := "devel" - if strings.HasPrefix(ref, "refs/tags/") { - channel = "stable" - version = strings.TrimPrefix(ref, "refs/tags/") - } - - args := []string{"release", - "--channel", channel, - "--version", version, - } - - if *draft { - args = append(args, "--draft") - } - - x := "-X github.com/kyleconroy/sqlc/internal/cmd.version=" + version - args = append(args, []string{ - "--platforms", flag.Arg(0), - "--app", "app_i4iCp1SuYfZ", - "--token", os.Getenv("EQUINOX_API_TOKEN"), - "--", - "-ldflags", x, "./cmd/sqlc", - }...) - - log.Printf("Releasing %s on channel %s", flag.Arg(0), channel) - cmd := exec.Command(xname, args...) - cmd.Env = os.Environ() - out, err := cmd.CombinedOutput() - if err != nil { - log.Println(strings.TrimSpace(string(out))) - log.Fatal(err) - } + log.Fatal("publishing to Equinox has been disabled") } diff --git a/scripts/report.sh b/scripts/report.sh new file mode 100755 index 0000000000..31302f4d21 --- /dev/null +++ b/scripts/report.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +curl \ + -X POST \ + --fail-with-body \ + -H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \ + -F "data=@junit.xml" \ + -F "format=junit" \ + -F "run_env[CI]=buildkite" \ + -F "run_env[key]=$GITHUB_RUN_ID" \ + -F "run_env[number]=$GITHUB_RUN_NUMBER-$GITHUB_RUN_ATTEMPT" \ + -F "run_env[job_id]=$GITHUB_RUN_ID" \ + -F "run_env[branch]=$GITHUB_REF" \ + -F "run_env[commit_sha]=$GITHUB_SHA" \ + -F "run_env[message]=Foo" \ + -F "run_env[url]=$GITHUB_SERVER_URL" \ + https://analytics-api.buildkite.com/v1/uploads diff --git a/scripts/test-json-process-plugin/main.go b/scripts/test-json-process-plugin/main.go new file mode 100644 index 0000000000..6bcc7a25d0 --- /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]interface{}) + 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"].([]interface{}) + for _, q := range queries { + text := q.(map[string]interface{})["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()}}}) +}