Skip to content

feat: Support PostgreSQL type casting (::) operator #188

@ajitpratap0

Description

@ajitpratap0

Description

Add support for PostgreSQL's double-colon type casting operator.

Example SQL

SELECT '123'::integer;
SELECT '2023-01-01'::date;
SELECT column_name::text FROM table_name;
SELECT (price * 1.1)::numeric(10,2) FROM products;

Current Behavior

The :: operator is not recognized as a type cast.

Expected Behavior

Parser should recognize :: as PostgreSQL's type casting operator and create appropriate AST nodes.

Priority

Medium - commonly used PostgreSQL syntax

Implementation Notes

  • Add TokenTypeDoubleColon token type
  • Create TypeCastExpression AST node with Expression and TargetType fields
  • Handle parameterized types like numeric(10,2) and varchar(255)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions