Hi, not sure if this is the best place to complain about this, but I’m having some trouble
with the pgsql module (and PostGres 8.0 on gentoo linux)
I did an SVN UP today, so I’m pretty sure the code is recent..
1 - pgsql:squery fails when returning rows with nulls in them.
Erlang (BEAM) emulator version 5.6 [source] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.6 (abort with ^G)
1> {ok, Db} = pgsql:connect("localhost", "tracker", "dave", "").
Params: [{secret,{9716,1968698183}},
{{parameter,"TimeZone"},"US/Eastern"},
{{parameter,"session_authorization"},"dave"},
{{parameter,"server_version"},"8.0.13"},
{{parameter,"server_encoding"},"SQL_ASCII"},
{{parameter,"is_superuser"},"off"},
{{parameter,"integer_datetimes"},"off"},
{{parameter,"DateStyle"},"ISO, MDY"},
{{parameter,"client_encoding"},"SQL_ASCII"}]
{ok,<0.33.0>}
2> Result = pgsql:squery(Db, "select * from people").
=ERROR REPORT==== 29-Jan-2008::20:51:59 ===
Error in process <0.33.0> with exit value: {badarg,[{erlang,binary_to_list,[null]},{pgsql_proto,'-process_squery_cols/1-fun-0-',1},{lists,map,2},{lists,map,2},{pgsql_proto,process_squery_cols,1},{pgsql_proto,process_squery,1},{pgsql_proto,idle,2}]}
** exception exit: badarg
in function binary_to_list/1
called as binary_to_list(null)
in call from pgsql_proto:'-process_squery_cols/1-fun-0-'/1
in call from lists:map/2
in call from lists:map/2
in call from pgsql_proto:process_squery_cols/1
in call from pgsql_proto:process_squery/1
in call from pgsql_proto:idle/2
2 - After this happens, the database object becomes unusable (does not return from any function calls)
3 - I could not get prepared statements to work with either with pgsql:pquery or pgsql:prepare
Erlang (BEAM) emulator version 5.6 [source] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.6 (abort with ^G)
1> {ok, Db} = pgsql:connect("localhost", "tracker", "dave", "").
Params: [{secret,{9740,779115917}},
{{parameter,"TimeZone"},"US/Eastern"},
{{parameter,"session_authorization"},"dave"},
{{parameter,"server_version"},"8.0.13"},
{{parameter,"server_encoding"},"SQL_ASCII"},
{{parameter,"is_superuser"},"off"},
{{parameter,"integer_datetimes"},"off"},
{{parameter,"DateStyle"},"ISO, MDY"},
{{parameter,"client_encoding"},"SQL_ASCII"}]
{ok,<0.33.0>}
2> pgsql:pquery(Db, "select * from devices where device_id=$1", [2]).
=ERROR REPORT==== 29-Jan-2008::20:56:22 ===
Error in process <0.33.0> with exit value: {function_clause,[{pgsql_proto,'-idle/2-fun-0-',[{desc,1,"device_id",23,binary,4,-1,179203},{dict,277,56,64,32,280,168,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[[869|inet],[17189|table_constraints],[179202|devices_device_id_seq]],[[1231|'_numeric'],[2283|anyelement],[17121|key_column_usage...
** exception exit: function_clause
in function pgsql_proto:'-idle/2-fun-0-'/2
called as pgsql_proto:'-idle/2-fun-0-'({desc,1,"device_id",23,binary,4,-1,179203},
{dict,277,56,64,32,280,168,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[[869|inet],
[17189|table_constraints],
[179202|devices_device_id_seq]],
[[1231|'_numeric'],
[2283|anyelement],
[17121|key_column_usage],
[17176|pg_toast_17173],
[179198|tag_types]],
[[2206|regtype],[17108|domain_constraints]],
... SNIP ...
[],[],[],[],[],[],...}}})
in call from lists:map/2
in call from pgsql_proto:idle/2
