[erlang-questions] failed to insert erlang list as binary to pgsql via jungerl driver

Oleg Palij <>
Sun Jun 17 10:06:46 CEST 2007

Hi, all!

1> {ok, DBRef}=pgsql:connect("xx", "xxx", "xx","xx",5432).
2> pgsql:squery(DBRef, ["CREATE TABLE test (list BYTEA);"]).
3> pgsql:squery(DBRef, ["INSERT INTO test (list) VALUES ('",term_to_binary(["e1","e2"]),");"]).
             {message,"invalid message format"},

as I understand that is becouse of 0 characters in binary:

2> term_to_binary(["e1","e2"]).

as pgsql docs say that 0 character should be escaped with E'\\000'
But, me failed to understand how I can do this. 
Please, suggest an idea to me how to resolve this. 

ISC Pridn railway, System Administrator

More information about the erlang-questions mailing list