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

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

Closed
ged opened this issue Aug 14, 2012 · 1 comment
Closed

Comments

@ged
Copy link
Owner

ged commented Aug 14, 2012

Original report by Thomas Powell (Bitbucket: stringsn88keys, GitHub: stringsn88keys).


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().

@ged
Copy link
Owner Author

ged commented Aug 14, 2012

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Add some documentation to PG::Result#fnumber (fixes #139)

@ged ged closed this as completed Aug 14, 2012
@ged ged added this to the Pending milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant