Re: Getting "ERROR: upper bound of FOR loop cannot be null" when trying to use a stored proc in a check constraint def.

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)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: 2021-07-16 22:30:51
Message-ID: ec8bce06-c6e5-53ff-8204-d0b014b12581@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2021-07-17 00:23:10 Re: Frequetly updated partial index leads to bloat on index for Postresql 11
Previous Message David Gauthier 2021-07-16 22:26:17 Getting "ERROR: upper bound of FOR loop cannot be null" when trying to use a stored proc in a check constraint def.