{
  "schema": 1,
  "sqlstate": "42601",
  "condition_name": "syntax_error",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "syntax_limit_comma",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned with a deterministic three-row ordered query."
      ],
      "trigger": "Execute the unsupported comma form over ordered rows: SELECT n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2.",
      "assertions": [
        "SQLSTATE is 42601 with the LIMIT #,# diagnostic",
        "The autocommit session remains IDLE",
        "Separate LIMIT and OFFSET syntax returns the second and third rows [2, 3]"
      ],
      "repair": "Use separate LIMIT and OFFSET clauses as indicated by the server hint.",
      "cleanup": "No persistent objects; close the runner connection."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "syntax_limit_comma",
      "case_id": "syntax_limit_comma",
      "language": "sql",
      "statements": {
        "trigger": "SELECT n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2",
        "repair": "SELECT n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 2 OFFSET 1"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.42601-pagination-semantics-latest.latest",
      "run_id": "42601-pagination-semantics-latest",
      "target": "latest",
      "status": "passed",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "summary_sha256": "d4b448d2e517a150ad0f7ced48ed48114bbb94e8fb2eaca389203555f6882b0d",
      "raw_sha256": "8a3fbabfae0f11a4a85d25c1dae94f0d602e072670492c0c6576d2270594f671",
      "case_manifest": {
        "id": "manifest.42601",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "c6588aaa200ad4c3e553eb4f9cddc4d052ec68dbbe5018c8eb3966c4c3eb723c"
      },
      "snippet_registry": {
        "id": "snippet-registry.42601",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "b3558d4c9d87beb77b205a3e505e35f2371cdb38cb270b3dd2c4c8a446fe0bc2"
      },
      "environment": {
        "TimeZone": "Asia/Shanghai",
        "backend_pid": 21158,
        "binary": {
          "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
          "pg_config": "/opt/homebrew/bin/pg_config",
          "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
          "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
        },
        "connection_scope": "runner-owned localhost port",
        "current_user": "runner",
        "docker": {},
        "lc_messages": "C",
        "libpq_version": "18.6",
        "locale": "en_US.UTF-8",
        "log_destination": "csvlog,jsonlog",
        "log_error_verbosity": "verbose",
        "log_min_error_statement": "error",
        "log_min_messages": "error",
        "logging_collector": "on",
        "machine": "arm64",
        "max_connections": "100",
        "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
        "psycopg_version": "3.3.5",
        "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
        "server_encoding": "UTF8",
        "server_version": "18.6 (Homebrew)",
        "server_version_num": "180006",
        "target_kind": "latest",
        "wal_level": "logical"
      },
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "SyntaxError",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "Use separate LIMIT and OFFSET clauses.",
          "message_primary": "LIMIT #,# syntax is not supported",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "gram.y",
          "source_function": "base_yyparse",
          "source_line": "13317",
          "sqlstate": "42601",
          "statement_position": "56",
          "table_name": null,
          "text": "LIMIT #,# syntax is not supported\nLINE 1: ...T n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2\n                                                             ^\nHINT:  Use separate LIMIT and OFFSET clauses."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_rows": [
          2,
          3
        ]
      },
      "assertions": [
        {
          "expected": "42601",
          "name": "42601 SQLSTATE",
          "observed": "42601",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42601 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "LIMIT #,# syntax is not supported",
          "name": "42601 primary diagnostic",
          "observed": "LIMIT #,# syntax is not supported",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "syntax error leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "rows": [
              2,
              3
            ],
            "status": "IDLE"
          },
          "name": "separate LIMIT/OFFSET preserves offset/count semantics",
          "observed": {
            "rows": [
              2,
              3
            ],
            "status": "IDLE"
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 21158,
          "binary": {
            "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
            "pg_config": "/opt/homebrew/bin/pg_config",
            "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
            "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
          },
          "connection_scope": "runner-owned localhost port",
          "current_user": "runner",
          "docker": {},
          "lc_messages": "C",
          "libpq_version": "18.6",
          "locale": "en_US.UTF-8",
          "log_destination": "csvlog,jsonlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "18.6 (Homebrew)",
          "server_version_num": "180006",
          "target_kind": "latest",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "42601",
                "name": "42601 SQLSTATE",
                "observed": "42601",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42601 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "LIMIT #,# syntax is not supported",
                "name": "42601 primary diagnostic",
                "observed": "LIMIT #,# syntax is not supported",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "syntax error leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "rows": [
                    2,
                    3
                  ],
                  "status": "IDLE"
                },
                "name": "separate LIMIT/OFFSET preserves offset/count semantics",
                "observed": {
                  "rows": [
                    2,
                    3
                  ],
                  "status": "IDLE"
                },
                "passed": true
              }
            ],
            "case_id": "syntax_limit_comma",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.007,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "SyntaxError",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "Use separate LIMIT and OFFSET clauses.",
                "message_primary": "LIMIT #,# syntax is not supported",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "gram.y",
                "source_function": "base_yyparse",
                "source_line": "13317",
                "sqlstate": "42601",
                "statement_position": "56",
                "table_name": null,
                "text": "LIMIT #,# syntax is not supported\nLINE 1: ...T n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2\n                                                             ^\nHINT:  Use separate LIMIT and OFFSET clauses."
              },
              "failed_status": "IDLE",
              "repair_rows": [
                2,
                3
              ],
              "repair_status": "IDLE"
            },
            "schema": "c42601_syntax_limit_comma",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.42601-pagination-semantics-pg10.pg10",
      "run_id": "42601-pagination-semantics-pg10",
      "target": "pg10",
      "status": "passed",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "summary_sha256": "bd30ee0ec5a9797ddeec5689cd4b511ca294bdcfe26dcfdaf8c0db3f6ea4c864",
      "raw_sha256": "65a78ef75fe67cd99fa8d10bdb32b3203d487153368178c98200220df41a8980",
      "case_manifest": {
        "id": "manifest.42601",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "c6588aaa200ad4c3e553eb4f9cddc4d052ec68dbbe5018c8eb3966c4c3eb723c"
      },
      "snippet_registry": {
        "id": "snippet-registry.42601",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "b3558d4c9d87beb77b205a3e505e35f2371cdb38cb270b3dd2c4c8a446fe0bc2"
      },
      "environment": {
        "TimeZone": "Etc/UTC",
        "backend_pid": 79,
        "binary": {},
        "connection_scope": "runner-owned localhost port",
        "current_user": "postgres",
        "docker": {
          "architecture": "arm64",
          "command": "/usr/local/bin/docker",
          "digest": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "image": "postgres:10",
          "image_created": "2022-06-23T09:11:18.374607054Z",
          "image_ref": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "log_destination": "csvlog",
          "os": "linux",
          "repo_digests": [
            "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
          ]
        },
        "lc_messages": "en_US.utf8",
        "libpq_version": "18.6",
        "locale": "en_US.UTF-8",
        "log_destination": "csvlog",
        "log_error_verbosity": "verbose",
        "log_min_error_statement": "error",
        "log_min_messages": "error",
        "logging_collector": "on",
        "machine": "arm64",
        "max_connections": "100",
        "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
        "psycopg_version": "3.3.5",
        "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
        "server_encoding": "UTF8",
        "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
        "server_version_num": "100021",
        "target_kind": "pg10",
        "wal_level": "logical"
      },
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "SyntaxError",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "Use separate LIMIT and OFFSET clauses.",
          "message_primary": "LIMIT #,# syntax is not supported",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "gram.y",
          "source_function": "base_yyparse",
          "source_line": "11203",
          "sqlstate": "42601",
          "statement_position": "56",
          "table_name": null,
          "text": "LIMIT #,# syntax is not supported\nLINE 1: ...T n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2\n                                                             ^\nHINT:  Use separate LIMIT and OFFSET clauses."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_rows": [
          2,
          3
        ]
      },
      "assertions": [
        {
          "expected": "42601",
          "name": "42601 SQLSTATE",
          "observed": "42601",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42601 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "LIMIT #,# syntax is not supported",
          "name": "42601 primary diagnostic",
          "observed": "LIMIT #,# syntax is not supported",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "syntax error leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": 1
          },
          "name": "separate LIMIT/OFFSET syntax succeeds",
          "observed": {
            "status": "IDLE",
            "value": 1
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 79,
          "binary": {},
          "connection_scope": "runner-owned localhost port",
          "current_user": "postgres",
          "docker": {
            "architecture": "arm64",
            "command": "/usr/local/bin/docker",
            "digest": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "image": "postgres:10",
            "image_created": "2022-06-23T09:11:18.374607054Z",
            "image_ref": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "log_destination": "csvlog",
            "os": "linux",
            "repo_digests": [
              "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
            ]
          },
          "lc_messages": "en_US.utf8",
          "libpq_version": "18.6",
          "locale": "en_US.UTF-8",
          "log_destination": "csvlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
          "server_version_num": "100021",
          "target_kind": "pg10",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "42601",
                "name": "42601 SQLSTATE",
                "observed": "42601",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42601 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "LIMIT #,# syntax is not supported",
                "name": "42601 primary diagnostic",
                "observed": "LIMIT #,# syntax is not supported",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "syntax error leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "rows": [
                    2,
                    3
                  ],
                  "status": "IDLE"
                },
                "name": "separate LIMIT/OFFSET preserves offset/count semantics",
                "observed": {
                  "rows": [
                    2,
                    3
                  ],
                  "status": "IDLE"
                },
                "passed": true
              }
            ],
            "case_id": "syntax_limit_comma",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.013,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "SyntaxError",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "Use separate LIMIT and OFFSET clauses.",
                "message_primary": "LIMIT #,# syntax is not supported",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "gram.y",
                "source_function": "base_yyparse",
                "source_line": "11203",
                "sqlstate": "42601",
                "statement_position": "56",
                "table_name": null,
                "text": "LIMIT #,# syntax is not supported\nLINE 1: ...T n FROM generate_series(1, 3) AS s(n) ORDER BY n LIMIT 1, 2\n                                                             ^\nHINT:  Use separate LIMIT and OFFSET clauses."
              },
              "failed_status": "IDLE",
              "repair_rows": [
                2,
                3
              ],
              "repair_status": "IDLE"
            },
            "schema": "c42601_syntax_limit_comma",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
