Skip to content

Commit 6d4f1da

Browse files
committed
[FIX] records: remove double quote_ident
The results of get_fk are quote_idented by default. Adding more quotes may result in sql syntax errors when the table names or column names are not standard.
1 parent 7681fac commit 6d4f1da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/records.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,15 @@ def remove_group(cr, xml_id=None, group_id=None):
514514
if on_delete_action == "r":
515515
if foreign_table not in standard_tables:
516516
cr.execute(
517-
'SELECT COUNT(*) FROM "{}" WHERE "{}" = %s'.format(foreign_table, foreign_column),
517+
'SELECT COUNT(*) FROM {} WHERE {} = %s'.format(foreign_table, foreign_column),
518518
(group_id,),
519519
)
520520
count = cr.fetchone()[0]
521521
if count:
522522
custom_tables.append((foreign_table, foreign_column, count))
523523
continue
524524

525-
query = 'DELETE FROM "{}" WHERE "{}" = %s'.format(foreign_table, foreign_column)
525+
query = 'DELETE FROM {} WHERE {} = %s'.format(foreign_table, foreign_column)
526526
query = cr.mogrify(query, (group_id,)).decode()
527527

528528
if column_exists(cr, foreign_table, "id"):

0 commit comments

Comments
 (0)