($INBOX_DIR/description missing)
help / color / mirror / Atom feed[PATCH v3 7/7] Allow to print raw parse tree.
24+ messages / 3 participants
[nested] [flat]
* [PATCH v3 7/7] Allow to print raw parse tree.
@ 2023-07-26 10:49 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-07-26 10:49 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 36cc99ec9c..c01e90f735 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Wed_Jul_26_21_21_34_2023_317)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v4 7/7] Allow to print raw parse tree.
@ 2023-08-09 07:56 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-08-09 07:56 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 36cc99ec9c..c01e90f735 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Wed_Aug__9_17_41_12_2023_134)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v5 7/7] Allow to print raw parse tree.
@ 2023-09-02 06:32 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-09-02 06:32 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index e4756f8be2..fc8efa915b 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Sat_Sep__2_15_52_35_2023_273)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v6 7/7] Allow to print raw parse tree.
@ 2023-09-12 05:22 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-09-12 05:22 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 21b9763183..3e3653816e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -651,6 +651,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Tue_Sep_12_15_18_43_2023_359)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v7 7/7] Allow to print raw parse tree.
@ 2023-09-22 04:53 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-09-22 04:53 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 21b9763183..3e3653816e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -651,6 +651,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Fri_Sep_22_14_16_40_2023_530)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v8 7/7] Allow to print raw parse tree.
@ 2023-09-25 05:01 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-09-25 05:01 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 21b9763183..3e3653816e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -651,6 +651,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Mon_Sep_25_14_26_30_2023_752)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v9 7/7] Allow to print raw parse tree.
@ 2023-10-04 05:51 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-10-04 05:51 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 21b9763183..3e3653816e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -651,6 +651,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Wed_Oct__4_15_03_28_2023_821)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v10 7/7] Allow to print raw parse tree.
@ 2023-10-22 02:22 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-10-22 02:22 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c900427ecf..fa5d862604 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -652,6 +652,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Sun_Oct_22_11_39_20_2023_140)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v11 7/7] Allow to print raw parse tree.
@ 2023-11-08 06:57 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-11-08 06:57 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 6a070b5d8c..beb528f526 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -652,6 +652,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Wed_Nov__8_16_37_05_2023_872)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v12 7/7] Allow to print raw parse tree.
@ 2023-12-04 11:23 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2023-12-04 11:23 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 7298a187d1..b43afad0be 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -652,6 +652,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Fri_Dec__8_10_16_13_2023_489)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v13 8/8] Allow to print raw parse tree.
@ 2024-01-22 09:45 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-01-22 09:45 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 1a34bd3715..68f5cf3667 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -652,6 +652,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Mon_Jan_22_19_26_18_2024_011)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v14 8/8] Allow to print raw parse tree.
@ 2024-02-28 13:59 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-02-28 13:59 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 59ab812d2e..e433ddafe0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -652,6 +652,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Thu_Feb_29_09_19_54_2024_640)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v15 8/8] Allow to print raw parse tree.
@ 2024-03-28 10:30 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-03-28 10:30 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 76f48b13d2..b93000adc4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Thu_Mar_28_19_59_25_2024_076)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v16 8/8] Allow to print raw parse tree.
@ 2024-04-12 06:49 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-04-12 06:49 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 76f48b13d2..b93000adc4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Fri_Apr_12_16_09_08_2024_262)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v17 8/8] Allow to print raw parse tree.
@ 2024-04-28 11:00 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-04-28 11:00 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 2dff28afce..db6e91f5d6 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Sun_Apr_28_20_28_26_2024_444)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v18 8/8] Allow to print raw parse tree.
@ 2024-05-11 07:11 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-05-11 07:11 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 2dff28afce..db6e91f5d6 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Sat_May_11_16_23_07_2024_789)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v19 8/8] Allow to print raw parse tree.
@ 2024-05-14 23:26 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-05-14 23:26 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 2dff28afce..db6e91f5d6 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Wed_May_15_09_02_03_2024_008)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v20 8/8] Allow to print raw parse tree.
@ 2024-05-24 02:26 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-05-24 02:26 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 45a3794b8e..ecbf8e7999 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -653,6 +653,10 @@ pg_parse_query(const char *query_string)
}
#endif
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Fri_May_24_11_39_19_2024_763)----
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Normalize queries starting with SET for pg_stat_statements
@ 2024-08-13 14:54 Greg Sabino Mullane <[email protected]>
2024-08-19 06:28 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Greg Sabino Mullane @ 2024-08-13 14:54 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: pgsql-hackers
Now that I've spent some time away from this, I'm reconsidering why we are
going through all the trouble of semi-jumbling SET statements. Maybe we
just keep it simple and everything becomes "SET myvar = $1" or even "SET
myvar" full stop? I'm having a hard time finding a real-world situation in
which we need to distinguish different SET/RESET items within
pg_stat_statements.
Cheers,
Greg
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Normalize queries starting with SET for pg_stat_statements
2024-08-13 14:54 Re: Normalize queries starting with SET for pg_stat_statements Greg Sabino Mullane <[email protected]>
@ 2024-08-19 06:28 ` Michael Paquier <[email protected]>
2024-09-24 07:57 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Michael Paquier @ 2024-08-19 06:28 UTC (permalink / raw)
To: Greg Sabino Mullane <[email protected]>; +Cc: pgsql-hackers
On Tue, Aug 13, 2024 at 10:54:34AM -0400, Greg Sabino Mullane wrote:
> Now that I've spent some time away from this, I'm reconsidering why we are
> going through all the trouble of semi-jumbling SET statements. Maybe we
> just keep it simple and everything becomes "SET myvar = $1" or even "SET
> myvar" full stop?
Showing a dollar-character to show the fact that we have a value
behind makes the post sense to me.
> I'm having a hard time finding a real-world situation in
> which we need to distinguish different SET/RESET items within
> pg_stat_statements.
I'm -1 on keeping the distinction, and AFAIK it's not really different
with the underlying problems that we need to solve for SET TRANSACTION
and the kind, no?
FWIW, I'm OK with hiding the value when it comes to a SET clause in a
CREATE FUNCTION. We already hide the contents of SQL queries inside
the SQL functions when these are queries that can be normalized, so
there is a kind of thin argument for consistency, or something close
to that.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Normalize queries starting with SET for pg_stat_statements
2024-08-13 14:54 Re: Normalize queries starting with SET for pg_stat_statements Greg Sabino Mullane <[email protected]>
2024-08-19 06:28 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
@ 2024-09-24 07:57 ` Michael Paquier <[email protected]>
2024-09-25 03:10 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Michael Paquier @ 2024-09-24 07:57 UTC (permalink / raw)
To: Greg Sabino Mullane <[email protected]>; +Cc: pgsql-hackers
On Mon, Aug 19, 2024 at 03:28:52PM +0900, Michael Paquier wrote:
> FWIW, I'm OK with hiding the value when it comes to a SET clause in a
> CREATE FUNCTION. We already hide the contents of SQL queries inside
> the SQL functions when these are queries that can be normalized, so
> there is a kind of thin argument for consistency, or something close
> to that.
This thread was one of the things I wanted to look at for this commit
fest because that's an issue I have on my stack for some time. And
here you go with a revised patch set.
First, the TAP test proposed upthread is not required, so let's remove
it and rely on pg_stat_statements. It is true that there are a lot of
coverage holes in pg_stat_statements with the various flavors of SET
queries. The TAP test was able to cover a good part of them, still
missed a few spots.
A second thing is that like you I have settled down to a custom
implementation for VariableSetStmt because we have too many grammar
patterns, some of them with values nested in clauses (SET TIME ZONE is
one example), and we should report the grammar keywords without
hardcoding a location. Like for the TIME ZONE part, this comes to a
limitation because it is not possible to normalize the case of SET
TIME ZONE 'value' without some refactoring of gram.y. Perhaps we
could do that in the long-term, but I come down to the fact that I'm
also OK with letting things as they are in the patch, because the
primary case I want to tackle at the SET name = value patterns, and
SET TIME ZONE is just a different flavor of that that can be
translated as well to the most common "name = value" pattern. A
second case is SET SESSION CHARACTERISTICS AS TRANSACTION with its
list of options. Contrary to the patch proposed, I don't think that
it is a good idea to hide that arguments may be included in the
jumbling in the custom function, so I have added one field in
VariableSetStmt to do that, and documented why we need the field in
parsenodes.h. That strikes me as the best balance, and that's going
to be hard to miss each time somebody adds a new grammar for
VariableSetStmt. That's very unlikely at this stage of the project,
but who knows, people like fancy new features.
Attached are two patches:
- 0001 adds a bunch of tests in pg_stat_statements, to cover the SET
patterns. (typo in commit message of this patch, will fix later)
- 0002 is the addition of the normalization. It is possible to see
how the normalization changes things in pg_stat_statements.
0001 is straight-forward and that was I think a mistake to not include
that from the start when I've expanded these tests in the v16 cycle
(well, time..). 0002 also is quite conservative at the end, and this
design can be used to tune easily the jumbling patterns from gram.y
depending on the feedback we'd get.
--
Michael
Attachments:
[text/x-diff] v2-0001-pg_stta_statements-Expand-tests-with-SET-grammar.patch (10.2K, ../../[email protected]/2-v2-0001-pg_stta_statements-Expand-tests-with-SET-grammar.patch)
download | inline diff:
From 919e03ec0d0673183a9266c1ef16893754005c7e Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Tue, 24 Sep 2024 16:19:08 +0900
Subject: [PATCH v2 1/2] pg_stta_statements: Expand tests with SET grammar
There are many grammar flavors that depend on the parse node
VariableSetStmt. This closes the gap in pg_stat_statements by providing
test coverage for all of them (well, a large majority of them, at
least).
---
.../pg_stat_statements/expected/utility.out | 100 ++++++++++++++++--
contrib/pg_stat_statements/sql/utility.sql | 50 ++++++++-
2 files changed, 140 insertions(+), 10 deletions(-)
diff --git a/contrib/pg_stat_statements/expected/utility.out b/contrib/pg_stat_statements/expected/utility.out
index fa738b5c00..58ba2018c1 100644
--- a/contrib/pg_stat_statements/expected/utility.out
+++ b/contrib/pg_stat_statements/expected/utility.out
@@ -66,7 +66,8 @@ DROP SERVER server_stats;
DROP FOREIGN DATA WRAPPER wrapper_stats;
-- Functions
CREATE FUNCTION func_stats(a text DEFAULT 'a_data', b text DEFAULT lower('b_data'))
- RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL;
+ RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL
+ SET work_mem = '256kB';
DROP FUNCTION func_stats;
-- Rules
CREATE TABLE tab_rule_stats (a int, b int);
@@ -106,7 +107,8 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | CREATE FOREIGN DATA WRAPPER wrapper_stats
1 | 0 | CREATE FOREIGN TABLE foreign_stats (a int) SERVER server_stats
1 | 0 | CREATE FUNCTION func_stats(a text DEFAULT 'a_data', b text DEFAULT lower('b_data'))+
- | | RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL
+ | | RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL +
+ | | SET work_mem = '256kB'
1 | 0 | CREATE FUNCTION trigger_func_stats () RETURNS trigger LANGUAGE plpgsql +
| | AS $$ BEGIN return OLD; end; $$
1 | 0 | CREATE INDEX pt_stats2_index ON ONLY pt_stats2 (a)
@@ -551,12 +553,26 @@ SELECT pg_stat_statements_reset() IS NOT NULL AS t;
-- SET statements.
-- These use two different strings, still they count as one entry.
+CREATE ROLE regress_stat_set_1;
+CREATE ROLE regress_stat_set_2;
SET work_mem = '1MB';
Set work_mem = '1MB';
SET work_mem = '2MB';
+SET work_mem = DEFAULT;
+SET work_mem TO DEFAULT;
+SET work_mem FROM CURRENT;
+BEGIN;
+SET LOCAL work_mem = '128kB';
+SET LOCAL work_mem = '256kB';
+SET LOCAL work_mem = DEFAULT;
+SET LOCAL work_mem TO DEFAULT;
+SET LOCAL work_mem FROM CURRENT;
+COMMIT;
RESET work_mem;
SET enable_seqscan = off;
SET enable_seqscan = on;
+SET SESSION work_mem = '300kB';
+SET SESSION work_mem = '400kB';
RESET enable_seqscan;
-- SET TRANSACTION ISOLATION
BEGIN;
@@ -564,33 +580,82 @@ SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
COMMIT;
--- SET SESSION CHARACTERISTICS
+-- SET SESSION AUTHORIZATION
SET SESSION SESSION AUTHORIZATION DEFAULT;
+SET SESSION AUTHORIZATION 'regress_stat_set_1';
+SET SESSION AUTHORIZATION 'regress_stat_set_2';
RESET SESSION AUTHORIZATION;
BEGIN;
SET LOCAL SESSION AUTHORIZATION DEFAULT;
+SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_1';
+SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_2';
RESET SESSION AUTHORIZATION;
COMMIT;
+-- SET SESSION CHARACTERISTICS
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ ONLY;
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE;
+-- SET XML OPTION
+SET XML OPTION DOCUMENT;
+SET XML OPTION CONTENT;
+-- SET TIME ZONE
+SET TIME ZONE 'America/New_York';
+SET TIME ZONE 'Asia/Tokyo';
+SET TIME ZONE DEFAULT;
+SET TIME ZONE LOCAL;
+SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0';
+RESET TIME ZONE;
+-- SET NAMES -- client_encoding
+SET NAMES 'latin1';
+SET NAMES 'latin2';
SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
- calls | rows | query
--------+------+----------------------------------------------------
- 2 | 0 | BEGIN
- 2 | 0 | COMMIT
+ calls | rows | query
+-------+------+------------------------------------------------------------------
+ 3 | 0 | BEGIN
+ 3 | 0 | COMMIT
+ 1 | 0 | CREATE ROLE regress_stat_set_1
+ 1 | 0 | CREATE ROLE regress_stat_set_2
2 | 0 | RESET SESSION AUTHORIZATION
+ 1 | 0 | RESET TIME ZONE
1 | 0 | RESET enable_seqscan
1 | 0 | RESET work_mem
1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
+ 1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_1'
+ 1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_2'
1 | 0 | SET LOCAL SESSION AUTHORIZATION DEFAULT
+ 1 | 0 | SET LOCAL work_mem = '128kB'
+ 1 | 0 | SET LOCAL work_mem = '256kB'
+ 2 | 0 | SET LOCAL work_mem = DEFAULT
+ 1 | 0 | SET LOCAL work_mem FROM CURRENT
+ 1 | 0 | SET NAMES 'latin1'
+ 1 | 0 | SET NAMES 'latin2'
+ 1 | 0 | SET SESSION AUTHORIZATION 'regress_stat_set_1'
+ 1 | 0 | SET SESSION AUTHORIZATION 'regress_stat_set_2'
+ 1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY
+ 1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ ONLY
+ 1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE
1 | 0 | SET SESSION SESSION AUTHORIZATION DEFAULT
+ 1 | 0 | SET SESSION work_mem = '300kB'
+ 1 | 0 | SET SESSION work_mem = '400kB'
+ 1 | 0 | SET TIME ZONE 'America/New_York'
+ 1 | 0 | SET TIME ZONE 'Asia/Tokyo'
+ 1 | 0 | SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'
+ 2 | 0 | SET TIME ZONE DEFAULT
1 | 0 | SET TRANSACTION ISOLATION LEVEL READ COMMITTED
1 | 0 | SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
1 | 0 | SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
+ 1 | 0 | SET XML OPTION CONTENT
+ 1 | 0 | SET XML OPTION DOCUMENT
1 | 0 | SET enable_seqscan = off
1 | 0 | SET enable_seqscan = on
2 | 0 | SET work_mem = '1MB'
1 | 0 | SET work_mem = '2MB'
-(15 rows)
+ 2 | 0 | SET work_mem = DEFAULT
+ 1 | 0 | SET work_mem FROM CURRENT
+(41 rows)
+DROP ROLE regress_stat_set_1;
+DROP ROLE regress_stat_set_2;
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
t
---
@@ -664,3 +729,22 @@ SELECT pg_stat_statements_reset() IS NOT NULL AS t;
t
(1 row)
+-- Special cases. Keep these ones at the end to avoid issues in this script.
+SET SCHEMA 'foo';
+SET SCHEMA 'public';
+RESET ALL;
+SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
+ calls | rows | query
+-------+------+----------------------------------------------------
+ 1 | 0 | RESET ALL
+ 1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
+ 1 | 0 | SET SCHEMA 'foo'
+ 1 | 0 | SET SCHEMA 'public'
+(4 rows)
+
+SELECT pg_stat_statements_reset() IS NOT NULL AS t;
+ t
+---
+ t
+(1 row)
+
diff --git a/contrib/pg_stat_statements/sql/utility.sql b/contrib/pg_stat_statements/sql/utility.sql
index 4f7afece1d..20893c6b34 100644
--- a/contrib/pg_stat_statements/sql/utility.sql
+++ b/contrib/pg_stat_statements/sql/utility.sql
@@ -47,7 +47,8 @@ DROP FOREIGN DATA WRAPPER wrapper_stats;
-- Functions
CREATE FUNCTION func_stats(a text DEFAULT 'a_data', b text DEFAULT lower('b_data'))
- RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL;
+ RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL
+ SET work_mem = '256kB';
DROP FUNCTION func_stats;
-- Rules
@@ -277,12 +278,26 @@ SELECT pg_stat_statements_reset() IS NOT NULL AS t;
-- SET statements.
-- These use two different strings, still they count as one entry.
+CREATE ROLE regress_stat_set_1;
+CREATE ROLE regress_stat_set_2;
SET work_mem = '1MB';
Set work_mem = '1MB';
SET work_mem = '2MB';
+SET work_mem = DEFAULT;
+SET work_mem TO DEFAULT;
+SET work_mem FROM CURRENT;
+BEGIN;
+SET LOCAL work_mem = '128kB';
+SET LOCAL work_mem = '256kB';
+SET LOCAL work_mem = DEFAULT;
+SET LOCAL work_mem TO DEFAULT;
+SET LOCAL work_mem FROM CURRENT;
+COMMIT;
RESET work_mem;
SET enable_seqscan = off;
SET enable_seqscan = on;
+SET SESSION work_mem = '300kB';
+SET SESSION work_mem = '400kB';
RESET enable_seqscan;
-- SET TRANSACTION ISOLATION
BEGIN;
@@ -290,15 +305,38 @@ SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
COMMIT;
--- SET SESSION CHARACTERISTICS
+-- SET SESSION AUTHORIZATION
SET SESSION SESSION AUTHORIZATION DEFAULT;
+SET SESSION AUTHORIZATION 'regress_stat_set_1';
+SET SESSION AUTHORIZATION 'regress_stat_set_2';
RESET SESSION AUTHORIZATION;
BEGIN;
SET LOCAL SESSION AUTHORIZATION DEFAULT;
+SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_1';
+SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_2';
RESET SESSION AUTHORIZATION;
COMMIT;
+-- SET SESSION CHARACTERISTICS
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ ONLY;
+SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE;
+-- SET XML OPTION
+SET XML OPTION DOCUMENT;
+SET XML OPTION CONTENT;
+-- SET TIME ZONE
+SET TIME ZONE 'America/New_York';
+SET TIME ZONE 'Asia/Tokyo';
+SET TIME ZONE DEFAULT;
+SET TIME ZONE LOCAL;
+SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0';
+RESET TIME ZONE;
+-- SET NAMES -- client_encoding
+SET NAMES 'latin1';
+SET NAMES 'latin2';
SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
+DROP ROLE regress_stat_set_1;
+DROP ROLE regress_stat_set_2;
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
--
@@ -329,3 +367,11 @@ DROP TABLE pgss_ctas;
DROP TABLE pgss_select_into;
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
+
+-- Special cases. Keep these ones at the end to avoid issues in this script.
+SET SCHEMA 'foo';
+SET SCHEMA 'public';
+RESET ALL;
+SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
+
+SELECT pg_stat_statements_reset() IS NOT NULL AS t;
--
2.45.2
[text/x-diff] v2-0002-Normalize-queries-starting-with-SET.patch (12.8K, ../../[email protected]/3-v2-0002-Normalize-queries-starting-with-SET.patch)
download | inline diff:
From 167959884d8a336c34617b61e55c591760fd54ab Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Tue, 24 Sep 2024 16:46:58 +0900
Subject: [PATCH v2 2/2] Normalize queries starting with SET
---
src/include/nodes/parsenodes.h | 20 +++++++++++++---
src/backend/nodes/queryjumblefuncs.c | 19 +++++++++++++++
src/backend/parser/gram.y | 24 +++++++++++++++++++
contrib/pg_stat_statements/expected/dml.out | 2 +-
.../expected/level_tracking.out | 2 +-
.../pg_stat_statements/expected/utility.out | 23 +++++++-----------
contrib/pg_stat_statements/expected/wal.out | 2 +-
7 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index e62ce1b753..dd8238c40f 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2616,11 +2616,25 @@ typedef enum VariableSetKind
typedef struct VariableSetStmt
{
+ pg_node_attr(custom_query_jumble)
+
NodeTag type;
VariableSetKind kind;
- char *name; /* variable to be set */
- List *args; /* List of A_Const nodes */
- bool is_local; /* SET LOCAL? */
+ /* variable to be set */
+ char *name;
+ /* List of A_Const nodes */
+ List *args;
+
+ /*
+ * True if arguments should be accounted for in query jumbling. We use a
+ * separate flag rather than query_jumble_ignore on "args" as several
+ * grammar flavors of SET rely on a list of values that are parsed
+ * directly from the grammar's keywords.
+ */
+ bool include_args;
+ /* SET LOCAL? */
+ bool is_local;
+ ParseLoc location pg_node_attr(query_jumble_location);
} VariableSetStmt;
/* ----------------------
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index 129fb44709..2db65cb384 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -57,6 +57,7 @@ static void RecordConstLocation(JumbleState *jstate, int location);
static void _jumbleNode(JumbleState *jstate, Node *node);
static void _jumbleA_Const(JumbleState *jstate, Node *node);
static void _jumbleList(JumbleState *jstate, Node *node);
+static void _jumbleVariableSetStmt(JumbleState *jstate, Node *node);
/*
* Given a possibly multi-statement source string, confine our attention to the
@@ -352,3 +353,21 @@ _jumbleA_Const(JumbleState *jstate, Node *node)
}
}
}
+
+static void
+_jumbleVariableSetStmt(JumbleState *jstate, Node *node)
+{
+ VariableSetStmt *expr = (VariableSetStmt *) node;
+
+ JUMBLE_FIELD(kind);
+ JUMBLE_STRING(name);
+
+ /*
+ * Account for the list of arguments in query jumbling only if told by the
+ * parser.
+ */
+ if (expr->include_args)
+ JUMBLE_NODE(args);
+ JUMBLE_FIELD(is_local);
+ JUMBLE_LOCATION(location);
+}
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index ab304ca989..b451d4db94 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -1647,6 +1647,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
+ n->include_args = true;
+ n->location = -1;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
@@ -1656,6 +1658,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
+ n->include_args = true;
+ n->location = -1;
$$ = n;
}
| set_rest_more
@@ -1669,6 +1673,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name '=' var_list
@@ -1678,6 +1683,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name TO DEFAULT
@@ -1686,6 +1692,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| var_name '=' DEFAULT
@@ -1694,6 +1701,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
;
@@ -1706,6 +1714,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_CURRENT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes mandated by SQL standard: */
@@ -1715,6 +1724,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "timezone";
+ n->location = -1;
+ n->include_args = true;
if ($3 != NULL)
n->args = list_make1($3);
else
@@ -1736,6 +1747,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| NAMES opt_encoding
@@ -1744,6 +1756,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "client_encoding";
+ n->location = @2;
if ($2 != NULL)
n->args = list_make1(makeStringConst($2, @2));
else
@@ -1757,6 +1770,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "role";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| SESSION AUTHORIZATION NonReservedWord_or_Sconst
@@ -1766,6 +1780,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "session_authorization";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
| SESSION AUTHORIZATION DEFAULT
@@ -1774,6 +1789,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
| XML_P OPTION document_or_content
@@ -1783,6 +1799,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "xmloption";
n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3));
+ n->include_args = true;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes invented by PostgreSQL: */
@@ -1793,6 +1811,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION SNAPSHOT";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
;
@@ -1900,6 +1919,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "timezone";
+ n->location = -1;
$$ = n;
}
| TRANSACTION ISOLATION LEVEL
@@ -1908,6 +1928,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "transaction_isolation";
+ n->location = -1;
$$ = n;
}
| SESSION AUTHORIZATION
@@ -1916,6 +1937,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
;
@@ -1927,6 +1949,7 @@ generic_reset:
n->kind = VAR_RESET;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| ALL
@@ -1934,6 +1957,7 @@ generic_reset:
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_RESET_ALL;
+ n->location = -1;
$$ = n;
}
;
diff --git a/contrib/pg_stat_statements/expected/dml.out b/contrib/pg_stat_statements/expected/dml.out
index f6ac8da5ca..acc2c5e524 100644
--- a/contrib/pg_stat_statements/expected/dml.out
+++ b/contrib/pg_stat_statements/expected/dml.out
@@ -82,7 +82,7 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
2 | 4 | SELECT * FROM pgss_dml_tab WHERE a > $1 ORDER BY a
1 | 8 | SELECT * FROM pgss_dml_tab WHERE a IN ($1, $2, $3, $4, $5)
1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- 1 | 0 | SET pg_stat_statements.track_utility = FALSE
+ 1 | 0 | SET pg_stat_statements.track_utility = $1
6 | 6 | UPDATE pgss_dml_tab SET b = $1 WHERE a = $2
1 | 3 | UPDATE pgss_dml_tab SET b = $1 WHERE a > $2
(10 rows)
diff --git a/contrib/pg_stat_statements/expected/level_tracking.out b/contrib/pg_stat_statements/expected/level_tracking.out
index d8dd8a2dee..bb65e98ce0 100644
--- a/contrib/pg_stat_statements/expected/level_tracking.out
+++ b/contrib/pg_stat_statements/expected/level_tracking.out
@@ -64,7 +64,7 @@ SELECT toplevel, calls, query FROM pg_stat_statements
| | END; $$
f | 1 | SELECT $1::TEXT
t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- t | 1 | SET pg_stat_statements.track = 'all'
+ t | 1 | SET pg_stat_statements.track = $1
(7 rows)
-- Procedure with multiple utility statements.
diff --git a/contrib/pg_stat_statements/expected/utility.out b/contrib/pg_stat_statements/expected/utility.out
index 58ba2018c1..3d58543fdf 100644
--- a/contrib/pg_stat_statements/expected/utility.out
+++ b/contrib/pg_stat_statements/expected/utility.out
@@ -108,7 +108,7 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | CREATE FOREIGN TABLE foreign_stats (a int) SERVER server_stats
1 | 0 | CREATE FUNCTION func_stats(a text DEFAULT 'a_data', b text DEFAULT lower('b_data'))+
| | RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL +
- | | SET work_mem = '256kB'
+ | | SET work_mem = $1
1 | 0 | CREATE FUNCTION trigger_func_stats () RETURNS trigger LANGUAGE plpgsql +
| | AS $$ BEGIN return OLD; end; $$
1 | 0 | CREATE INDEX pt_stats2_index ON ONLY pt_stats2 (a)
@@ -623,20 +623,16 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_1'
1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_2'
1 | 0 | SET LOCAL SESSION AUTHORIZATION DEFAULT
- 1 | 0 | SET LOCAL work_mem = '128kB'
- 1 | 0 | SET LOCAL work_mem = '256kB'
+ 2 | 0 | SET LOCAL work_mem = $1
2 | 0 | SET LOCAL work_mem = DEFAULT
1 | 0 | SET LOCAL work_mem FROM CURRENT
- 1 | 0 | SET NAMES 'latin1'
- 1 | 0 | SET NAMES 'latin2'
+ 2 | 0 | SET NAMES $1
1 | 0 | SET SESSION AUTHORIZATION 'regress_stat_set_1'
1 | 0 | SET SESSION AUTHORIZATION 'regress_stat_set_2'
1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY
1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ ONLY
1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE
1 | 0 | SET SESSION SESSION AUTHORIZATION DEFAULT
- 1 | 0 | SET SESSION work_mem = '300kB'
- 1 | 0 | SET SESSION work_mem = '400kB'
1 | 0 | SET TIME ZONE 'America/New_York'
1 | 0 | SET TIME ZONE 'Asia/Tokyo'
1 | 0 | SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'
@@ -646,13 +642,11 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
1 | 0 | SET XML OPTION CONTENT
1 | 0 | SET XML OPTION DOCUMENT
- 1 | 0 | SET enable_seqscan = off
- 1 | 0 | SET enable_seqscan = on
- 2 | 0 | SET work_mem = '1MB'
- 1 | 0 | SET work_mem = '2MB'
+ 2 | 0 | SET enable_seqscan = $1
+ 5 | 0 | SET work_mem = $1
2 | 0 | SET work_mem = DEFAULT
1 | 0 | SET work_mem FROM CURRENT
-(41 rows)
+(35 rows)
DROP ROLE regress_stat_set_1;
DROP ROLE regress_stat_set_2;
@@ -738,9 +732,8 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
-------+------+----------------------------------------------------
1 | 0 | RESET ALL
1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- 1 | 0 | SET SCHEMA 'foo'
- 1 | 0 | SET SCHEMA 'public'
-(4 rows)
+ 2 | 0 | SET SCHEMA $1
+(3 rows)
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
t
diff --git a/contrib/pg_stat_statements/expected/wal.out b/contrib/pg_stat_statements/expected/wal.out
index 34a2bf5b03..977e382d84 100644
--- a/contrib/pg_stat_statements/expected/wal.out
+++ b/contrib/pg_stat_statements/expected/wal.out
@@ -18,7 +18,7 @@ FROM pg_stat_statements ORDER BY query COLLATE "C";
DELETE FROM pgss_wal_tab WHERE a > $1 | 1 | 1 | t | t | t
INSERT INTO pgss_wal_tab VALUES(generate_series($1, $2), $3) | 1 | 10 | t | t | t
SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 | f | f | f
- SET pg_stat_statements.track_utility = FALSE | 1 | 0 | f | f | t
+ SET pg_stat_statements.track_utility = $1 | 1 | 0 | f | f | t
UPDATE pgss_wal_tab SET b = $1 WHERE a > $2 | 1 | 3 | t | t | t
(5 rows)
--
2.45.2
[application/pgp-signature] signature.asc (833B, ../../[email protected]/4-signature.asc)
download
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Normalize queries starting with SET for pg_stat_statements
2024-08-13 14:54 Re: Normalize queries starting with SET for pg_stat_statements Greg Sabino Mullane <[email protected]>
2024-08-19 06:28 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-24 07:57 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
@ 2024-09-25 03:10 ` Michael Paquier <[email protected]>
2024-09-30 06:24 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Michael Paquier @ 2024-09-25 03:10 UTC (permalink / raw)
To: Greg Sabino Mullane <[email protected]>; +Cc: pgsql-hackers
On Tue, Sep 24, 2024 at 04:57:28PM +0900, Michael Paquier wrote:
> 0001 is straight-forward and that was I think a mistake to not include
> that from the start when I've expanded these tests in the v16 cycle
> (well, time..). 0002 also is quite conservative at the end, and this
> design can be used to tune easily the jumbling patterns from gram.y
> depending on the feedback we'd get.
Applied 0001 for now to expand the tests, with one tweak: the removal
of SET NAMES. It was proving tricky to use something else than UTF-8,
the CI complaining on Windows. True that this could use like unaccent
and an alternate output in a different file, but I'm not inclined to
take the cost just for this specific query pattern.
The remaining 0002 is attached for now. I am planning to wrap that
next week after a second lookup, except if there are any comments, of
course.
--
Michael
Attachments:
[text/x-diff] v3-0002-Normalize-queries-starting-with-SET.patch (12.7K, ../../[email protected]/2-v3-0002-Normalize-queries-starting-with-SET.patch)
download | inline diff:
From 40983157423d93334f30c70def5bf311fcff80f6 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Wed, 25 Sep 2024 12:08:04 +0900
Subject: [PATCH v3] Normalize queries starting with SET
---
src/include/nodes/parsenodes.h | 20 +++++++++++++---
src/backend/nodes/queryjumblefuncs.c | 19 +++++++++++++++
src/backend/parser/gram.y | 24 +++++++++++++++++++
contrib/pg_stat_statements/expected/dml.out | 2 +-
.../expected/level_tracking.out | 2 +-
.../pg_stat_statements/expected/utility.out | 20 ++++++----------
contrib/pg_stat_statements/expected/wal.out | 2 +-
7 files changed, 70 insertions(+), 19 deletions(-)
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index e62ce1b753..9e76713f2d 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2616,11 +2616,25 @@ typedef enum VariableSetKind
typedef struct VariableSetStmt
{
+ pg_node_attr(custom_query_jumble)
+
NodeTag type;
VariableSetKind kind;
- char *name; /* variable to be set */
- List *args; /* List of A_Const nodes */
- bool is_local; /* SET LOCAL? */
+ /* variable to be set */
+ char *name;
+ /* List of A_Const nodes */
+ List *args;
+
+ /*
+ * True if arguments should be accounted for in query jumbling. We use a
+ * separate flag rather than query_jumble_ignore on "args" as several
+ * grammar flavors of SET rely on a list of values that are parsed
+ * directly from the grammar's keywords.
+ */
+ bool jumble_args;
+ /* SET LOCAL? */
+ bool is_local;
+ ParseLoc location pg_node_attr(query_jumble_location);
} VariableSetStmt;
/* ----------------------
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index 129fb44709..5e43fd9229 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -57,6 +57,7 @@ static void RecordConstLocation(JumbleState *jstate, int location);
static void _jumbleNode(JumbleState *jstate, Node *node);
static void _jumbleA_Const(JumbleState *jstate, Node *node);
static void _jumbleList(JumbleState *jstate, Node *node);
+static void _jumbleVariableSetStmt(JumbleState *jstate, Node *node);
/*
* Given a possibly multi-statement source string, confine our attention to the
@@ -352,3 +353,21 @@ _jumbleA_Const(JumbleState *jstate, Node *node)
}
}
}
+
+static void
+_jumbleVariableSetStmt(JumbleState *jstate, Node *node)
+{
+ VariableSetStmt *expr = (VariableSetStmt *) node;
+
+ JUMBLE_FIELD(kind);
+ JUMBLE_STRING(name);
+
+ /*
+ * Account for the list of arguments in query jumbling only if told by the
+ * parser.
+ */
+ if (expr->jumble_args)
+ JUMBLE_NODE(args);
+ JUMBLE_FIELD(is_local);
+ JUMBLE_LOCATION(location);
+}
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index b1d4642c59..4aa8646af7 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -1647,6 +1647,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION";
n->args = $2;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
@@ -1656,6 +1658,8 @@ set_rest:
n->kind = VAR_SET_MULTI;
n->name = "SESSION CHARACTERISTICS";
n->args = $5;
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
| set_rest_more
@@ -1669,6 +1673,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name '=' var_list
@@ -1678,6 +1683,7 @@ generic_set:
n->kind = VAR_SET_VALUE;
n->name = $1;
n->args = $3;
+ n->location = @3;
$$ = n;
}
| var_name TO DEFAULT
@@ -1686,6 +1692,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| var_name '=' DEFAULT
@@ -1694,6 +1701,7 @@ generic_set:
n->kind = VAR_SET_DEFAULT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
;
@@ -1706,6 +1714,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_CURRENT;
n->name = $1;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes mandated by SQL standard: */
@@ -1715,6 +1724,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "timezone";
+ n->location = -1;
+ n->jumble_args = true;
if ($3 != NULL)
n->args = list_make1($3);
else
@@ -1736,6 +1747,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| NAMES opt_encoding
@@ -1744,6 +1756,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "client_encoding";
+ n->location = @2;
if ($2 != NULL)
n->args = list_make1(makeStringConst($2, @2));
else
@@ -1757,6 +1770,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "role";
n->args = list_make1(makeStringConst($2, @2));
+ n->location = @2;
$$ = n;
}
| SESSION AUTHORIZATION NonReservedWord_or_Sconst
@@ -1766,6 +1780,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "session_authorization";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
| SESSION AUTHORIZATION DEFAULT
@@ -1774,6 +1789,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_DEFAULT;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
| XML_P OPTION document_or_content
@@ -1783,6 +1799,8 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_VALUE;
n->name = "xmloption";
n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3));
+ n->jumble_args = true;
+ n->location = -1;
$$ = n;
}
/* Special syntaxes invented by PostgreSQL: */
@@ -1793,6 +1811,7 @@ set_rest_more: /* Generic SET syntaxes: */
n->kind = VAR_SET_MULTI;
n->name = "TRANSACTION SNAPSHOT";
n->args = list_make1(makeStringConst($3, @3));
+ n->location = @3;
$$ = n;
}
;
@@ -1900,6 +1919,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "timezone";
+ n->location = -1;
$$ = n;
}
| TRANSACTION ISOLATION LEVEL
@@ -1908,6 +1928,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "transaction_isolation";
+ n->location = -1;
$$ = n;
}
| SESSION AUTHORIZATION
@@ -1916,6 +1937,7 @@ reset_rest:
n->kind = VAR_RESET;
n->name = "session_authorization";
+ n->location = -1;
$$ = n;
}
;
@@ -1927,6 +1949,7 @@ generic_reset:
n->kind = VAR_RESET;
n->name = $1;
+ n->location = -1;
$$ = n;
}
| ALL
@@ -1934,6 +1957,7 @@ generic_reset:
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_RESET_ALL;
+ n->location = -1;
$$ = n;
}
;
diff --git a/contrib/pg_stat_statements/expected/dml.out b/contrib/pg_stat_statements/expected/dml.out
index f6ac8da5ca..acc2c5e524 100644
--- a/contrib/pg_stat_statements/expected/dml.out
+++ b/contrib/pg_stat_statements/expected/dml.out
@@ -82,7 +82,7 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
2 | 4 | SELECT * FROM pgss_dml_tab WHERE a > $1 ORDER BY a
1 | 8 | SELECT * FROM pgss_dml_tab WHERE a IN ($1, $2, $3, $4, $5)
1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- 1 | 0 | SET pg_stat_statements.track_utility = FALSE
+ 1 | 0 | SET pg_stat_statements.track_utility = $1
6 | 6 | UPDATE pgss_dml_tab SET b = $1 WHERE a = $2
1 | 3 | UPDATE pgss_dml_tab SET b = $1 WHERE a > $2
(10 rows)
diff --git a/contrib/pg_stat_statements/expected/level_tracking.out b/contrib/pg_stat_statements/expected/level_tracking.out
index d8dd8a2dee..bb65e98ce0 100644
--- a/contrib/pg_stat_statements/expected/level_tracking.out
+++ b/contrib/pg_stat_statements/expected/level_tracking.out
@@ -64,7 +64,7 @@ SELECT toplevel, calls, query FROM pg_stat_statements
| | END; $$
f | 1 | SELECT $1::TEXT
t | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- t | 1 | SET pg_stat_statements.track = 'all'
+ t | 1 | SET pg_stat_statements.track = $1
(7 rows)
-- Procedure with multiple utility statements.
diff --git a/contrib/pg_stat_statements/expected/utility.out b/contrib/pg_stat_statements/expected/utility.out
index 8d3fd77201..060d4416dd 100644
--- a/contrib/pg_stat_statements/expected/utility.out
+++ b/contrib/pg_stat_statements/expected/utility.out
@@ -108,7 +108,7 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | CREATE FOREIGN TABLE foreign_stats (a int) SERVER server_stats
1 | 0 | CREATE FUNCTION func_stats(a text DEFAULT 'a_data', b text DEFAULT lower('b_data'))+
| | RETURNS text AS $$ SELECT $1::text || '_' || $2::text; $$ LANGUAGE SQL +
- | | SET work_mem = '256kB'
+ | | SET work_mem = $1
1 | 0 | CREATE FUNCTION trigger_func_stats () RETURNS trigger LANGUAGE plpgsql +
| | AS $$ BEGIN return OLD; end; $$
1 | 0 | CREATE INDEX pt_stats2_index ON ONLY pt_stats2 (a)
@@ -620,8 +620,7 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_1'
1 | 0 | SET LOCAL SESSION AUTHORIZATION 'regress_stat_set_2'
1 | 0 | SET LOCAL SESSION AUTHORIZATION DEFAULT
- 1 | 0 | SET LOCAL work_mem = '128kB'
- 1 | 0 | SET LOCAL work_mem = '256kB'
+ 2 | 0 | SET LOCAL work_mem = $1
2 | 0 | SET LOCAL work_mem = DEFAULT
1 | 0 | SET LOCAL work_mem FROM CURRENT
1 | 0 | SET SESSION AUTHORIZATION 'regress_stat_set_1'
@@ -630,8 +629,6 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ ONLY
1 | 0 | SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE
1 | 0 | SET SESSION SESSION AUTHORIZATION DEFAULT
- 1 | 0 | SET SESSION work_mem = '300kB'
- 1 | 0 | SET SESSION work_mem = '400kB'
1 | 0 | SET TIME ZONE 'America/New_York'
1 | 0 | SET TIME ZONE 'Asia/Tokyo'
1 | 0 | SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'
@@ -641,13 +638,11 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
1 | 0 | SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
1 | 0 | SET XML OPTION CONTENT
1 | 0 | SET XML OPTION DOCUMENT
- 1 | 0 | SET enable_seqscan = off
- 1 | 0 | SET enable_seqscan = on
- 2 | 0 | SET work_mem = '1MB'
- 1 | 0 | SET work_mem = '2MB'
+ 2 | 0 | SET enable_seqscan = $1
+ 5 | 0 | SET work_mem = $1
2 | 0 | SET work_mem = DEFAULT
1 | 0 | SET work_mem FROM CURRENT
-(39 rows)
+(34 rows)
DROP ROLE regress_stat_set_1;
DROP ROLE regress_stat_set_2;
@@ -733,9 +728,8 @@ SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C";
-------+------+----------------------------------------------------
1 | 0 | RESET ALL
1 | 1 | SELECT pg_stat_statements_reset() IS NOT NULL AS t
- 1 | 0 | SET SCHEMA 'foo'
- 1 | 0 | SET SCHEMA 'public'
-(4 rows)
+ 2 | 0 | SET SCHEMA $1
+(3 rows)
SELECT pg_stat_statements_reset() IS NOT NULL AS t;
t
diff --git a/contrib/pg_stat_statements/expected/wal.out b/contrib/pg_stat_statements/expected/wal.out
index 34a2bf5b03..977e382d84 100644
--- a/contrib/pg_stat_statements/expected/wal.out
+++ b/contrib/pg_stat_statements/expected/wal.out
@@ -18,7 +18,7 @@ FROM pg_stat_statements ORDER BY query COLLATE "C";
DELETE FROM pgss_wal_tab WHERE a > $1 | 1 | 1 | t | t | t
INSERT INTO pgss_wal_tab VALUES(generate_series($1, $2), $3) | 1 | 10 | t | t | t
SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1 | 1 | f | f | f
- SET pg_stat_statements.track_utility = FALSE | 1 | 0 | f | f | t
+ SET pg_stat_statements.track_utility = $1 | 1 | 0 | f | f | t
UPDATE pgss_wal_tab SET b = $1 WHERE a > $2 | 1 | 3 | t | t | t
(5 rows)
--
2.45.2
[application/pgp-signature] signature.asc (833B, ../../[email protected]/3-signature.asc)
download
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Normalize queries starting with SET for pg_stat_statements
2024-08-13 14:54 Re: Normalize queries starting with SET for pg_stat_statements Greg Sabino Mullane <[email protected]>
2024-08-19 06:28 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-24 07:57 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-25 03:10 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
@ 2024-09-30 06:24 ` Michael Paquier <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Michael Paquier @ 2024-09-30 06:24 UTC (permalink / raw)
To: Greg Sabino Mullane <[email protected]>; +Cc: pgsql-hackers
On Wed, Sep 25, 2024 at 12:10:02PM +0900, Michael Paquier wrote:
> The remaining 0002 is attached for now. I am planning to wrap that
> next week after a second lookup, except if there are any comments, of
> course.
And done with that, after a second round, tweaking some comments.
Thanks Greg for sending the patch and pushing this feature forward.
This finishes what I had on my TODO bucket in terms of normalization
when this stuff has begun in v16 with 3db72ebcbe20.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH v21 8/8] Allow to print raw parse tree.
@ 2024-08-26 04:32 Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Tatsuo Ishii @ 2024-08-26 04:32 UTC (permalink / raw)
---
src/backend/tcop/postgres.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8bc6bea113..f15659bf2b 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -659,6 +659,10 @@ pg_parse_query(const char *query_string)
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
return raw_parsetree_list;
--
2.25.1
----Next_Part(Mon_Aug_26_13_39_47_2024_878)----
^ permalink raw reply [nested|flat] 24+ messages in thread
end of thread, other threads:[~2024-09-30 06:24 UTC | newest]
Thread overview: 24+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 10:49 [PATCH v3 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-08-09 07:56 [PATCH v4 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-09-02 06:32 [PATCH v5 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-09-12 05:22 [PATCH v6 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-09-22 04:53 [PATCH v7 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-09-25 05:01 [PATCH v8 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-10-04 05:51 [PATCH v9 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-10-22 02:22 [PATCH v10 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-11-08 06:57 [PATCH v11 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2023-12-04 11:23 [PATCH v12 7/7] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-01-22 09:45 [PATCH v13 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-02-28 13:59 [PATCH v14 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-03-28 10:30 [PATCH v15 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-04-12 06:49 [PATCH v16 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-04-28 11:00 [PATCH v17 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-05-11 07:11 [PATCH v18 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-05-14 23:26 [PATCH v19 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-05-24 02:26 [PATCH v20 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
2024-08-13 14:54 Re: Normalize queries starting with SET for pg_stat_statements Greg Sabino Mullane <[email protected]>
2024-08-19 06:28 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-24 07:57 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-25 03:10 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-09-30 06:24 ` Re: Normalize queries starting with SET for pg_stat_statements Michael Paquier <[email protected]>
2024-08-26 04:32 [PATCH v21 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox