Opened 19 years ago

Closed 19 years ago

Last modified 17 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

Description

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 by Adrian Holovaty, 19 years ago

priority: highnormal
Severity: majornormal

comment:2 by rmunn@…, 19 years ago

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 http://www.postgresql.org/docs/8.0/interactive/release-8-0.html for details.

comment:3 by Adrian Holovaty, 19 years ago

Resolution: wontfix
Status: newclosed

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

comment:4 by anonymous, 19 years ago

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 by Adrian Holovaty, 19 years ago

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 by wgunadi@…, 19 years ago

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