Skip to content

Commit 25c7c0e

Browse files
committed
Rewrite some code and tests
1 parent 176303b commit 25c7c0e

File tree

5 files changed

+114
-90
lines changed

5 files changed

+114
-90
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ endif
1717
PGXS := $(shell $(PG_CONFIG) --pgxs)
1818
include $(PGXS)
1919

20-
gen_parser:
20+
serialize.c deserialize.c: gen_parser.py nodes.h
2121
python gen_parser.py nodes.h `$(PG_CONFIG) --includedir-server`
2222
else
2323
subdir = contrib/sr_plan
2424
top_builddir = ../..
2525
include $(top_builddir)/src/Makefile.global
2626
include $(top_srcdir)/contrib/contrib-global.mk
2727

28-
gen_parser:
28+
serialize.c deserialize.c: gen_parser.py nodes.h
2929
python gen_parser.py nodes.h '$(top_srcdir)/src/include'
3030
endif
31+
32+
all: serialize.c

expected/sr_plan.out

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,21 @@ SELECT * FROM test_table WHERE test_attr1 = 15;
5353
------------+------------
5454
(0 rows)
5555

56+
SELECT enable, valid, query FROM sr_plans;
57+
enable | valid | query
58+
--------+-------+-----------------------------------------------------
59+
t | t | SELECT * FROM test_table WHERE test_attr1 = _p(10);
60+
t | t | SELECT * FROM test_table WHERE test_attr1 = 10;
61+
(2 rows)
62+
5663
DROP TABLE test_table;
57-
WARNING: Invalidate saved plan with query:
58-
SELECT * FROM test_table WHERE test_attr1 = _p(10);
59-
WARNING: Invalidate saved plan with query:
60-
SELECT * FROM test_table WHERE test_attr1 = 10;
64+
SELECT enable, valid, query FROM sr_plans;
65+
enable | valid | query
66+
--------+-------+-----------------------------------------------------
67+
f | f | SELECT * FROM test_table WHERE test_attr1 = _p(10);
68+
f | f | SELECT * FROM test_table WHERE test_attr1 = 10;
69+
(2 rows)
70+
6171
CREATE TABLE test_table(test_attr1 int, test_attr2 int);
6272
SELECT * FROM test_table WHERE test_attr1 = _p(10);
6373
test_attr1 | test_attr2

nodes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#define __attribute__(x)
22
#include "pg_config.h"
3-
4-
#if PG_VERSION_NUM < 110000
53
typedef int __int128
6-
#endif
74

85
#include "postgres.h"
96
#include "nodes/plannodes.h"

sql/sr_plan.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ SELECT * FROM test_table WHERE test_attr1 = _p(15);
1818
SELECT * FROM test_table WHERE test_attr1 = 10;
1919
SELECT * FROM test_table WHERE test_attr1 = 15;
2020

21+
SELECT enable, valid, query FROM sr_plans;
2122
DROP TABLE test_table;
23+
SELECT enable, valid, query FROM sr_plans;
24+
2225
CREATE TABLE test_table(test_attr1 int, test_attr2 int);
2326

2427
SELECT * FROM test_table WHERE test_attr1 = _p(10);

0 commit comments

Comments
 (0)