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

MethodError: Cannot convert an object of type Type{PostgreSQL.OID{107980182}} to an object of type PostgreSQL.PostgresType #55

Open
johannspies opened this issue Oct 30, 2017 · 0 comments

Comments

@johannspies
Copy link

Building a query from an array like this:

query = """select A.ut, A.title, S.title as journal, F.field, 
F.organisation, F.suborgname, F.pubtype, F.doctype 
from wos_2017_1.article A, 
wos_2017_1.publication P, 
wos_2017_1.source S, 
basic_sciences.physorgs_mv F 
where A.ut in ($uts)  
and 
P.ut = A.ut 
and  
S.uuid = P.journal_id 
and 
f.ut = A.ut;""" 
query = replace(query, "\n", "")
dfr = get_dbdata(query)

results in a query like this (tuple shortened)

select A.ut, A.title, S.title as journal, F.field, F.organisation, F.suborgname, F.pubtype, F.doctype from wos_2017_1.article A, wos_2017_1.publication P, wos_2017_1.source S, basic_sciences.physorgs_mv F where A.ut in ('WOS:000299093400012', 'WOS:000307517500010') and P.ut = A.ut and S.uuid = P.journal_id and f.ut = A.ut;

which runs without a problem in pgadmin4 but it throws the following error using the abovementioned code:

MethodError: Cannot `convert` an object of type Type{PostgreSQL.OID{107980182}} to an object of type PostgreSQL.PostgresType
This may have arisen from a call to the constructor PostgreSQL.PostgresType(...),
since type constructors fall back to convert methods.

Stacktrace:
 [1] copy!(::Array{DataType,1}, ::Base.Generator{Array{DataType,1},PostgreSQL.##16#18}) at ./abstractarray.jl:572
 [2] _collect(::Type{DataType}, ::Base.Generator{Array{DataType,1},PostgreSQL.##16#18}, ::Base.HasShape) at ./array.jl:363
 [3] PostgreSQL.PostgresResultHandle(::Ptr{Void}) at /home/js/.julia/v0.6/PostgreSQL/src/types.jl:252
 [4] execute at /home/js/.julia/v0.6/PostgreSQL/src/dbi_impl.jl:171 [inlined]
 [5] get_dbdata(::String) at ./In[5]:5
 [6] include_string(::String, ::String) at ./loading.jl:515
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

No branches or pull requests

1 participant