epgsql crash - database with PostGIS extension

20 views
Skip to first unread message

Atul Khot

unread,
Sep 29, 2016, 6:04:46 AM9/29/16
to Erlang epgsql Postgres driver use and development
Hi all,
        Greetings of the day! 

Epgsql version - 3.2.0
Erlang/OPT: 18.3
postgres version: 9.4

I am seeing the following crash - do I need to set any connection options? The database has the postgis extension. The actual query does not use any spatial data columns.
         Thanks in advance for any pointers/suggestions... 

----------------------------------------- crash ---------------------------------------------------
6> epgsql:equery(C, "select id from perms where id = $1 and password = $2",
6>   ["atul", "35093142-3b59-4b6f-9f4e-f 09641e2c196"]).

=ERROR REPORT==== 29-Sep-2016::14:15:47 ===
** Generic server <0.43.0> terminating 
** Last message in was {equery,
                           {statement,[],
                               [{column,<<"id">>,int8,8,-1,1}],
                               [int8,text]},
                           [{int8,"atul"},
                            {text,"35093142-3b59-4b6f-9f4e-f 09641e2c196"}]}
** When Server state == {state,gen_tcp,#Port<0.583>,<<>>,
                               {9760,896037610},
                               on_message,
                               {codec,[{geometry,39957},
                                       {{array,geometry},39965}],
                                      [{39957,geometry},
                                       {39965,{array,geometry}}]},
                               {[],[]},
                               undefined,
                               [{<<"application_name">>,<<>>},
                                {<<"client_encoding">>,<<"UTF8">>},
                                {<<"DateStyle">>,<<"ISO, MDY">>},
                                {<<"integer_datetimes">>,<<"on">>},
                                {<<"IntervalStyle">>,<<"postgres">>},
                                {<<"is_superuser">>,<<"on">>},
                                {<<"server_encoding">>,<<"UTF8">>},
                                {<<"server_version">>,<<"9.4.5">>},
                                {<<"session_authorization">>,<<"postgres">>},
                                {<<"standard_conforming_strings">>,<<"on">>},
                                {<<"TimeZone">>,<<"localtime">>}],
                               [],[],[],[],[],undefined,73}
** Reason for termination == 
** {badarg,[{epgsql_binary,encode,3,
                           [{file,"src/epgsql_binary.erl"},{line,59}]},
            {epgsql_wire,encode_parameter,2,
                         [{file,"src/epgsql_wire.erl"},{line,194}]},
            {epgsql_wire,encode_parameters,5,
                         [{file,"src/epgsql_wire.erl"},{line,186}]},
            {epgsql_sock,command,2,[{file,"src/epgsql_sock.erl"},{line,218}]},
            {gen_server,try_handle_call,4,
                        [{file,"gen_server.erl"},{line,629}]},
            {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,661}]},
            {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
** exception exit: badarg
     in function  epgsql_binary:encode/3 (src/epgsql_binary.erl, line 59)
     in call from epgsql_wire:encode_parameter/2 (src/epgsql_wire.erl, line 194)
     in call from epgsql_wire:encode_parameters/5 (src/epgsql_wire.erl, line 186)
     in call from epgsql_sock:command/2 (src/epgsql_sock.erl, line 218)
     in call from gen_server:try_handle_call/4 (gen_server.erl, line 629)
     in call from gen_server:handle_msg/5 (gen_server.erl, line 661)
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)
----------------------------------------- crash ---------------------------------------------------

--- regards atul
                  

Atul Khot

unread,
Sep 29, 2016, 6:27:06 AM9/29/16
to Erlang epgsql Postgres driver use and development
Hi all,
       I realised I am sending the string "atul" for an id - Fixed it...

epgsql:equery(C, "select id from drone where id = $1 and password = $2",
  [66, "35093142-3b59-4b6f-9f4e-f 09641e2c196"]).

and it works fine - 

7> epgsql:equery(C, "select id from drone where id = $1 and password = $2",
7>   [66, "35093142-3b59-4b6f-9f4e-f 09641e2c196"]).
{ok,[{column,<<"id">>,int8,8,-1,1}],[]}

Sorry for the confusion...

--- regards atul
Reply all
Reply to author
Forward
0 new messages