Using HP Vertica: Cannot insert into or update IDENTITY/AUTO_INCREMENT column

396 views
Skip to first unread message

Stan Hu

unread,
Mar 22, 2013, 11:20:32 AM3/22/13
to django...@googlegroups.com
I'm been trying to get HP Vertica Community Edition working with Django by updating the django-vertica package.  For the most part, it is working.   Upon doing a manage.py syncdb, I enabled SQL debugging and get this error message:

DEBUG (0.002) INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, example.com, example.com); args=[1, 'example.com', 'example.com']
ProgrammingError: ('42601', '[42601] ERROR 2444:  Cannot insert into or update IDENTITY/AUTO_INCREMENT column "id"\n (2444) (SQLPrepare)')

It looks to me that Vertica does not want Django to be including the primary key in its INSERT call.  

What's the best way to fix this?  I see a few options:

1) Write a custom SQLInsertCompiler for the Vertica side and override as_sql() to do the right thing.

2) Modify SQLInsertCompiler in django.db.models.compiler to omit primary key fields.   I noticed that in django.db.backends, there is a variable "supports_unspecified_pk".  This doesn't appear to be used at all.

What's the right way?
Reply all
Reply to author
Forward
0 new messages