Skip to content

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

@c42f

Description

@c42f

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions