Bound Single-table SELECT Compiler
Compile one strict single-table SELECT AST for SQLite3 or PostgreSQL18 into quoted SQL, ordered bindings and source paths, with bounded predicates and explicit pagination; never execute SQL.
structured · Operation ID: sql-select-compile
Choose this operation when
- Compile a bounded SELECT query and parameter bindings from a structured plan
- Build a single-table SQLite3 or PostgreSQL18 query handoff without interpolating literal values
Outside this profile
- Running SQL, database access, schema/type/permission checks or certifying safe execution
- Raw SQL, writes, joins, wildcard, aliases, expressions, functions, subqueries, arbitrary SQL dialects, floats or inferred types
- Uploading artifacts, executing database statements, sending invitations, accessing calendars or changing remote state
Exact release references
Static JSON contract · Markdown reference · Fixed example response
Complete input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Declared profile: single-table-bound-select-v1",
"type": "object",
"properties": {
"dialect": {
"type": "string",
"enum": [
"sqlite3",
"postgresql18"
]
},
"table": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
},
"columns": {
"minItems": 1,
"maxItems": 64,
"type": "array",
"items": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
}
},
"where": {
"$ref": "#/$defs/__schema0"
},
"orderBy": {
"default": [],
"maxItems": 8,
"type": "array",
"items": {
"type": "object",
"properties": {
"column": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
},
"direction": {
"type": "string",
"enum": [
"asc",
"desc"
]
}
},
"required": [
"column",
"direction"
],
"additionalProperties": false
}
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 10000
},
"offset": {
"type": "integer",
"minimum": 0,
"maximum": 1000000
}
},
"required": [
"dialect",
"table",
"columns",
"limit",
"offset"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "compare"
},
"column": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
},
"op": {
"type": "string",
"enum": [
"eq",
"ne",
"lt",
"lte",
"gt",
"gte"
]
},
"value": {
"anyOf": [
{
"type": "string",
"maxLength": 60000
},
{
"type": "number"
}
],
"description": "Literal NUL-free Unicode text or a safe integer; never raw SQL"
}
},
"required": [
"kind",
"column",
"op",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "in"
},
"column": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
},
"values": {
"maxItems": 64,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"maxLength": 60000
},
{
"type": "number"
}
],
"description": "Literal NUL-free Unicode text or a safe integer; never raw SQL"
}
}
},
"required": [
"kind",
"column",
"values"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "is-null"
},
"column": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
}
},
"required": [
"kind",
"column"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "is-not-null"
},
"column": {
"type": "string",
"maxLength": 1000,
"description": "1–63 ASCII letters/digits/underscores, starting with a letter or underscore; always double-quoted"
}
},
"required": [
"kind",
"column"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "all"
},
"items": {
"maxItems": 128,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
},
"required": [
"kind",
"items"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "any"
},
"items": {
"maxItems": 128,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
},
"required": [
"kind",
"items"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "not"
},
"item": {
"$ref": "#/$defs/__schema0"
}
},
"required": [
"kind",
"item"
],
"additionalProperties": false
}
]
}
}
}
Complete output-envelope schema
{
"type": "object",
"required": [
"operation",
"version",
"result",
"provenance"
],
"properties": {
"operation": {
"const": "sql-select-compile",
"type": "string"
},
"version": {
"const": "0.29.0",
"type": "string"
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"dialect": {
"type": "string",
"enum": [
"sqlite3",
"postgresql18"
]
},
"sql": {
"type": "string"
},
"bindings": {
"maxItems": 256,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"maxLength": 60000
},
{
"type": "number"
}
],
"description": "Literal NUL-free Unicode text or a safe integer; never raw SQL"
}
},
"bindingPaths": {
"maxItems": 256,
"type": "array",
"items": {
"type": "string"
}
},
"statementCount": {
"type": "number",
"const": 1
},
"executed": {
"type": "boolean",
"const": false
}
},
"required": [
"dialect",
"sql",
"bindings",
"bindingPaths",
"statementCount",
"executed"
],
"additionalProperties": false,
"description": "Artifact result for declared profile: single-table-bound-select-v1"
},
"provenance": {
"type": "object",
"required": [
"inputSha256",
"outputSha256",
"deterministic",
"externalRequests"
],
"properties": {
"inputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"outputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"deterministic": {
"const": true
},
"externalRequests": {
"const": 0
}
}
}
},
"additionalProperties": false
}
Fixed example
One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.
Example input
{
"dialect": "postgresql18",
"table": "tasks",
"columns": [
"id",
"title"
],
"where": {
"kind": "all",
"items": [
{
"kind": "compare",
"column": "state",
"op": "eq",
"value": "ready"
},
{
"kind": "compare",
"column": "priority",
"op": "gte",
"value": 2
}
]
},
"orderBy": [
{
"column": "id",
"direction": "asc"
}
],
"limit": 10,
"offset": 0
}
Example response
{
"operation": "sql-select-compile",
"version": "0.29.0",
"result": {
"dialect": "postgresql18",
"sql": "SELECT \"id\", \"title\" FROM \"tasks\" WHERE (\"state\" = $1 AND \"priority\" >= $2) ORDER BY \"id\" ASC LIMIT $3 OFFSET $4",
"bindings": [
"ready",
2,
10,
0
],
"bindingPaths": [
"/where/items/0/value",
"/where/items/1/value",
"/limit",
"/offset"
],
"statementCount": 1,
"executed": false
},
"provenance": {
"inputSha256": "c469154a069d55fbfdc51d35d602d488d2eadf160e0a41e655056281f02640f5",
"outputSha256": "c5ace9156b9a3141378ca64b52da45563bb02e3938768b326825650abbe269e1",
"deterministic": true,
"externalRequests": 0
}
}
Bounds and precision
JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.
{
"global": {
"requestBytes": 131072,
"responseBytes": 524288,
"jsonDepth": 32,
"jsonNodes": 20000,
"requestsPerMinute": 60,
"paidAttemptsPerMinute": 20,
"idempotencyHours": 24
},
"operation": {
"inputBytes": 100000,
"outputBytes": 400000,
"jsonNodes": 12000,
"depth": 20,
"columns": 64,
"orderBy": 8,
"identifierBytes": 63,
"predicateNodes": 128,
"predicateDepth": 8,
"membershipValues": 64,
"parameters": 256,
"bindingTextBytes": 60000,
"sqlBytes": 16000,
"limit": 10000,
"offset": 1000000,
"profile": "single-table-bound-select-v1"
}
}
Complete schemas, descriptions and cross-field validation may impose additional limits.
Proposed price and protocol definitions
{
"unit": "one successful operation call",
"proposedNominalUsd": "0.005",
"sixDecimalTokenBaseUnits": "5000",
"subscription": false,
"includesPayerWalletOrNetworkFees": false,
"liveQuoteVerified": false,
"condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}
Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.
API path templates, not endpoints on this documentation host
{
"x402": "/v1/x402/sql-select-compile",
"mpp": "/v1/mpp/sql-select-compile"
}
Required headers
{
"Content-Type": "application/json",
"Idempotency-Key": "random 16–128 character operation identifier"
}
Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.
Execution profile and provider conditions
{
"deterministic": true,
"externalRequests": 0,
"maxExternalRequests": 0,
"resultSnapshotPersisted": false,
"fixedExampleIsIllustrativeSnapshot": false,
"requiresPayment": true,
"supportsMcpExecution": false
}
Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.
Failure handling
- HTTP 400: Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch Correct the request before payment
- HTTP 402: Payment challenge or rejected payment Use official protocol SDK; inspect payment outcome before another payment
- HTTP 409: Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay
- HTTP 413: Input or generated output too large Reduce input; no payment attempted for validation failure
- HTTP 415: Unsupported media type or compression Send uncompressed application/json
- HTTP 422: Schema or service-specific semantic validation failure Correct input using returned error code; no payment attempted
- HTTP 429: Request/payment-attempt rate exceeded Wait for rate limit window; preserve existing payment identity
- HTTP 503: Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation
Declared requirements
Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.