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

Re: malformed array literal in 8beta1

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: malformed array literal in 8beta1
Date: 2004-08-29 22:21:02
Message-ID: 87y8jxio1d.fsf@stark.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-general
"Chris" <chris(at)paymentonline(dot)com> writes:

> After looking closer at the logs, what seems to be happening is that it
> doesn't like the empty array values.  All functions that I call with an array
> that have one or more empty elements are returning this error.  Should I be
> setting the value to NULL instead of just leaving it empty?

You can't store null values in arrays (yet).

Assuming your arrays are text[] or varchar[] you can store the empty string
represented by "" though. You might find it safest to put "" around all your
parameters and quote "s inside them.

Or better yet (imho) is to use the new array[...] constructor. That you can do
using the existing quoting functions without worrying about someone sneaking a
double quote inside your values. They also play nicer with placeholders.

-- 
greg


In response to

pgsql-general by date

Next:From: Hervé PiedvacheDate: 2004-08-29 22:50:46
Subject: Re: [webmaster] RSS Feeds are dead on Web site
Previous:From: Dave PageDate: 2004-08-29 22:09:20
Subject: Re: [webmaster] RSS Feeds are dead on Web site

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