#2 trouble with pgsql driver

open
nobody
None
5
2007-12-05
2007-12-05
Anonymous
No

submitted by dave.rafkind@gmail.com

For pgsql from jungerl (checked out Dec 3 2007), using PostGres 8.0.13/PostGis 1.1.4

psql> create table my_table (timestamp_column timestamp);
psql> create table test_gps (message_id BIGSERIAL,
occurrence TIMESTAMP,
device_id VARCHAR,
location GEOMETRY,
speed REAL,
heading REAL,
info VARCHAR);

Then in erlang using jungerl's pgsql:

Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.5.5 (abort with ^G)

1> {ok, Db} = pgsql:connect("localhost", "tracker", "dave", "").
Params: [{secret,{5521,1197959615}},
{{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:prepare(Db, insert_point, "insert into test_gps (device_id, speed, heading, info, location) values ($1,$2,$3,$4,GeomFromText($5,-1))").

=ERROR REPORT==== 5-Dec-2007::12:09:08 ===
Error in process <0.33.0> with exit value: {{badrecord,dict},[{dict,get_slot,2},{dict,fetch,2},{lists,map,2},{pgsql_proto,idle,2}]}

** exited: {{badrecord,dict},
[{dict,get_slot,2},
{dict,fetch,2},
{lists,map,2},
{pgsql_proto,idle,2}]} **

3> pgsql:prepare(Db, insert_point, "insert into my_table (timestamp_column) values ($1)").
timeout
4> pgsql:pquery(Db, "insert into my_table (timestamp_column) values ($1)", ["2000-01-01 12:43:23"]).
timeout
5> pgsql:pquery(Db, "insert into test_gps (device_id, speed, heading) values ($1,$2,$3)", ["abc", 45, 54]).
timeout

NOTE: The pgsql:prepare and a subsequent pgsql:execute works in the pgsql from ejabberd-modules. The pgsql:pquery calls always time out. pgsql:squery calls usually work though.

Discussion