Hi,
I am trying to use sequence in Glorp using Postgresql for an id attribute, but I get an error id_seq does not exist. If I look at the generated table, and the Smalltalk code, the code says type « serial » for column id should be replaced by « integer » which looks wrong to me. Any idea ? Annick _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Annick,
This isn't an answer to your question, but it may be helpful... Are you only dealing with individual records per transaction? At a previous job, we had a large OR mapped VisualAge app, and found that using a single sequence for all tables and prefetching enough key values for all records to be inserted in all tables was the most efficient. Store uses Integers and prefetches values for each table from a different sequence. If you are dealing with single records, using a sequence field has no huge drawbacks, but you will need to requery to get the primary key into the object in the image. Niall is looking to see Glorp does this automatically. Postgres has an extension to INSERT which allows you to get back the id of the last record inserted, however Glorp does not currently support the extension. If you have n-to-many relationships in your transaction, prefetching sequences values allows you to populate the parent key value in the child records (for a 1-n) or both values in a link table record (for a many-many). On 4/30/14, 1:46 AM, Annick Fron wrote: > Hi, > > I am trying to use sequence in Glorp using Postgresql for an id attribute, but I get an error > id_seq does not exist. > If I look at the generated table, and the Smalltalk code, the code says type « serial » for column id should be replaced by « integer » which looks wrong to me. > > Any idea ? > > Annick > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Tom,
Actually my case is to generate unique ids, and relying on the database for that. So I use the requery to increase a key, gat the last id inserted and I dropped the sequence type. Otherwise the Postgres extension would be helpful, but I can manage without that. Le 30 avr. 2014 à 19:43, Tom Robinson <[hidden email]> a écrit : > Annick, > > This isn't an answer to your question, but it may be helpful... > > Are you only dealing with individual records per transaction? At a previous job, we had a large OR mapped VisualAge app, and found that using a single sequence for all tables and prefetching enough key values for all records to be inserted in all tables was the most efficient. Store uses Integers and prefetches values for each table from a different sequence. > > If you are dealing with single records, using a sequence field has no huge drawbacks, but you will need to requery to get the primary key into the object in the image. Niall is looking to see Glorp does this automatically. Postgres has an extension to INSERT which allows you to get back the id of the last record inserted, however Glorp does not currently support the extension. > > If you have n-to-many relationships in your transaction, prefetching sequences values allows you to populate the parent key value in the child records (for a 1-n) or both values in a link table record (for a many-many). > > On 4/30/14, 1:46 AM, Annick Fron wrote: >> Hi, >> >> I am trying to use sequence in Glorp using Postgresql for an id attribute, but I get an error >> id_seq does not exist. >> If I look at the generated table, and the Smalltalk code, the code says type « serial » for column id should be replaced by « integer » which looks wrong to me. >> >> Any idea ? >> >> Annick >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |