Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: [GENERAL] DB insert Error


  • From: "Jasbinder Bali" <jsbali(at)gmail(dot)com>
  • To: "Michael Fuhr" <mike(at)fuhr(dot)org>
  • Cc: pgsql-novice(at)postgresql(dot)org
  • Subject: Re: [GENERAL] DB insert Error
  • Date: Wed, 16 Aug 2006 00:30:18 -0400
  • Message-id: <a47902760608152130h34adc01ew5da8968cdd60325c(at)mail(dot)gmail(dot)com>

table definition of raw_email table is as follows
 
CREATE TABLE raw_email (
     id        int4 NOT NULL,
     raw_email  varchar[],
     parsed_flag bool NOT NULL DEFAULT false,
     CONSTRAINT  pk_rawemail PRIMARY KEY (id)
)
WITHOUT OIDS;
 
i have very much declared raw_email field as varchar and not char
 
~Jas


 
On 8/16/06, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
On Tue, Aug 15, 2006 at 11:55:58PM -0400, Jasbinder Bali wrote:
> I'm using ECPG and trying to do follwoing insert in one of the talbes.
>
> insert into raw_email ( id  , raw_email  ) values ( 1 , :ch);
>
> ch is an array and defined as follows:
>
> EXEC SQL BEGIN DECLARE SECTION;
>    char ch[MSG_LEN];
> EXEC SQL END DECLARE SECTION;
>
> contents of array ch is actually a parsed raw email that i've attached
> herewith.
>
> I get the following error when the insert statement is hit:
>
> [2446]: ECPGexecute line 97: Error: ERROR:  array value must start with "{"
> or dimension information.

What's the table definition for raw_email?  Based on the error it
looks like one of the columns you're inserting is defined as an
array.  I'm guessing you did something like this:

CREATE TABLE raw_email (
     id         integer,
     raw_email  char[]
);

When you should have done this:

CREATE TABLE raw_email (
     id         integer,
     raw_email  text  -- or varchar
);

Is my guess correct?

--
Michael Fuhr



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group