databendlabs / bendsql

Databend Native Client
Apache License 2.0
49 stars 26 forks source link

Bug: parse nullable(tuple) should not return parse err. #409

Closed TCeason closed 6 months ago

TCeason commented 6 months ago
:) drop table t;

DROP TABLE t

:) create table t(id tuple(string, array(tuple(array(int), array(string not null)))));

CREATE TABLE t(
  id tuple(
    STRING,
    array(tuple(array(int), array(STRING NOT NULL)))
  )
)

:) desc t;

DESC t

┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  Field │                               Type                               │  Null  │ Default │  Extra │
│ String │                              String                              │ String │  String │ String │
├────────┼──────────────────────────────────────────────────────────────────┼────────┼─────────┼────────┤
│ id     │ TUPLE(1 STRING, 2 ARRAY(TUPLE(1 ARRAY(INT32), 2 ARRAY(STRING)))) │ YES    │ NULL    │        │
└───────────────────────────────────────────────────────────────────────────────────────────────────────┘

bendsql return err, but insert is successd

./target/debug/bendsql                                                                                                                                                                        ✔  10s   eason@databend-arch1 
Welcome to BendSQL 0.17.0-1f08d67(2024-04-25T02:50:17.575815250Z).
Connecting to localhost:8000 as user root.
Connected to Databend Query v1.2.329-nightly-2e3459707e(rust-1.77.0-nightly-2024-04-24T06:04:56.359605219Z)

:) insert into t values(NULL);
error: ParseError: Nullable type must have one argument
:) 
Bye~

use mysql client query data:

    /data/eason/bendsql    main ⇡227 !1  mysql -uroot -p123 -h127.0.0.1 -P3307  -e 'select * from t;'                                                                                                                                   ✔  3s   eason@databend-arch1 
+------+
| id   |
+------+
| NULL |
+------+