[Dbix-class] Re: Help me understand and fix this Postgresql bytea error?

John Napiorkowski jjn1056 at yahoo.com
Tue Jan 1 21:35:38 GMT 2008


--- Dennis Daupert <ddaupert at sbcglobal.net> wrote:

> >> ERROR:  syntax error at or near "(" at character
> 93
> >> LINE 4:   "arg" bytea(16777215),
> 
> John Napiorkowski:
> > If you set the data_type attribute in your columns
> > definition, to 'btyea' everything should just work
> as
> > expected.  If not, please give me a shout.
> 
> Hi John, thanks for the reply. 
> 
> I'm not sure I follow. The line in question is
> within a 
> CREATE TABLE statement:
> 
> CREATE TABLE "job" (
>   "jobid" bigserial NOT NULL,
>   "funcid" bigint NOT NULL,
>   "arg" bytea (16777215),
>   ...
> 
> Unless I'm missing something (probably something
> really
> obvious, I'm sure) line 4 _is_ trying to set the
> bytea 
> data_type attribute. Is there something else I need 
> to do here?
> 
> In the interest of full disclosure, the original
> mysql
> statement is:
> 
> CREATE TABLE job (
>   jobid   BIGINT UNSIGNED PRIMARY KEY NOT NULL
> AUTO_INCREMENT,
>   funcid  INT UNSIGNED NOT NULL,
>   arg     MEDIUMBLOB,
>   ...
> 
> /dennis
> > ___________


Dennis,

I may be confused about what you are trying to do.  If
you just want BYTEA type column support in Postgresql
so that you can use DBIC to store blog style
information in the database, you need to make your
storage definition classes like:

(In your class)

__PACKAGE__->add_columns(
"media" => { 
  data_type => "bytea", 
  is_nullable => 0,
  ## rest of the column definition
});

Then if you have a table with column 'media' that is
bytea type you can read/write huge blobs of stuff
without any trouble (at least for Postgresql)

Is this what you are looking for or I am just enjoying
my vacation too much and leaving my brain behind
somewhere :)

--john



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the DBIx-Class mailing list