PostgreSQL: “no sequence found ”

[email protected] (Ludovic Courtès)
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Hi,

I’m using the Pg back-end of DBI.  I have a table like this:

--8<---------------cut here---------------start------------->8---
hydra=> \d Builds
                              Table "public.builds"
     Column      |  Type   |                      Modifiers                      
-----------------+---------+-----------------------------------------------------
 id              | integer | not null default nextval('builds_id_seq'::regclass)
[...]

hydra=> \d builds_id_seq
        Sequence "public.builds_id_seq"
    Column     |  Type   |        Value        
---------------+---------+---------------------
 sequence_name | name    | builds_id_seq
 last_value    | bigint  | 6765
 start_value   | bigint  | 1
 increment_by  | bigint  | 1
[...]
--8<---------------cut here---------------end--------------->8---

Yet DBI raises this error:

--8<---------------cut here---------------start------------->8---
no sequence found for Builds.id, check the RDBMS table definition or explicitly set the 'sequence' for this column in Builds at /usr/share/perl5/DBIx/Class/Schema.pm line 1026
	DBIx::Class::Schema::throw_exception('Hydra::Schema=HASH(0x27bbce0)', 'no sequence found for Builds.id, check the RDBMS table defini...') called at /usr/share/perl5/DBIx/Class/Storage.pm line 123
	DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::Pg=HASH(0x275d798)', 'no sequence found for Builds.id, check the RDBMS table defini...') called at /usr/share/perl5/DBIx/Class/Storage/DBI/Pg.pm line 72
	DBIx::Class::Storage::DBI::Pg::_dbh_get_autoinc_seq('DBIx::Class::Storage::DBI::Pg=HASH(0x275d798)', 'DBI::db=HASH(0x2c08fe0)', 'DBIx::Class::ResultSource::Table=HASH(0x283dc10)', 'id') called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 607
	DBIx::Class::Storage::DBI::dbh_do('DBIx::Class::Storage::DBI::Pg=HASH(0x275d798)', '_dbh_get_autoinc_seq', 'DBIx::Class::ResultSource::Table=HASH(0x283dc10)', 'id') called at /usr/share/perl5/DBIx/Class/Storage/DBI/Pg.pm line 28
	DBIx::Class::Storage::DBI::Pg::last_insert_id('DBIx::Class::Storage::DBI::Pg=HASH(0x275d798)', 'DBIx::Class::ResultSource::Table=HASH(0x283dc10)', 'id') called at /usr/share/perl5/DBIx/Class/Row.pm line 347
--8<---------------cut here---------------end--------------->8---

Any idea what I’m doing wrong?

This is with PostgreSQL 8.4.14-0ubuntu10.04, DBIx 0.08115-1, on
Trisquel GNU/Linux 4.0.

Thanks,
Ludo’.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.