Skip to content

Parse error CREATE TABLE UNIQUE (a(1)) #406

Open

Description

@mathiasrw

MySQL can handle the following expression

CREATE TABLE t7(a TEXT, UNIQUE (a(1)))

With alasql I get

Parse error on line 1:
...t7(a TEXT, UNIQUE (a(1)))
-----------------------^
Expecting 'EOF', 'WITH', 'COMMA', 'RPAR', 'PIVOT', 'UNPIVOT', 'ORDER', 'EQ', 'WHERE', 'DOT', 'UNION', 'INTERSECT', 'EXCEPT', 'FROM', 'INTO', 'CROSS', 'OUTER', 'NATURAL', 'JOIN', 'INNER', 'LEFT', 'RIGHT', 'FULL', 'SEMI', 'ANTI', 'GROUP', 'LIMIT', 'END', 'ELSE', 'SEMICOLON', 'GO', got 'LPAR'

Activity

  1. agershun commented on Sep 9, 2015

    @agershun
    Member

    What this construction means? That the first character of a is unique?

  2. mathiasrw commented on Sep 9, 2015

    @mathiasrw
    MemberAuthor

    I will have to replicate it in MySQL - im not sure eighter...

  3. self-assigned this
    on Sep 9, 2015
  4. agershun commented on Jan 11, 2016

    @agershun
    Member

    @mathiasrw Any news on this?

  5. mathiasrw commented on Jan 11, 2016

    @mathiasrw
    MemberAuthor

    Aw... no news - sorry :-/

    Its on my list again now.

  6. mathiasrw commented on Jan 11, 2016

    @mathiasrw
    MemberAuthor

    @agershun

    "This is the length option to an index. It uses only the first n characters of a to validate uniqueness."

  7. agershun commented on Jan 11, 2016

    @agershun
    Member

    What is better?

    1. Change the syntax to this one: UNIQUE(a(1))
    2. Use the regular AlaSQL expression inside this index:
    UNIQUE (a->(0))
    

    or for two characters:

    UNIQUE (MID(a,1,2))
    

    2016-01-11 16:26 GMT+03:00 Mathias Rangel Wulff notifications@github.com:

    @agershun https://github.com/agershun

    "This is the length option to an index. It uses only the first n
    characters of a to validate uniqueness."

    —
    Reply to this email directly or view it on GitHub
    #406 (comment).

  8. mathiasrw commented on Jan 11, 2016

    @mathiasrw
    MemberAuthor

    I vote for 1) - its part of MySQL so dont see it as a good thing not to support UNIQUE(a(1))

    Ps: when making code style you only need a single around - the trippel is for when you have a line break :)

  9. mathiasrw commented on Feb 8, 2016

    @mathiasrw
    MemberAuthor

    Anything new on this?

  10. removed their assignment
    on Nov 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions