Re: postgres PK serial column insert error

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Aug 02 2004 - 15:33:17 EDT

  • Next message: Laurence Gellert: "RE: postgres PK serial column insert error"

    Laurence Gellert <geller..arkwing.uoregon.edu> wrote:
    > I would like to do something along the lines of making an INSERT statement
    > like: "INSERT INTO login (username, password) VALUES ('test', 'abc');"
    >
    > Instead, it looks like Cayenne is accessing 'auto_pk_support' for the next
    > login id. This is two trips to the db, instead of one.

    You have to know what the primary key value is before you can insert the
    record.

    Cayenne does this by fetching that value using whichever automatic primary
    key methodology you've specified (by default a database-table-based system).
     While it's true that for a single insert, it'll take two trips, it'll
    prefetch 20 primary key values by default, so for 20 inserts, it's only 21
    trips to the db. (or if you're using batch processing and doing all 20 at
    the same time, only 2 trips for 20 inserts -- probably not the case when
    creating userids, though).

    Sorry I can't help with the actual error you're getting.

    -Mike



    This archive was generated by hypermail 2.0.0 : Mon Aug 02 2004 - 15:31:55 EDT