I am fairly new to julia and am trying out the Postgres package from
https://github.com/NCarson/Postgres.jl
While testing it on this table:
js=# \d customer
Table "public.customer"
Column | Type | Modifiers
----------+-----------------------+-----------
cust_no | integer | not null
customer | character varying(28) | not null
city | character varying(25) |
country | character varying(15) |
Indexes:
"ct_customer_pk" PRIMARY KEY, btree (cust_no)
like this:
conn = connect(PostgresServer, db="js")
#
*PostgresConnection(@ 0x0000000005f70230 : ok)curs = cursor(conn)d*f =
query(curs, "select * from customer")
*#Postgres.BufferedPostgresCursor(
# PostgresConnection(@ 0x0000000005f70230 : ok),
# Nullable{Postgres.Results.PostgresResult}())*
df = query(curs, "select * from customer")
I got this error:
#*LoadError: MethodError: `unsafe_column` has no method matching
unsafe_column(::Ptr{Postgres.Libpq.PGresult}, ::Int64, ::Int32,
::Postgres.Types.PostgresType{Int32})
#Closest candidates are:
# unsafe_column{T}(::Ptr{Postgres.Libpq.PGresult}, ::Int64, !Matched::Int64,
::Postgres.Types.AbstractPostgresType{T})
#while loading In[27], in expression starting on line 1
#
# in column at /home/js/.julia/v0.4/Postgres/src/results.jl:173
# in fetch at /home/js/.julia/v0.4/Postgres/src/postgres.jl:402
# in query at /home/js/.julia/v0.4/Postgres/src/postgres.jl:418*
How do I solve this?
Second question: I have seen the example in the readme on how to add a
custom type. But some assumptions in the explanation are not valid for
example the type 'uuid' and ' citext' in PostgreSQL.
(There are at least four fields of the type OID in pg_type and the README
example refers to one containing the OID 600. That field does contain a 0
for both uuid and citext. )
Is there an example on how to define a custom type for citext and for uuid
(Base.Random.UUID) for usage for this package?
Regards
Johann