Skip to content

OID-related error #32

@daniel-perry

Description

@daniel-perry

I have the following database:

https://physionet.org/mimic2/demo/

I can run simple queries fine, when I run a more complicated query like this:

querystr = """select bucket, count(*) from (
select months_between(mimic2v26.admissions.admit_dt::timestamp::date, mimic2v26.d_patients.dob::timestamp::date)/12 from mimic2v26.admissions, mimic2v26.d_patients, 
width_bucket(
months_between(mimic2v26.admissions.admit_dt::timestamp::date,
mimic2v26.d_patients.dob::timestamp::date)/12, 
15, 100, 85) 
as bucket 
where mimic2v26.admissions.subject_id = mimic2v26.d_patients.subject_id 
and 
months_between(mimic2v26.admissions.admit_dt::timestamp::date,
mimic2v26.d_patients.dob::timestamp::date)/12 between 15 and 199
) 
as 
bucket 
group by bucket order by bucket;"""

stmt = prepare(conn, querystr)
result = execute(stmt)

I get the following error:

LoadError: MethodError: `convert` has no method matching convert(::Type{PostgreSQL.PostgresType{Name}}, ::Type{PostgreSQL.OID{2249}})
This may have arisen from a call to the constructor PostgreSQL.PostgresType{Name}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert(::Type{PostgreSQL.PostgresType{Name}}, !Matched::Type{PostgreSQL.OID{16}})
  convert(::Type{PostgreSQL.PostgresType{Name}}, !Matched::Type{Bool})
  ...
while loading In[5], in expression starting on line 17

This query works fine in both psql and via psycopg2.

Digging around it appears OID's are a little used feature of PosgreSQL (http://www.postgresql.org/docs/8.4/interactive/runtime-config-compatible.html#GUC-DEFAULT-WITH-OIDS), which might be why PostgreSQL.jl is having trouble converting a result using OID.
But since psycopg2 supports them, I though it was worth opening the issue.

Julia version: Version 0.4.2 (2015-12-06 21:47 UTC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions