I do not know if it is a rigth place to ask, but i hope so ![]()
1> {ok, DBRef}=pgsql:connect("xx", "xxx", "xx","xx",5432).
{ok,<0.31.0>}
2> pgsql:squery(DBRef, ["CREATE TABLE test (list BYTEA);"]).
{ok,["CREATE TABLE"]}
3> pgsql:squery(DBRef, ["INSERT INTO test (list) VALUES ('",term_to_binary(["e1","e2"]),");"]).
{ok,[{error,[{severity,'ERROR'},
{code,"08P01"},
{message,"invalid message format"},
{file,"pqformat.c"},
{line,689},
{routine,"pq_getmsgend"}]}]}
as I understand that is becouse of 0 characters in binary:
2> term_to_binary(["e1","e2"]).
<<131,108,0,0,0,2,107,0,2,101,49,107,0,2,101,50,106>>
as pgsql docs say that 0 character should be escaped with
E'\ 0'
But, me failed to understand how I can do this.
Please, suggest an idea to me how to resolve this.
Thanks.
