zed
zed copied to clipboard
SQL: Support for "::" casting notation
tl;dr
$ super -c "SELECT 3::string"
parse error at line 1, column 11:
SELECT 3::string
=== ^ ===
Details
Repro is with super commit cabf51f. This is a query from a sqllogictest.
SuperDB currently has a couple supported syntaxes for type casting, e.g.,
$ super -version
Version: cabf51f1a
$ super -c "SELECT string(3);"
{"string(3)":"3"}
$ super -c "SELECT CAST(3 AS string);"
{"CAST(3 AS string)":"3"}
However, the following syntax (allegedly first popularized by Postgres) is not currently supported.
$ super -c "SELECT 3::string"
parse error at line 1, column 11:
SELECT 3::string
=== ^ ===
An example of another SQL system that supports it:
$ duckdb --version
v1.3.0 71c5c07cdd
$ duckdb -c "SELECT 3::string"
┌────────────────────┐
│ CAST(3 AS VARCHAR) │
│ varchar │
├────────────────────┤
│ 3 │
└────────────────────┘