"cristi" <[EMAIL PROTECTED]> writes: > What is wrong here? > insert into table_name (field_name) values (select > setval('sequence_name')-1) as currval);
Either too few parentheses, or too many ;-) You could write this as an INSERT/SELECT: insert into table_name (field_name) select setval('sequence_name')-1 as currval; or you could write it as an INSERT/VALUES with scalar subquery expression: insert into table_name (field_name) values ((select setval('sequence_name')-1 as currval)); (all the parentheses are required here). But really you do not need a subquery for this at all; VALUES is perfectly content with scalar expressions: insert into table_name (field_name) values (setval('sequence_name')-1); regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster