Casts should accept Postgres type names and list types, e.g. `x::int4`, `$1::int8[]`
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #6191 di @jarohen — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with the SQL grammar that defines cast targets and array types, and with CastArgsVisitor where visitArrayType is still abstract. Check how the existing scalar type names are matched so the Postgres aliases (int4, float8, bool, jsonb) can map onto them. Done when the statements in the issue (SELECT 1::int4, SELECT 'a'::text[], $1::BIGINT ARRAY, $1::int8[]) parse and cast without errors.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Casts using Postgres's own type names — int4, float8, bool, jsonb, text[] and the like — are parse errors, and casts to a list type fail in either spelling, though the SQL-standard spellings of scalar types work.
-
SQL ported from Postgres, and some generated SQL, uses these names
-
The SQL-standard spellings of scalar types already work
CAST(x AS INTEGER),x::BIGINT,x::DOUBLE PRECISIONall parse, so for scalars this is a gap in the accepted names rather than in the types.
Symptoms
Seen on main at 13aef89, via psql.
-
Postgres type names fail to parse as a cast target, via
::orCAST(... AS ...):int2,int4,int8,float4,float8,bool,bpchar,name,json,jsonb.SELECT 1::int4 ERROR: 08P01: Errors parsing SQL statement: - line 1:10 no viable alternative at input '1::int4' -
<type>[]fails to parseSELECT 'a'::text[] ERROR: 08P01: Errors parsing SQL statement: - line 1:16 mismatched input '[' expecting {<EOF>, ';'} -
<type> ARRAYparses, then fails with an internal error — literals and parameters alike ([1,2]::BIGINT ARRAY,CAST([1,2] AS BIGINT ARRAY),$1::VARCHAR ARRAY).ERROR: Method xtdb/sql/CastArgsVisitor.visitArrayType(Lxtdb/antlr/Sql$ArrayTypeContext;)Ljava/lang/Object; is abstract DETAIL: {"category":"fault","code":"xtdb.error/unknown", ...}
Problem
-
SQL written for Postgres has to be rewritten before XTDB will run it, when the only difference is the spelling of a type it already supports.
-
There is no working way to cast to a list type
$1::int8[]is how a Postgres client pins an array parameter's type, and neither it nor the SQL-standard$1::BIGINT ARRAYworks.
Out of scope
-
json/jsonbas cast targets
XTDB has no text-to-document cast, so'{"a": 1}'::jsonbhas no meaning to give it yet, and an identity cast would leave the string a string.
That wants its own card. -
Arrays of
timestamptzandinterval
Their scalar casts aren't expressed as a target type, so there's nothing to apply per element.
Generated by Claude Code
- Lingua principale
- Clojure
- Stelle
- 3.1k
- Fork
- 193
- Merge medio
- 1g 18h
- PR unite (30g)
- 56
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di xtdb/xtdb
-
pgwire tokens-reqd
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
metrics
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
documentation pgsource
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
a scan looping over more than the memory cache holds should keep a stable part of it residentForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaperformance
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
.Needs Triage Administration/People Priority:P2 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
metabase/metabase#85503 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug: Editing the L value in HSL mode resets H and S to 0Forse già presa @makesomethingshit l’ha presa 1 giorno fa. Apertaneeds triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
software-mansion/starknet-jvm#641 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
nrepl/piggieback#163 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
clojure-emacs/orchard#436 ·