diff --git a/contrib/pg_stat_statements/expected/utility.out b/contrib/pg_stat_statements/expected/utility.out
index e4d6564ea5b..acb95f34f1b 100644
--- a/contrib/pg_stat_statements/expected/utility.out
+++ b/contrib/pg_stat_statements/expected/utility.out
@@ -719,6 +719,34 @@ SELECT pg_stat_statements_reset() IS NOT NULL AS t;
  t
 (1 row)
 
+-- WAIT FOR LSN
+-- Different target LSNs should be normalized into one entry.
+WAIT FOR LSN '0/0' WITH (MODE 'primary_flush');
+ status  
+---------
+ success
+(1 row)
+
+WAIT FOR LSN '0/1' WITH (MODE 'primary_flush');
+ status  
+---------
+ success
+(1 row)
+
+SELECT calls, rows, query
+  FROM pg_stat_statements
+  WHERE query LIKE 'WAIT FOR LSN%';
+ calls | rows |                    query                    
+-------+------+---------------------------------------------
+     2 |    0 | WAIT FOR LSN $1 WITH (MODE 'primary_flush')
+(1 row)
+
+SELECT pg_stat_statements_reset() IS NOT NULL AS t;
+ t 
+---
+ t
+(1 row)
+
 -- Special cases.  Keep these ones at the end to avoid conflicts.
 SET SCHEMA 'foo';
 SET SCHEMA 'public';
diff --git a/contrib/pg_stat_statements/sql/utility.sql b/contrib/pg_stat_statements/sql/utility.sql
index dd97203c210..39ecac37e70 100644
--- a/contrib/pg_stat_statements/sql/utility.sql
+++ b/contrib/pg_stat_statements/sql/utility.sql
@@ -365,6 +365,15 @@ DROP TABLE pgss_select_into;
 
 SELECT pg_stat_statements_reset() IS NOT NULL AS t;
 
+-- WAIT FOR LSN
+-- Different target LSNs should be normalized into one entry.
+WAIT FOR LSN '0/0' WITH (MODE 'primary_flush');
+WAIT FOR LSN '0/1' WITH (MODE 'primary_flush');
+SELECT calls, rows, query
+  FROM pg_stat_statements
+  WHERE query LIKE 'WAIT FOR LSN%';
+SELECT pg_stat_statements_reset() IS NOT NULL AS t;
+
 -- Special cases.  Keep these ones at the end to avoid conflicts.
 SET SCHEMA 'foo';
 SET SCHEMA 'public';
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index a33c3aaeeb2..eea540106de 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -17300,6 +17300,7 @@ WaitStmt:
 					WaitStmt *n = makeNode(WaitStmt);
 					n->lsn_literal = $4;
 					n->options = $5;
+					n->lsn_location = @4;
 					$$ = (Node *) n;
 				}
 			;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index d3835af8f9e..a4c21b8562c 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -4606,8 +4606,11 @@ typedef struct DropSubscriptionStmt
 typedef struct WaitStmt
 {
 	NodeTag		type;
-	char	   *lsn_literal;	/* LSN string from grammar */
+	/* LSN string from grammar */
+	char	   *lsn_literal pg_node_attr(query_jumble_ignore);
 	List	   *options;		/* List of DefElem nodes */
+	/* token location, or -1 if unknown */
+	ParseLoc	lsn_location pg_node_attr(query_jumble_location);
 } WaitStmt;
 
 
