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

Re: DB insert Error

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jasbinder Bali <jsbali(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: DB insert Error
Date: 2006-08-16 04:19:45
Message-ID: 20060816041944.GA47526@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
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

In response to

Responses

pgsql-novice by date

Next:From: Jasbinder BaliDate: 2006-08-16 04:30:18
Subject: Re: [GENERAL] DB insert Error
Previous:From: Jasbinder BaliDate: 2006-08-16 03:55:58
Subject: DB insert Error

pgsql-general by date

Next:From: Jasbinder BaliDate: 2006-08-16 04:30:18
Subject: Re: [GENERAL] DB insert Error
Previous:From: Jasbinder BaliDate: 2006-08-16 03:55:58
Subject: DB insert Error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group