m6w6 / ext-pq

PostgreSQL client library (libpq) binding
BSD 2-Clause "Simplified" License
39 stars 7 forks source link

Persistent connect, query "RESET ALL" always executed at the end of the script? #5

Closed ParkFramework closed 8 years ago

ParkFramework commented 8 years ago

Perhaps to make conditions if a new session uses the same $application_name not to RESET ALL?

m6w6 commented 8 years ago

Yes, "RESET ALL" is always executed when a persistent connection is retired.

I don't think there's any value not to do it, rather, it might be dangerous not to do.

You would do your "SET ..." queries anyway after obtaining a connection.

What's your use-case?

ParkFramework commented 8 years ago

Yes, it works reliably.

I was thinking how to optimize work script, each time to do a SET, is worth the extra time and you can not see last query (he always RESET ALL).

Ok, it is not critical.

m6w6 commented 8 years ago

I see that it comes with a few drawbacks, but on the other hand it would be quite dangerous not to reset a persistent connection.

m6w6 commented 8 years ago

Ah, one last thing, please make a PR to add your name to https://github.com/m6w6/ext-pq/blob/master/THANKS !