Giter Site home page Giter Site logo

postgres.jl's People

Contributors

ncarson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

postgres.jl's Issues

Use vararg keyword arguments for connect() convenience function

I was just giving a look at the API, and I noticed a small improvement you could make to connect. Instead of:

function Base.connect(::Type{PostgresServer}, d::Dict)

you could do:

function Base.connect(::Type{PostgresServer}; args...)

This would allow users to write connect(PostgresServer, db="julia_test", host="localhost") instead of connect(PostgresServer, Dict(:db=>"julia_test", :host=>"localhost")).

For more details, see http://docs.julialang.org/en/latest/manual/functions/#keyword-arguments

My two cents...

`unsafe column` has no method matching ...

Attempting to imitate the examples, I did this in julia 0.4 with a Postgres 9.4 database on linux. The error is at the bottom.

 julia> using Postgres                                                                                                
 INFO: Precompiling module Postgres...
# several failed connection attempts deleted
# BTW, it was not obvious to me that the port should be a string
 julia> conn = connect(PostgresServer, "xxx", "xxx", "localhost", "xxx", "5432")                        
 PostgresConnection(@ 0x000000000378dbe0 : ok)

 julia> curs = cursor(conn)                                                                                           
 Postgres.BufferedPostgresCursor(
         PostgresConnection(@ 0x000000000378dbe0 : ok),
         Nullable{Postgres.Results.PostgresResult}())

!julia> obs = query(curs, "SELECT isim, id, x, t, y, regular, censor, wait from obs2619 where isim=1")                
 ERROR: MethodError: `unsafe_column` has no method matching unsafe_column(::Ptr{Postgres.Libpq.PGresult}, ::Int64, ::\
 Int32, ::Postgres.Types.PostgresType{Float64})
 Closest candidates are:
   unsafe_column{T}(::Ptr{Postgres.Libpq.PGresult}, ::Int64, !Matched::Int64, ::Postgres.Types.AbstractPostgresType{T\
 })
  in column at /home/ross/.julia/v0.4/Postgres/src/results.jl:173
  in fetch at /home/ross/.julia/v0.4/Postgres/src/postgres.jl:402
  in query at /home/ross/.julia/v0.4/Postgres/src/postgres.jl:418

Postgres numeric type should not use binary floating point

Postgres decimal / numeric types are decimal floating point values, not binary, and are specifically used instead of the real type for storing things like monetary values where it is critical that the values are exact.
(for example, there are actually legal requirements in the EU about how currency values are handled).
To handle this correctly in Julia, you could use @stevengj's DecFP.jl package, the DecFP.jl Dec128 type will support up to 38 digits.
You might also be able to represent the numeric type with Rational{BigInt}, using a power of 10 for the denominator, that would allow accurately representing any possible Postgres decimal / numeric value without loss of information (Postgres can handle up to 131072 digits before the decimal point; up to 16383 digits after the decimal point).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.