From f35f3ec546233c3ee0f45ce3bb7938d780f4415a Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 12 Oct 2011 15:44:00 +0200 Subject: [PATCH] Put quotes around sequence names Identifiers are quoted in trytond/backend/postgresql/table.py, sequence names must be quoted too (see http://www.postgresql.org/docs/8.4/static/functions-sequence.html) issue2176 review141002 --- trytond/backend/postgresql/table.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trytond/backend/postgresql/table.py b/trytond/backend/postgresql/table.py index aae348d833..7486c91a32 100644 --- a/trytond/backend/postgresql/table.py +++ b/trytond/backend/postgresql/table.py @@ -32,7 +32,7 @@ class TableHandler(TableHandlerInterface): if not self.history: self.cursor.execute('ALTER TABLE "%s" ' \ 'ADD COLUMN id INTEGER ' \ - 'DEFAULT nextval(\'%s\') NOT NULL' % \ + 'DEFAULT nextval(\'"%s"\') NOT NULL' % \ (self.table_name, self.sequence_name)) self.cursor.execute('ALTER TABLE "%s" ' \ 'ADD PRIMARY KEY(id)' % self.table_name) @@ -43,17 +43,17 @@ class TableHandler(TableHandlerInterface): if self.history and not '__id' in self._columns: self.cursor.execute('ALTER TABLE "%s" ' \ 'ADD COLUMN __id INTEGER ' \ - 'DEFAULT nextval(\'%s\') NOT NULL' % \ + 'DEFAULT nextval(\'"%s"\') NOT NULL' % \ (self.table_name, self.sequence_name)) self.cursor.execute('ALTER TABLE "%s" ' \ 'ADD PRIMARY KEY(__id)' % self.table_name) if self.history: self.cursor.execute('ALTER TABLE "%s" ' \ - 'ALTER __id SET DEFAULT nextval(\'%s\')' % (self.table_name, + 'ALTER __id SET DEFAULT nextval(\'"%s"\')' % (self.table_name, self.sequence_name)) else: self.cursor.execute('ALTER TABLE "%s" ' \ - 'ALTER id SET DEFAULT nextval(\'%s\')' % (self.table_name, + 'ALTER id SET DEFAULT nextval(\'"%s"\')' % (self.table_name, self.sequence_name)) self._update_definitions()