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

LibPQ logs but doesn't throw for nonexistent column names #211

Open
c42f opened this issue Dec 8, 2020 · 1 comment · May be fixed by #212
Open

LibPQ logs but doesn't throw for nonexistent column names #211

c42f opened this issue Dec 8, 2020 · 1 comment · May be fixed by #212

Comments

@c42f
Copy link
Contributor

c42f commented Dec 8, 2020

It seems that when getting a nonexistent column from a LibPQ.Row via getproperty, LibPQ logs a mysterious-looking error to stderr but doesn't otherwise indicate failure.

Should this be an exception?

Demo:

julia> conn = LibPQ.Connection("...");
julia> LibPQ.execute(conn, "create table test (a integer, b integer)")
julia> LibPQ.execute(conn, "insert into test values (1,2)")
julia> row = only(LibPQ.execute(conn, "select * from test"))
LibPQ.Row(PostgreSQL result, 1)

julia> row.a
1

julia> row.x
column number -1 is out of range 0..1
missing

The error column number -1 is out of range 0..1 is coming from inside upstream libpq:
https://github.com/postgres/postgres/blob/28d1601ad988790c3c53d7ffd24ef6d2366d4457/src/interfaces/libpq/fe-exec.c#L2798-L2810

@iamed2
Copy link
Collaborator

iamed2 commented Dec 9, 2020

You're right, I think I know how to fix this as well

@iamed2 iamed2 linked a pull request Dec 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants