i have found a sort of workaround for this. a composite primary key in postgres cannot have nulls in any of its columns. so there must be default_value=something. but because the column is also foreign key, that "something" should point to an existing record... which means creating a bogus record just for the sake of the foregn key. hmmm may be not a workaround then.
actualy this whole mess is because... i need an unique constraint on that set of foreign keys, but mssql refused to have unique constraints other than the primary key, hence i forced it to be the primary key... On Tuesday 13 May 2008 10:48:23 Eric Ongerth wrote: > So part of the problem is postgresql is autoincrementing where you > do not want it to do so? I thought postgresql only autoincrements > where your column is of type 'serial'. Is that not true? Or if > so, you could use type 'integer' instead of 'serial'. There is > also the possibility that the combination of column type 'integer' > and 'nullable=False" is handled as identical to 'serial', i.e. > autoincrement. I think I've seen that before but I'm not sure. > > On May 12, 2:57 pm, [EMAIL PROTECTED] wrote: > > hi. > > i have a sort-of multicolumn m2m association table, where the > > primary key is composed of all the links. At least 1 link > > (actualy, 2) is always present, but never all. so i am defining > > all of those columns with primary_key=True, nullable=True. > > which is fine in sqlite, but doesnot work in postgres - it > > autoincrements those columns without value. > > > > how can i fix this? > > would a default_value=0 - or something - work? > > > > (now as i look at it, at least as declaration, the whole primary > > key seems nullable - is this wrong?) > > > > ciao > > svil > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
