JuliaDatabases / PostgreSQL.jl

DEPRECATED: use LibPQ.jl instead
https://github.com/invenia/LibPQ.jl
Other
60 stars 39 forks source link

I am not able to query anything? #28

Closed joermungandr closed 9 years ago

joermungandr commented 9 years ago

Hi!

I'm trying to use this package for my Postgres Database. I executed this:

connection = connect(Postgres, "localhost", "name", "pw", "database", "5432")
query = prepare(connection, "SELECT * FROM users")
execute(query)

After this I get the following errors:

ERROR: MethodError: `convert` has no method matching convert(::Type{PostgreSQL.PostgresType{Name}}, ::Type{PostgreSQL.OID{1114}})
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}}, ::Type{PostgreSQL.OID{16}})
  convert(::Type{PostgreSQL.PostgresType{Name}}, ::Type{Bool})
  ...
in call at /Users/icarus/.julia/v0.4/PostgreSQL/src/types.jl:172
in execute at /Users/icarus/.julia/v0.4/PostgreSQL/src/dbi_impl.jl:141

Is this a bug, or did I do anything wrong? I just want to connect to my database and to execute select queries.

iamed2 commented 9 years ago

Looks like you have Timestamp (OID 1114) values in your database. A short-term solution would be to convert them to a string or an int64. I will push an update within the next few hours which should fix this for you by treating them naively as a string.

joermungandr commented 9 years ago

Thx :-)