pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David Gauthier <davegauthierpg@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Getting "ERROR: upper bound of FOR loop cannot be null" when trying to use a stored proc in a check constraint def.
Date: Fri, 16 Jul 2021 15:30:51 -0700
Message-ID: <ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com> (raw)
In-Reply-To: <CAMBRECB+c1nA-AGx8JMX-4RfVxyKLczJt6gkiPK0=AKu26h-uQ@mail.gmail.com>
References: <CAMBRECB+c1nA-AGx8JMX-4RfVxyKLczJt6gkiPK0=AKu26h-uQ@mail.gmail.com>

On 7/16/21 3:26 PM, David Gauthier wrote:
> This stored procedure ...

> dvdb=# alter table projects add constraint validate_sibling_project_csv 
> check (validate_proj_csv(sibling_project_csv) = 0);
> ERROR:  upper bound of FOR loop cannot be null
> CONTEXT:  PL/pgSQL function validate_proj_csv(character varying) line 14 
> at FOR with integer loop variable
> 
> What's going on ?

I'm going to say you have a NULL value in sibling_project_csv in the table.

> How to get this to work ?
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (5+ messages)  latest in thread

Message-ID: <ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com>
Permalink:  ../ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com/
Also on:    postgresql.org/message-id/ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, davegauthierpg@gmail.com
  Subject: Re: Getting "ERROR: upper bound of FOR loop cannot be null" when trying to use a stored proc in a check constraint def.
  In-Reply-To: <ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com>
  References: <CAMBRECB+c1nA-AGx8JMX-4RfVxyKLczJt6gkiPK0=AKu26h-uQ@mail.gmail.com> <ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.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