ankane / dexter

The automatic indexer for Postgres
MIT License
1.9k stars 47 forks source link

Parameterized queries not supported #21

Closed jfinzel closed 6 years ago

jfinzel commented 6 years ago

Parameterized queries such as shown in the following line are not supported, as the SQL statement alone is taken yet the parameters are not injected:

2017-12-29 02:42:07.121 CST,"foo","db_name",99018,"1.1.1.1:34564",5a45ffd5.182ca,4,"SELECT",2017-12-29 02:41:57 CST,7/1326884,0,LOG,00000,"duration: 115.926 ms  execute <unnamed>: select (select count(1)  from foo.bar where updated_at < $1) as raw_count","parameters: $1 = '2017-12-29 06:00:49.32085'",,,,,,,,""

This is all dexter shows:

--------------------------------------------------------------------------------
Query 026c33689fd9b52682c495a618d4233d595129d633
Total time: 0.0 min, avg time: 59 ms, calls: 2
Could not run explain

select (select count(1)  from foo.bar where updated_at < $1) as raw_count

You probably have the same issue with prepared statements, but I haven't checked yet.

ankane commented 6 years ago

Hey @jfinzel, last night's release (0.3.1) added support for parameterized queries. Please give that a shot.

jfinzel commented 6 years ago

This appears to be working now, many thanks!