diff options
| author | Olivier Dony <odo@openerp.com> | 2012-12-07 17:48:40 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2012-12-07 17:48:40 +0100 |
| commit | fce8cf7a4c4cfffd5ce90b4188fe32b3d7e509e4 (patch) | |
| tree | 567a463862d64c36e030e77b6a72b60fb0fd2fc0 | |
| parent | 8d8a8e5185c0bf4a0391a053d4a0793f3799a654 (diff) | |
| parent | 82b17c82a45b1d39d98b85d2c1331834a64cba95 (diff) | |
[MERGE] orm: remove deprecated OIDS clause in CREATE TABLE sql, courtesy of Christophe Chauvet, Syleam
The WITH/WITHOUT OIDS option is deprecated and considered
useless since PostgreSQL 8.1:
http://www.postgresql.org/docs/8.4/static/runtime-config-compatible.html#GUC-DEFAULT-WITH-OIDS
"WITH OIDS" could actually hurt performance
bzr revid: odo@openerp.com-20121207164840-2huk2qs1k1mmea5p
| -rw-r--r-- | openerp/osv/orm.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index ef13253864b..1dd3552fc95 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -3234,7 +3234,7 @@ class BaseModel(object): def _create_table(self, cr): - cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) + cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id))' % (self._table,)) cr.execute(("COMMENT ON TABLE \"%s\" IS %%s" % self._table), (self._description,)) _schema.debug("Table '%s': created", self._table) @@ -3318,7 +3318,7 @@ class BaseModel(object): raise except_orm('Programming Error', ('Many2Many destination model does not exist: `%s`') % (f._obj,)) dest_model = self.pool.get(f._obj) ref = dest_model._table - cr.execute('CREATE TABLE "%s" ("%s" INTEGER NOT NULL, "%s" INTEGER NOT NULL, UNIQUE("%s","%s")) WITH OIDS' % (m2m_tbl, col1, col2, col1, col2)) + cr.execute('CREATE TABLE "%s" ("%s" INTEGER NOT NULL, "%s" INTEGER NOT NULL, UNIQUE("%s","%s"))' % (m2m_tbl, col1, col2, col1, col2)) # create foreign key references with ondelete=cascade, unless the targets are SQL views cr.execute("SELECT relkind FROM pg_class WHERE relkind IN ('v') AND relname=%s", (ref,)) if not cr.fetchall(): |
