Reputation: 31
In zend, I've created mapper and model for a particular module. I'm trying to save a data into a table from a zend controller file
I am using postgresql as the database. I have set a table with primary key for auto incrementing
The table name and corresponding primary key is as follows:
tbl_user_group_business_prmission --table
pk_bint_user_group_business_prmission_id --primary key
Primary key generation is done as follows
nextval('tbl_user_group_business_prmission_pk_bint_user_group_business_prmission_id_seq'::regclass)
You can see that the parameter inside nextval() is more than 60 in count(character).This is the issue which I am facing. I.e. I am not able to insert data into this table, as this parameter exceeds 60 in count(character)
I am getting error something like this "primary key does not generate".
This issue comes only if the characters inside the nextval() exceed 60
Upvotes: 0
Views: 159
Reputation: 4635
The postgres system uses no more than 63 bytes of an identifier; longer names can be written in commands, but they will be truncated. Check this manual SQL-SYNTAX-IDENTIFIERS.
But you can update the name of the sequence by creating a custom CREATE SEQUENCE
or via the phppgadmin or pgAdmin interfaces.
In this case its better to change the table name
or primary key column name
shorter, because in zend it is hardcoded to create the sequence by concatinating the tableName+columnName+... You can see the code here /Zend/Db/Adapter/Pdo/Pgsql.php
function lastInsertId
EDIT :
There is another suggestion in this SO post
Upvotes: 1