My take on it is that you use autoincrement if you want an automatic
sequence on a non-primary key column only.
 
G.

        -----Original Message----- 
        From: Bill Schneider 
        Sent: Tue 19/11/2002 21:53 
        To: Turbine Torque Users List 
        Cc: 
        Subject: torque 3.0b4: sequences in postgresql
        
        

        I noticed that SQL is generated differently in Torque 3.0b4 for
PostgreSQL
        depending on whether "autoincrement='true'" is specified.
        
        When you have
        
        <table name="foo" idMethod="native">
          <column name="foo_id" primaryKey="true"/>
        </table>
        
        the resulting SQL works fine:
        ---
        drop sequence foo_id_seq;
        drop table foo;
        
        create sequence foo_id_seq;
        create table foo (
          foo_id ... default nextval('foo_id_seq');
        );
        ---
        If you add autoIncrement="true" to the column, instead you get
        ---
        drop sequence foo_id_seq;
        drop table foo;
        
        create sequence foo_id_seq;
        create table foo (
          foo_id ... serial;
        );
        
        the "serial" keyword implicitly creates a column that uses the
sequence
        "foo_foo_id_seq", which will not get dropped by the
Torque-generated drop
        script.
        
        Why the difference in behavior?  Has it ever been decided
whether the
        autoIncrement property is semantically significant or a no-op?
        
        -- Bill
        
        
        
        --
        To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
        For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>
        
        

<<winmail.dat>>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to