Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

multiple commands supported in squery, but not in equery #27

bosky101 opened this Issue Mar 14, 2013 · 1 comment


None yet
2 participants

What's the best way to overcome the following issue ?

         %% assume table1 & a connection C exists
         pgsql:squery(C, "create table table1 (id varchar);"). 

         %% this works 
         eg: pgsql:squery(C,"select id from table1; insert into table1 (id) values(1);") 

         %% but this fails 
         eg: pgsql:equery(C,"select id from table1; insert into table1 (id) values($1);",[1])
         %% with error
          <<"cannot insert multiple commands into a prepared statement">>,



wg commented Mar 16, 2013

PostgreSQL only supports multiple commands when using the simple query protocol (which is what squery does) so you'll need to do something else like create a stored procedure if you really need to do multiple parameterized queries in a single call.

@wg wg closed this Mar 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment