Skip to content

sql: postgres-style type cast operator should be whitespace-insensitive

The following query doesn't parse in picodata:

select 1 :: text;
ERROR:  picodata error: sbroad: rule parsing error:  --> 1:10
  |
1 | select 1 :: text;
  |          ^---
  |
  = expected EOI, Limit, UnionOp, ExceptOp, UnionAllOp, DqlOption, Identifier, Like, Similar, Escape, And, Or, ConcatInfixOp, Add, Subtract, Multiply, Divide, Eq, Gt, GtEq, Lt, LtEq, NotEq, IsPostfix, or NotFlag

Apparently, the piece of grammar responsible for :: doesn't account for whitespaces:

postgres=> select 1:: text;
ERROR:  picodata error: sbroad: rule parsing error:  --> 1:11
  |
1 | select 1:: text;
  |           ^---
  |
  = expected ColumnDefType

Notably, postgres allows them:

postgres[port=35131]=# select 1 :: text;
┌──────┐
│ text │
├──────┤
│ 1    │
└──────┘
(1 row)

Time: 0,592 ms
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information