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 05:05:29
Message-ID: 20060816050529.GA47717@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
On Wed, Aug 16, 2006 at 12:38:42AM -0400, Jasbinder Bali wrote:
> 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

It's not the varchar-vs-char distinction that matters; it's the
fact that raw_email is declared as array, so it expects a certain
input syntax.  Example:

test=> INSERT INTO raw_email (id, raw_email) VALUES (1, 'test');
ERROR:  array value must start with "{" or dimension information
test=> INSERT INTO raw_email (id, raw_email) VALUES (1, '{test}');
INSERT 0 1

Are you sure you want raw_email to be an array instead of a simple
varchar column?  Are you handling the contents as array elements
(e.g., one element per line) or is the whole considered a single
piece of data?

-- 
Michael Fuhr

In response to

Responses

pgsql-novice by date

Next:From: operationsengineer1Date: 2006-08-16 05:06:35
Subject: Re: Optimal Postgres Development Process, Software
Previous:From: Jasbinder BaliDate: 2006-08-16 04:38:42
Subject: Re: DB insert Error

pgsql-general by date

Next:From: Michael FuhrDate: 2006-08-16 05:07:31
Subject: Re: how to use variable for select query in pl/pgsql
Previous:From: aBBIShDate: 2006-08-16 04:43:07
Subject: how to use variable for select query in pl/pgsql

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