Symfony, Unable to get sequence id with PostgreSQL Database

postgresql-sequence-id-error

When doing Symfony development, I usually build the database schema manually through phpPgAdmin or writing my own schema file. I like propel-generate-crud in symfony, which can generate the admin form on the fly.

Previously I was having problem with PostgreSQL Database’s sequence id. When I did propel-build-model, the seq_id from Postgresql database is not sync with the model been built by symfony. To solve that, I did manual change on PostgreSQL by renaming the tablename_id_seq to tablename_seq. After I have did some testing, found a way to solve the sequence id problem.

As i mentioned previously, I usually create the schema by the phpPgAdmin or writing my own schema file instead of the one in symfony config directory which name schema.xml or schema.yml. These are the step I took to generate the admin form with propel-generate crud.

  • Build database table/schema
  • run symfony propel-build-schema
  • run symfony propel-build-model
  • run symfony propel-generate crud

After that, access to the admin form and try to insert new database, usually the transaction will fail because the system unable to detect the sequence id. Error message shown below;


Unable to get sequence id. [wrapped: Unable to fetch next sequence ID without sequence name.]

Instead of doing the manual way, alter the sequence id in postgresql database, you can fix that by doing symfony propel-build-schema xml. Symfony will generate the schema in xml format, which include postgresql sequence id name.

Related posts:

  1. symfony / propel with RAND() Lately I am working on a simple online test system...
  2. PostgreSQL Database psql Command Line Query Sometime psql command line query can be useful when it...
  3. PostgreSQL Database signal 6 Error On Apple Mac After I have done PostgreSQL upgrade through MacPort, the database...
  4. installing postgresql 8.2 on Leopard with macports postgresql! one of my favorite high performance open source db,...
  5. PostgreSQL Performance Tuning Compilation Performance Tuning PostgreSQL by Frank Wiles PostgreSQL 8.0 Performance Checklist...
  6. Building PHP Web App in 15 minutes with Symfony Framework Last year, I gave a talk at Coscup 2009, an...
  7. postgresql82-server compile error on Apple Leopard with Macports 1.5 I wasn’t able to compile postgresql82-server on my machine, it’s...
  8. PgPool – PostgreSQL Connection Cache Playing PgPool on a heavy load database server is fun....
  9. How to Use Wget to Download Manual from Website Most of the time, we would prefer to read manual...

Leave a Reply