deepsky / SQL-Code-Assistant-

SQL Code Assistant Plugin for Intellij IDEA
25 stars 9 forks source link

Parsing of unique constraints with "using" clause within "create table" #1

Closed jkaving closed 12 years ago

jkaving commented 12 years ago

Hi. Thanks for a great plugin!

Unfortunately I have a problem with the highlighting of our SQL-files. We have "create table"-statements with inline unique constraint creation where we have a "using"-clause to specify the tablespace for the index - like this:

    CREATE TABLE t (
        uuid RAW(16) NOT NULL,
        name VARCHAR2(255) NOT NULL,
        CONSTRAINT pk_t PRIMARY KEY (uuid),
        CONSTRAINT un_t_name
            UNIQUE (name) USING INDEX TABLESPACE config
    );

For the above I get an "Unexpected token" error marker for "USING INDEX TABLESPACE config )".

However, creating the constraint outside of the "create table"-statement instead works:

    ALTER TABLE t 
      ADD CONSTRAINT pf_Host_name_idx UNIQUE (name) 
      USING INDEX TABLESPACE config;

I thought I would be able to fix this and forked your repository, but I haven't been able to figure out why it doesn't work.

deepsky commented 12 years ago

Hi Johan, It looks the issue was fixed shortly before the New Year, at least I can't reproduce it in the last build. Also, I have updated the build instructions and ANT build scripts for 10 and 11 IDEA's versions:

commit 9f26749b59bdf71216d34cf23a8f3c0daa44b730

You may want to update your forked repository and try to build it one more time. In alternative, updated version of the plugin will be available from JetBrains Plugin repository in a few days.

jkaving commented 12 years ago

Yes, it works now - thanks!