From: Joe Conway <mail@joeconway.com>
To: josh@agliodbs.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Array_append does not work with Array variables in PL/pgSQL?
Date: Thu, 01 Apr 2004 13:36:45 -0800
Message-ID: <406C8B6D.2040603@joeconway.com> (raw)
In-Reply-To: <200404011320.37766.josh@agliodbs.com>
References: <200404011320.37766.josh@agliodbs.com>
Josh Berkus wrote:
> v_vals TEXT[];
> n_vals TEXT[];
try:
v_vals TEXT[] := ''{}'';
n_vals TEXT[] := ''{}'';
You have to initialize the array to something non-null, even if that be
an empty array (note that there is a difference). When trying to append
an element to a NULL valued array, you wind up with a NULL result. It is
similar to:
regression=# select (NULL || 'abc') is null;
?column?
----------
t
(1 row)
Joe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mail@joeconway.com, josh@agliodbs.com
Subject: Re: Array_append does not work with Array variables in PL/pgSQL?
In-Reply-To: <406C8B6D.2040603@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox