1. Michael Granger
  2. ruby-pg
  3. Issues

Issues

Issue #139 resolved

fnumber automatically downcases field name being searched (via PQfnumber call).

Thomas Powell
created an issue

Is there a possibility of adding an "auto-quoting" feature, function option, or updating the documentation to reflect this auto-downcasing? I realize that current functionality is consistent with the underlying library.

Details: I had a result handed to me with columns of the name "func(IDENTIFIER)", which would always have to be quoted anyway. I ended up adding what seemed like a superfluous set of quotes around the field name prior to the fnumber() call. (Which was hard to track down because I figured the parentheses were the problem).

I finally discovered where the problem was occurring under 27.3.2 http://www.postgresql.org/docs/7.4/static/libpq-exec.html for PQfnumber

"The given name is treated like an identifier in an SQL command, that is, it is downcased unless double-quoted. For example, given a query result generated from the SQL command"

I see that static VALUE pgresult_fnumber(VALUE self, VALUE name) passes the name almost directly to PQfnumber().

Comments (1)

  1. Log in to comment