Deprecation warnings for query methods

Issue #277 resolved
Lars Kanis
created an issue

Due to #276 I added some new query methods for consistency here. Consequently I added warnings for some deprecated query method ways in this commit. I think these deprecated method variations should be removed with pg-2.0.

The problem is, that we add deprecation warnings about some (now old) methods (namely async_exec with params array), but add the recommended alternative methods with the same pg version. Therefore libraries like ActiveRecord are forced to do one of these options:

  1. Update the library to use async_exec_params and require pg ~> 1.1
  2. Check pg version or method availability and use async_exec_params conditionally
  3. Set some flag in pg to disable warnings and continue to use old methods
  4. Alternatively we could warn about methods only, those alternatives are available since years (like exec vs. exec_params).

@Michael Granger , @Matthew Draper IMHO 2. is a reasonable way. It's no big deal to conditionally add a method alias to PG::Connection for pg < 1.1 . I just want to ask if you think similar?

Apart from this I would change the warnings to only pop up once, not for every call.

Comments (5)

  1. Lars Kanis reporter

    I found another issue related to parsing malformed strings per TextDecoder::Array. I restored the old behaviour but maked it as deprecated. It prints proper warnings now.

    If the current behaviour and deprecation warnings are OK, I would like to file the following changes as PR to rails: https://github.com/rails/rails/compare/master...larskanis:pg-1.1

    It makes sense to wait for a new rails version integrating the PR, until we release pg-1.1. Is this OK?

  2. Lars Kanis reporter

    This is solved in pg-1.1.0. However we went somewhat further and added all query methods as sync and async version and use the async* version by default. See the History.rdoc file.

  3. Log in to comment