Hi Matt, > Everything works fantastically, except for when I try to add new > records to any model in the admin section. When I try to add any > record, I get a "null value in column "id" violates not-null > constraint" error. > > I'm completely new to postgres, so I imagine this is an error can be > addressed there. Any ideas on how I owuld go about doing so?
Postgres deals with auto-incrementing columns differently to MySQL. There's no "auto increment" as such. Look at the Postgres docs for the "serial" column time ( http://www.postgresql.org/docs/8.3/static/datatype-numeric.html#DATATYPE-SERIAL ). Basically if you create a table like this... CREATE TABLE mytable (id serial); ... that's equivalent of passing the column "auto increment" in MySQL. Postgres creates what they call a "sequence", which is basically a number generator. When you use the serial data type Postgres automatically links the column to the newly-created sequence and calls a function on the sequence to retrieve the next value whenever a new row is added. In your case you'll probably have to drop the id columns and recreate them. I'm not sure how Postgres will deal with adding a serial column to an existing table, but see how it goes (make backups first of course). That's the basic explanation anyway, see the docs for more info. Regards, Wayne --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---