File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1221,13 +1221,16 @@ def duplicate_record(self, cascade=True):
1221
1221
## This can be done using * syntax without having to know the schema of the table
1222
1222
## (other than the name of the primary key). The trick is to create a temporary table
1223
1223
## using the "CREATE TABLE AS" syntax.
1224
- q = f'CREATE TEMPORARY TABLE tmp AS SELECT * FROM { self .table } WHERE { self .pk_column } ={ self .get_current (self .pk_column )} '
1224
+ pk = self .get_current (self .pk_column )
1225
+ description = self .get_description_for_pk (pk )
1226
+
1227
+ q = f'CREATE TEMPORARY TABLE tmp AS SELECT * FROM { self .table } WHERE { self .pk_column } ={ pk } '
1225
1228
self .driver .execute (q )
1226
1229
logger .debug (q )
1227
1230
q = f'UPDATE tmp SET { self .pk_column } = NULL'
1228
1231
self .driver .execute (q )
1229
1232
logger .debug (q )
1230
- q = f'UPDATE tmp SET { self .description_column } = "Copy of " || { self . description_column } '
1233
+ q = f'UPDATE tmp SET { self .description_column } = "Copy of { description } " '
1231
1234
self .driver .execute (q )
1232
1235
logger .debug (q )
1233
1236
q = f'INSERT INTO { self .table } SELECT * FROM tmp'
You can’t perform that action at this time.
0 commit comments