[Dbix-class] PK::Auto and PostgreSQL 7.4.13
Adam Sjøgren
asjo at koldfront.dk
Mon Aug 7 22:33:37 CEST 2006
On Mon, 7 Aug 2006 08:40:26 +0100 (BST), Jess wrote:
>> Caught exception in Myapp::Controller::User->create
>> "DBIx::Class::ResultSet::create(): Can't get last insert id at
>> /var/www/Myapp/script/../lib/Myapp/Controller/User.pm
>> line 71"
[...]
>> DBD::Pg::db last_insert_id failed: no statement executing
> Are you setting the "sequence" key in your column_info?
-> add_columns('myidfield' => { sequence => 'seqname' } .. ?
No I wasn't; I will try... Well, if I print out $seq in
DBIx::Class::Storage::DBI::Pg::last_insert_id it is
'public.user_id_seq' whether I add the sequence to the column_info
myself or not, so the automation there works.
Ah, it was a simple user-error. My mistake was that the user which
connects to the database did not have permission to SELECT on the
sequence, so permission was denied and it didn't work.
As soon as I GRANT SELECT rights to the user, it works smoothly.
DBD::Pg's error message isn't the clearest in the world, but... I was
being stupid.
I apologize for the noise,
Adam
--
"Subdued flamboyance" Adam Sjøgren
asjo at koldfront.dk
More information about the Dbix-class
mailing list