AGGREGATE: Fix crash with temporary transformations.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 17 Feb 2023 00:17:42 +0000 (16:17 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 17 Feb 2023 00:17:42 +0000 (16:17 -0800)
Thanks to Frans Houweling for reporting this bug at
https://lists.gnu.org/archive/html/bug-gnu-pspp/2023-01/msg00004.html

src/language/commands/aggregate.c
tests/language/commands/aggregate.at

index fac71b139e7c407db2511d7fd4da34ee25d1c2c9..24b22722a79eddc6ebc8d8b2219b05559e5aa6af 100644 (file)
@@ -278,7 +278,7 @@ cmd_aggregate (struct lexer *lexer, struct dataset *ds)
     {
       /* The active dataset will be replaced by the aggregated data,
          so TEMPORARY is moot. */
-      proc_cancel_temporary_transformations (ds);
+      proc_make_temporary_transformations_permanent (ds);
       proc_discard_output (ds);
       output = autopaging_writer_create (dict_get_proto (agr.dict));
     }
index a76870289b79df96bfa7a4c5d5dc868f66d47569..ac3ad929aa0a1fc2d212154da1fbeeb4a3e2a7ab 100644 (file)
@@ -511,3 +511,21 @@ aggregate.sps:16: error: AGGREGATE: Number of source variables (1) does not matc
       | ^~~~~~~~~"
 ])
 AT_CLEANUP
+
+AT_SETUP([AGGREGATE - temporary transformations])
+AT_DATA([aggregate.sps], [dnl
+DATA LIST FREE /quakes (F2.0).
+BEGIN DATA
+1 2 3 4 5 6 7 8 9 10
+END DATA.
+TEMPORARY.
+SELECT IF quakes GT 5.
+AGGREGATE OUTFILE = *  /nrecs=NU.
+LIST.
+])
+AT_CHECK([pspp -O format=csv aggregate.sps], [0], [dnl
+Table: Data List
+nrecs
+5
+])
+AT_CLEANUP