From 1a032ef72626002f4c6cab6d76326fda4af92360 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 11 Dec 2018 20:30:20 +0100 Subject: [PATCH] When copying a table, use a column for the INSERT..SELECT query only if it's not a virtual one. Closes #84. --- source/copytable.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/copytable.pas b/source/copytable.pas index e2aabb62..ff499e1e 100644 --- a/source/copytable.pas +++ b/source/copytable.pas @@ -440,7 +440,9 @@ begin CreateCode := CreateCode + Format(ClausePattern, [Column.SQLCode]); if AutoIncRemoved then Column.DefaultType := cdtAutoInc; - DataCols := DataCols + FConnection.QuoteIdent(Column.Name) + ', '; + // Use this column for the INSERT..SELECT query only if it's not a virtual one + if Column.Virtuality.IsEmpty then + DataCols := DataCols + FConnection.QuoteIdent(Column.Name) + ', '; end; // Indexes code