Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20f3b16

Browse files
committed
Some fixes for use extension like PGXS.
1 parentec008a8 commit20f3b16

File tree

4 files changed

+65
-15
lines changed

4 files changed

+65
-15
lines changed

‎expected/sr_plan.out

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,84 @@
1-
CREATE EXTENSION
2-
CREATE TABLE
3-
SET
1+
CREATE EXTENSION sr_plan;
2+
CREATE TABLE test_table(test_attr1 int, test_attr2 int);
3+
SET sr_plan.write_mode = true;
4+
SELECT * FROM test_table WHERE test_attr1 = _p(10);
45
test_attr1 | test_attr2
56
------------+------------
67
(0 rows)
78

9+
SELECT * FROM test_table WHERE test_attr1 = 10;
810
test_attr1 | test_attr2
911
------------+------------
1012
(0 rows)
1113

14+
SELECT * FROM test_table WHERE test_attr1 = 10;
1215
test_attr1 | test_attr2
1316
------------+------------
1417
(0 rows)
1518

16-
SET
19+
SET sr_plan.write_mode = false;
20+
SELECT * FROM test_table WHERE test_attr1 = _p(10);
1721
test_attr1 | test_attr2
1822
------------+------------
1923
(0 rows)
2024

25+
SELECT * FROM test_table WHERE test_attr1 = 10;
2126
test_attr1 | test_attr2
2227
------------+------------
2328
(0 rows)
2429

30+
SELECT * FROM test_table WHERE test_attr1 = 15;
2531
test_attr1 | test_attr2
2632
------------+------------
2733
(0 rows)
2834

29-
UPDATE 2
30-
psql:./sql/sr_plan.sql:16: WARNING: Ok we find saved plan.
35+
UPDATE sr_plans SET enable = true;
36+
SELECT * FROM test_table WHERE test_attr1 = _p(10);
37+
WARNING: Ok we find saved plan.
3138
test_attr1 | test_attr2
3239
------------+------------
3340
(0 rows)
3441

35-
psql:./sql/sr_plan.sql:17: WARNING: Ok we find saved plan.
42+
SELECT * FROM test_table WHERE test_attr1 = _p(15);
43+
WARNING: Ok we find saved plan.
3644
test_attr1 | test_attr2
3745
------------+------------
3846
(0 rows)
3947

40-
psql:./sql/sr_plan.sql:18: WARNING: Ok we find saved plan.
48+
SELECT * FROM test_table WHERE test_attr1 = 10;
49+
WARNING: Ok we find saved plan.
4150
test_attr1 | test_attr2
4251
------------+------------
4352
(0 rows)
53+
54+
SELECT * FROM test_table WHERE test_attr1 = 15;
55+
test_attr1 | test_attr2
56+
------------+------------
57+
(0 rows)
58+
59+
DROP TABLE test_table;
60+
WARNING: Invalidate saved plan with query:
61+
SELECT * FROM test_table WHERE test_attr1 = _p(10);
62+
WARNING: Invalidate saved plan with query:
63+
SELECT * FROM test_table WHERE test_attr1 = 10;
64+
CREATE TABLE test_table(test_attr1 int, test_attr2 int);
65+
SELECT * FROM test_table WHERE test_attr1 = _p(10);
66+
test_attr1 | test_attr2
67+
------------+------------
68+
(0 rows)
69+
70+
SELECT * FROM test_table WHERE test_attr1 = 10;
71+
test_attr1 | test_attr2
72+
------------+------------
73+
(0 rows)
74+
75+
SELECT * FROM test_table WHERE test_attr1 = 10;
76+
test_attr1 | test_attr2
77+
------------+------------
78+
(0 rows)
79+
80+
SELECT * FROM test_table WHERE test_attr1 = 15;
81+
test_attr1 | test_attr2
82+
------------+------------
83+
(0 rows)
84+

‎gen_parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, node_tags_structs):
5050
self.node_tags_structs=node_tags_structs
5151

5252
defvisit_Struct(self,node):
53-
if"include/nodes/"notinnode.coord.file:
53+
if"/nodes/"notinnode.coord.file:
5454
return
5555

5656
ifnode.decls:
@@ -69,7 +69,7 @@ def __init__(self, node_tag_enums):
6969
self.node_tag_enums=node_tag_enums
7070

7171
defvisit_Struct(self,node):
72-
if"include/nodes/"notinnode.coord.file:
72+
if"/nodes/"notinnode.coord.file:
7373
return
7474
#print(str(node.name)+" "+str(type(node)))
7575

@@ -99,9 +99,10 @@ def visit_Struct(self, node):
9999

100100
if__name__=="__main__":
101101
filename=sys.argv[1]
102-
postgres_include=""
102+
postgres_include=r""
103103
iflen(sys.argv)==3:
104-
postgres_include="-I"+sys.argv[2]
104+
postgres_include=r"-I"+sys.argv[2]
105+
105106
ast=parse_file(
106107
filename,
107108
use_cpp=True,

‎sql/sr_plan.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ SET sr_plan.write_mode = false;
99

1010
SELECT*FROM test_tableWHERE test_attr1= _p(10);
1111
SELECT*FROM test_tableWHERE test_attr1=10;
12-
SELECT*FROM test_tableWHERE test_attr1=10;
12+
SELECT*FROM test_tableWHERE test_attr1=15;
1313

1414
UPDATE sr_plansSET enable= true;
1515

1616
SELECT*FROM test_tableWHERE test_attr1= _p(10);
17+
SELECT*FROM test_tableWHERE test_attr1= _p(15);
1718
SELECT*FROM test_tableWHERE test_attr1=10;
18-
SELECT*FROM test_tableWHERE test_attr1=10;
19+
SELECT*FROM test_tableWHERE test_attr1=15;
20+
21+
DROPTABLE test_table;
22+
CREATETABLEtest_table(test_attr1int, test_attr2int);
1923

24+
SELECT*FROM test_tableWHERE test_attr1= _p(10);
25+
SELECT*FROM test_tableWHERE test_attr1=10;
26+
SELECT*FROM test_tableWHERE test_attr1=10;
27+
SELECT*FROM test_tableWHERE test_attr1=15;

‎sr_plan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ sr_plan_invalid_table(PG_FUNCTION_ARGS)
469469
}
470470
if (find_plan)
471471
{
472-
elog(WARNING,"Invalidate saved plan withquery_hash:%i",DatumGetInt32(search_values[0]));
472+
elog(WARNING,"Invalidate saved plan withquery:\n\t%s",TextDatumGetCString(search_values[2]));
473473
/* update existing entry */
474474
search_values[5]=BoolGetDatum(false);
475475
search_replaces[5]= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp