Skip to content

Commit bb1f456

Browse files
authored
Add truncation support to pg_query_summary() (#300)
1 parent cd20bb8 commit bb1f456

19 files changed

+1538
-659
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ ifeq ($(VALGRIND),1)
6363
override CFLAGS += -DUSE_VALGRIND
6464
override TEST_CFLAGS += -DUSE_VALGRIND
6565
endif
66+
ifeq ($(TEST_FAIL_FAST),1)
67+
override TEST_CFLAGS += -DTEST_FAIL_FAST=1
68+
endif
6669

6770
CLEANLIBS = $(ARLIB)
6871
CLEANOBJS = $(OBJ_FILES)
@@ -237,7 +240,7 @@ examples/normalize_error: examples/normalize_error.c $(ARLIB)
237240
examples/simple_plpgsql: examples/simple_plpgsql.c $(ARLIB)
238241
$(CC) $(TEST_CFLAGS) -o $@ -g examples/simple_plpgsql.c $(ARLIB) $(TEST_LDFLAGS)
239242

240-
TESTS = test/complex test/concurrency test/deparse test/fingerprint test/fingerprint_opts test/normalize test/normalize_utility test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split test/summary
243+
TESTS = test/complex test/concurrency test/deparse test/fingerprint test/fingerprint_opts test/normalize test/normalize_utility test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split test/summary test/summary_truncate
241244
test: $(TESTS)
242245
ifeq ($(VALGRIND),1)
243246
$(VALGRIND_MEMCHECK) test/complex || (cat test/valgrind.log && false)
@@ -254,6 +257,7 @@ ifeq ($(VALGRIND),1)
254257
$(VALGRIND_MEMCHECK) test/scan || (cat test/valgrind.log && false)
255258
$(VALGRIND_MEMCHECK) test/split || (cat test/valgrind.log && false)
256259
$(VALGRIND_MEMCHECK) test/summary || (cat test/valgrind.log && false)
260+
$(VALGRIND_MEMCHECK) test/summary_truncate || (cat test/valgrind.log && false)
257261
# Output-based tests
258262
$(VALGRIND_MEMCHECK) test/parse_plpgsql || (cat test/valgrind.log && false)
259263
diff -Naur test/plpgsql_samples.expected.json test/plpgsql_samples.actual.json
@@ -272,6 +276,7 @@ else
272276
test/scan
273277
test/split
274278
test/summary
279+
test/summary_truncate
275280
# Output-based tests
276281
test/parse_plpgsql
277282
diff -Naur test/plpgsql_samples.expected.json test/plpgsql_samples.actual.json
@@ -308,6 +313,10 @@ test/summary: test/framework/main.c test/summary.c test/summary_tests.c test/sum
308313
# We have "-Isrc/postgres/include" because this test uses pg_query_summary_direct
309314
$(CC) $(TEST_CFLAGS) -o $@ -Isrc/postgres/include test/framework/main.c test/summary.c $(ARLIB) $(TEST_LDFLAGS)
310315

316+
test/summary_truncate: test/framework/main.c test/summary_truncate.c $(ARLIB)
317+
# We have "-Isrc/postgres/include" because this test uses pg_query_summary_direct
318+
$(CC) $(TEST_CFLAGS) -o $@ -Isrc/postgres/include test/framework/main.c test/summary_truncate.c $(ARLIB) $(TEST_LDFLAGS)
319+
311320
test/parse_opts: test/parse_opts.c test/parse_opts_tests.c $(ARLIB)
312321
$(CC) $(TEST_CFLAGS) -o $@ test/parse_opts.c $(ARLIB) $(TEST_LDFLAGS)
313322

Makefile.msvc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ examples/normalize_error: examples/normalize_error.c $(ARLIB)
5050
examples/simple_plpgsql: examples/simple_plpgsql.c $(ARLIB)
5151
$(CC) $(CFLAGS) -o $@ examples/simple_plpgsql.c $(ARLIB)
5252

53-
TESTS = test/deparse test/fingerprint test/fingerprint_opts test/normalize test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split test/summary
53+
TESTS = test/deparse test/fingerprint test/fingerprint_opts test/normalize test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split test/summary test/summary_truncate
5454
test: $(TESTS)
5555
.\test\deparse
5656
.\test\fingerprint
@@ -63,6 +63,7 @@ test: $(TESTS)
6363
.\test\scan
6464
.\test\split
6565
.\test\summary
66+
.\test\summary_truncate
6667

6768
# Doesn't work because of C2026: string too big, trailing characters truncated
6869
#test/complex: test/complex.c $(ARLIB)
@@ -110,3 +111,6 @@ test/split: test/split.c test/split_tests.c $(ARLIB)
110111

111112
test/summary: test/framework/main.c test/summary.c test/summary_tests.c test/summary_tests_list.c $(ARLIB)
112113
$(CC) $(CFLAGS) -o $@ test/framework/main.c test/summary.c $(ARLIB)
114+
115+
test/summary_truncate: test/framework/main.c test/summary_truncate.c $(ARLIB)
116+
$(CC) $(CFLAGS) -o $@ test/framework/main.c test/summary_truncate.c $(ARLIB)

0 commit comments

Comments
 (0)