Help save net neutrality! Learn more.

user lacks priviledge or object not found

  • 1234

    1234 - 2009-12-10

    This error can occur quite easily in Database Manager 2.0 when combining DDL & referencing DML separated only by a ';' and clicking "Execute SQL".  Just paste all the code below into Database Manager and click.

    While this should be fixed too, at least most of it will run in Database Manager, if you paste it one statement at a time.  I found this with code running in Java, executing 1 statement at a time.

    But, (you knew there was gonna be one), after a creating table using a SELECT Statement, you may not specifically reference any column of that table until the Database Manager, DB, is closed then re-opened.  No DB close is required however, as long as no columns are directly referenced e.g. 'SELECT * FROM a' 

    CREATE TABLE oneRowNotPartOfTest(whoCares integer);

    INSERT INTO oneRowNotPartOfTest VALUES(1);

    CREATE TABLE a(col_1, col2) AS (SELECT 'Z', 8 FROM oneRowNotPartOfTest) WITH DATA;

    SELECT col_1 FROM a;

    FYI, this code will not run at all in 1.8.  In 1.8, you could do a SELECT * INTO tbl FROM … .  This no longer works.

    Also, during the isolation of this problem, I typed:

    CREATE TABLE a(col_1) AS (SELECT 'Z' FROM oneRowNotPartOfTest) WITH DATA;

    Admittedly, it a pretty useless statement, but it actually produced an "unexpected token: )".

  • Fred Toussi

    Fred Toussi - 2009-12-10

    Pasting all the code is not supposed to work. Statements are compiled first and executed after, although we may still change this.

    The issues with CREATE TABLE AS need fixing. Thanks for reporting.


Log in to post a comment.