Re: malformed array literal in 8beta1 - Mailing list pgsql-general

From Greg Stark
Subject Re: malformed array literal in 8beta1
Date
Msg-id 87y8jxio1d.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: malformed array literal in 8beta1  ("Chris" <chris@paymentonline.com>)
List pgsql-general
"Chris" <chris@paymentonline.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

pgsql-general by date:

Previous
From: "Dave Page"
Date:
Subject: Re: [webmaster] RSS Feeds are dead on Web site
Next
From: Hervé Piedvache
Date:
Subject: Re: [webmaster] RSS Feeds are dead on Web site