diff options
| author | Fabien Meghazi <fme@odoo.com> | 2017-07-27 12:05:57 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@odoo.com> | 2017-08-07 12:59:34 +0200 |
| commit | a867cce4069bf107a479045b06d41dcfd8b1f313 (patch) | |
| tree | 10e735ee0ff338f36d33fd25ef7d3e3b16b02569 /odoo/tools/sql.py | |
| parent | 623ea432681a8a0861fec6db0194f3911429efb2 (diff) | |
[IMP] sql: harvest less information from pg's information_schema (Fixes #18490)
Avoid `SELECT *` on `information_schema.columns` because specific access
right restrictions in the context of shared hosting (Heroku, OVH, ...)
might prevent a postgres user to read this field.
Diffstat (limited to 'odoo/tools/sql.py')
| -rw-r--r-- | odoo/tools/sql.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/odoo/tools/sql.py b/odoo/tools/sql.py index 6c783fe27e7..75f71b2e6b4 100644 --- a/odoo/tools/sql.py +++ b/odoo/tools/sql.py @@ -53,7 +53,11 @@ def table_columns(cr, tablename): """ Return a dict mapping column names to their configuration. The latter is a dict with the data from the table ``information_schema.columns``. """ - query = 'SELECT * FROM information_schema.columns WHERE table_name=%s' + # Do not select the field `character_octet_length` from `information_schema.columns` + # because specific access right restriction in the context of shared hosting (Heroku, OVH, ...) + # might prevent a postgres user to read this field. + query = '''SELECT column_name, udt_name, character_maximum_length, is_nullable + FROM information_schema.columns WHERE table_name=%s''' cr.execute(query, (tablename,)) return {row['column_name']: row for row in cr.dictfetchall()} |
