Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalar row subqueries with an alias column name broken #127

Open
jaypipes opened this issue Jun 20, 2018 · 0 comments
Open

Scalar row subqueries with an alias column name broken #127

jaypipes opened this issue Jun 20, 2018 · 0 comments
Labels
Milestone

Comments

@jaypipes
Copy link
Owner

[jaypipes@uberbox _build]$ ./sqltoaster/sqltoaster --yaml "SELECT (SELECT d FROM t2 WHERE d.id = t2.id) AS d_id FROM t2"
Syntax error.
Expected to find one of ('*'|<< identifier >>) but found keyword[AS]
SELECT (SELECT d FROM t2 WHERE d.id = t2.id) AS d_id FROM t2
                                            ^^^^^^^^^^^^^^^^
(took 109416 nanoseconds)
[jaypipes@uberbox _build]$ ./sqltoaster/sqltoaster --yaml "SELECT (SELECT d FROM t2 WHERE d.id = t2.id) FROM t2"
statements:
  - type: SELECT
    select_statement:
      query:
        selected_columns:
          - type: NUMERIC_EXPRESSION
            numeric_expression:
              left:
                left:
                  primary:
                    type: VALUE
                    value:
                      primary:
                        type: SCALAR_SUBQUERY
                        scalar_subquery:
                          query:
                            selected_columns:
                              - type: NUMERIC_EXPRESSION
                                numeric_expression:
                                  left:
                                    left:
                                      primary:
                                        type: VALUE
                                        value:
                                          primary:
                                            type: COLUMN_REFERENCE
                                            column_reference: d
                            referenced_tables:
                              - type: TABLE
                                table:
                                  name: t2
                            where:
                              terms:
                                - factor:
                                    predicate:
                                      type: COMPARISON
                                      comparison_predicate:
                                        op: EQUAL
                                        left:
                                          type: ELEMENT
                                          element:
                                            type: VALUE_EXPRESSION
                                            value_expression:
                                              type: NUMERIC_EXPRESSION
                                              numeric_expression:
                                                left:
                                                  left:
                                                    primary:
                                                      type: VALUE
                                                      value:
                                                        primary:
                                                          type: COLUMN_REFERENCE
                                                          column_reference: d.id
                                        right:
                                          type: ELEMENT
                                          element:
                                            type: VALUE_EXPRESSION
                                            value_expression:
                                              type: NUMERIC_EXPRESSION
                                              numeric_expression:
                                                left:
                                                  left:
                                                    primary:
                                                      type: VALUE
                                                      value:
                                                        primary:
                                                          type: COLUMN_REFERENCE
                                                          column_reference: t2.id
        referenced_tables:
          - type: TABLE
            table:
              name: t2
(took 50661 nanoseconds)

@jaypipes jaypipes added the bug label Jun 20, 2018
@jaypipes jaypipes added this to the 0.2 milestone Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant