0
votes

Executing a Query from C# code to PostgreSQL

INSERT INTO SCHEMA_NAME.Table_name(c1) values (nextval(\'sequence_name\'));

Working If I manually add any int value in the place of nextval() & also query working if I run on DB directly

2
Like the error says, you do not have a sequence created for the table. - Peter Schrøder

2 Answers

0
votes

Like your error says, you do not have a sequence created for this table.

Something in this direction would probably work...

CREATE SEQUENCE sequence_tablename INCREMENT 1 START 1;

0
votes

I needed to add schema name before nextval() like nextval(schema_name."sequence_name")