pymysql.err.OperationalError: (4091, "Unknown SEQUENCE: 'selling_step_id_seq'") - Autoincrement Doctype name error
I am getting this error on saving a record in selling step doctype in erpnext. My doctype has naming series set as Autoincrement. pymysql.err.OperationalError: (4091, "Unknown SEQUENCE: 'selling_step
The error you're encountering, pymysql.err.OperationalError: (4091, "Unknown SEQUENCE: 'selling_step_id_seq'")
, typically indicates that the sequence selling_step_id_seq
does not exist in your database. This sequence is likely used to generate unique IDs for records in the selling_step
doctype.
Here are a few steps you can take to resolve this issue:
1. Verify Sequence Creation
Check if the sequence selling_step_id_seq
exists in your database. You can do this by running a query directly in your database management tool.
For example, if you are using PostgreSQL, you can run:
sqlCopy codeSELECT * FROM pg_sequences WHERE sequencename = 'selling_step_id_seq';
2. Create the Sequence Manually
If the sequence does not exist, you can create it manually. Here’s how you can create it in PostgreSQL:
sqlCopy codeCREATE SEQUENCE selling_step_id_seq;
For MySQL, you might need to check if the database is set to use sequences or auto-increment. Usually, MySQL does not use sequences in the same way as PostgreSQL, so this error might indicate a deeper configuration issue or a mismatch in the database type expected.
3. Check Your DocType Configuration
Ensure that the selling_step
doctype is correctly configured to use the sequence. This might involve checking the schema definitions and any custom scripts or settings applied to this doctype.
4. Database Schema Migration
If the sequence is supposed to be created by a migration script or during the setup of the selling_step
doctype, try running the migrations again to ensure all necessary database objects are created.
In your ERPNext installation directory, you can run:
shCopy codebench migrate
This command applies any pending schema changes and should create any missing sequences.
No comments yet. Login to start a new discussion Start a new discussion