title: Generator usage in insert statement of Firebird
body: <p>I have the following statement executed in Flamerobin (Firebird 2.1). It keeps reporting the following error on editor window</p>
  
  <blockquote>
    <p>" Dynamic SQL Error SQL error code = -104 Invalid command count of
    column list and variable list do not match "</p>
  </blockquote>
  
  <p>Normally columns are matching and there is no any mismatching in column counts, but having the generator, which I believe works in singleton basis, and resulting dataset from union statement can be the source of the error. </p>
  
  <pre><code>insert into test_table (load_name, X, Y, Z) values (
  gen_id(gen_new,1), (select X_I,Y_I,Z_I from 
  (
      select e1.X_I,e1.Y_I,e1.Z_I from ELEMENTS e1
      union 
      select e2.X_J,e2.Y_J,e2.Z_J from elements e2
  ) 
  ) )
  </code></pre>
  
  <p>DDL of table is:</p>
  
  <pre><code>CREATE TABLE TEST_TABLE
  (
    LOAD_NAME Char(20) NOT NULL,
    FACTOR Integer,
    NEW1 Integer,
    "new" Float,
    X Float,
    Y Float,
    Z Float,
    PRIMARY KEY (LOAD_NAME)
  );
  GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
   ON TEST_TABLE TO  SYSDBA WITH GRANT OPTION;
  </code></pre>