Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#215 closed defect (wontfix)

Need to generate postgresql tables WITHOUT OIDS by default

Reported by: wgunadi@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: 1.1
Severity: normal Keywords: OIDS
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When generating tables in Postgresql, django doesn't specify WITHOUT OIDS, which in Postgresql 7.4 or older (don't know about 8) results in tables that consumes the installation-wide OIDS.

Most of the time this is unnecessary and undesirable.
It would be good if the user is given a choice to specify WITH OIDS if they really know what they are doing.

Change History (6)

comment:1 Changed 14 years ago by Adrian Holovaty

priority: highnormal
Severity: majornormal

comment:2 Changed 14 years ago by rmunn@…

WITH OIDS is still the default in PostgreSQL 8.0; WITHOUT OIDS will become the default in PostgreSQL 8.1. See the "Deprecated Features" section of for details.

comment:3 Changed 14 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed

Django should just do whatever the default is for PostgreSQL. If you want to specify WITHOUT OIDS, you can run sqlall [app] and manually edit the SQL.

comment:4 Changed 14 years ago by anonymous

Ok, this is the part that I am not clear.
So according to what you said, I can edit the output of sqlall [myapp] and run it manually to create the tables, correct?
How can django recognize that those newly created tables are designated for myapp and not for other apps?

comment:5 Changed 14 years ago by Adrian Holovaty

By default, Django puts a prefix on the database table names, to avoid conflicts with DB tables in other apps. You can manually specify table names by setting db_table on your model.

comment:6 Changed 14 years ago by wgunadi@…

I beg you to reconsider your decision. If postgresql has a bad default (as is proven by their decision to negate it in 8.1), we shouldn't follow them.

I don't think you'd want users to *have to* edit the output of sqlall manually, isn't one of django's goal is to be as less pain for its users?

The django-admin has to already know the distinction between Postgresql and other databases when it's generating the sql for the tables, so I don't see any harm in adding a parameter that allows users to control whether the string "WITHOUT OIDS" gets generated after each "CREATE TABLE" or not.

Note: See TracTickets for help on using tickets.
Back to Top