Forum OpenACS Q&A: Multiple row in one insert for PostgreSQL

Hi there,

Maybe this is a dump question but I searched and couldn't find a solution.

Is there any way to insert multiple rows into Pg with one insert statement, just like Oracle?

insert into table_name (col_name) values (1,2,3,4) ?

Some workarounds would be appreciated if this is not supported in Pg.

Thank you in advance.

Sincerely,

Collapse
Posted by Kenny Chan on
Oops, I mean a query equilvalent to:

insert into table_name (col_name) values (1),(2),(3),(4)

Thank you

Collapse
Posted by Kenny Chan on
Hi again,

Btw, if I do sth like:

set sql_insert "insert into table (col_name) values (1);insert into table (col_name) values (2);insert into table (col_name) values (3); insert into table (col_name) values (4)"

ns_db dml $db $sql_insert

is this gonna have good performace instead of dml 4 times? It looks like this is a single db connect to me...

Thanks again.