[Dbix-class] Pg bytea does not work

Rolf Schaufelberger rs at plusw.de
Mon Oct 15 14:25:14 GMT 2007


On Montag 15 Oktober 2007, John Napiorkowski wrote:
> --- Rolf Schaufelberger <rs at plusw.de> wrote:
> > Hi,
> >
> > I have a table like this:
> >  id              | integer                  | not
> > null default
> > nextval('orders.logos_id_seq'::regclass)
> >  name            | character varying(100)   |
> >  image           | bytea                    |
> > ...
> >
> > and in my class I have
> > ...
> > __PACKAGE__->add_columns ( image => { data_type =>
> > 'bytea' });
> > ...
> >
> > Now when I try to insert something in image I get an
> > error
> >
> > DBIx::Class::ResultSet::create(): DBI Exception:
> > DBD::Pg::st execute failed:
> > ERROR:  invalid byte sequence for encoding "UTF8":
> >
> > Debuggung showed me, that
> >
> > bind_attribute_by_data_type   is  called in
> > D:C:Storage:DBI and not in D:C:Storage:DBI::Pg
> >
> > All my classes inherit from a base class which does
> >
> > __PACKAGE__->load_components(qw/Core PK::Auto/);
> >
> > Any idea ?
> >
> >
> > I have DBD 1.4.9 and DBIx::Class 0.8 (just upgraded
> > 5 min ago..)
> > I have the same table running with Class::DBI anf
> > now want to move to DBIC.
> >
> > --
> > Regards
> > Rolf Schaufelberger
>
> What version of the Postgresql database are you on?
> I'm the culprit that wrote the section of code you
> mentioned so I'm like to get more details.
>
> --john
>
its  8.1.9 on FreeBSD 6.2

In my old app with Class::DBI i use a setup like 
__PACKAGE__->data_type(image => { pg_type => DBD::Pg::PG_BYTEA })

that works, so don't think that it's an issue of the database version. 
The question is, why  is   C.D.Storage::DBI::Pg::bind_attribute_by_data_type  
not called ?

-- 
Rolf Schaufelberger



More information about the DBIx-Class mailing list