Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escaped single quotes in search expression cause multiple placeholders in normalized_query #34

Open
terrorobe opened this issue Sep 24, 2013 · 0 comments

Comments

@terrorobe
Copy link
Contributor

When faced with a query_string that contains doubled/escaped single quotes these will be replaced with additional '?' placeholder characters. This causes issues when trying to identify identical query classes across stats resets.

 plantest=# select * from foo where data = 'bla';
 id | data 
----+------
(0 rows)

plantest=# select normalized_query, calls from pg_stat_plans_queries where dbid=152414;
                            normalized_query                             | calls 
-------------------------------------------------------------------------+-------
 select * from foo where data = ?;                                       |     1
 select pg_stat_plans_reset();                                           |     1
(3 rows)

plantest=# select pg_stat_plans_reset();
 pg_stat_plans_reset 
---------------------

(1 row)

plantest=# select * from foo where data = 'bl''a';
 id | data 
----+------
(0 rows)

plantest=# select normalized_query, calls from pg_stat_plans_queries where dbid=152414;
          normalized_query          | calls 
------------------------------------+-------
 select * from foo where data = ??; |     1
 select pg_stat_plans_reset();      |     1
(2 rows)

plantest=# select pg_stat_plans_reset();
 pg_stat_plans_reset 
---------------------

(1 row)

plantest=# select * from foo where data = 'b''l''a';
 id | data 
----+------
(0 rows)

plantest=# select normalized_query, calls from pg_stat_plans_queries where dbid=152414;
          normalized_query           | calls 
-------------------------------------+-------
 select * from foo where data = ???; |     1
 select pg_stat_plans_reset();       |     1
(2 rows)

plantest=# 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant