Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4WMG-0006li-Ux for pgsql-general@arkaria.postgresql.org; Fri, 16 Jul 2021 22:31:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m4WMF-0008Nw-6G for pgsql-general@arkaria.postgresql.org; Fri, 16 Jul 2021 22:30:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4WME-0008Nm-BB for pgsql-general@lists.postgresql.org; Fri, 16 Jul 2021 22:30:58 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4WMB-0007bV-Oc for pgsql-general@postgresql.org; Fri, 16 Jul 2021 22:30:57 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 96B0A320092C; Fri, 16 Jul 2021 18:30:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 16 Jul 2021 18:30:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=G P3aS52m0ALUizYcAItXnsM6zBXwP6au39jQKiWQM5k=; b=X9/mFMY/CHQ4zrwgW OI7BRrj9/pfE10Jjs2pLyKI4D003pE/AQc4EVOzLHhaYIEsSAr6fTgHVLZrgHyaS 7S/LWsTNIGbICsQPirvqSwiIzIiN+Q7Ukr8NoKwbxDSDWYYGGEiVDtF9vIqBHSWe rI+KOamo1otSRTJ5zE7aTgl+h6RK6xZcWef9kgtzNoNRUOchOKLDKcwZwVJQyMUe td3C8uAOBqFZsfUb+roudSu2mMnG//6rJuAQrSp+EmdpPVUUZan3/84CdO++Tr1K OX4O5PQkksp0D+zr7nslyvmsPhuDtFJ+BtQ6LGWcB6BQFj93aeMwqKeF6b2/aw6I jqHHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=GP3aS52m0ALUizYcAItXnsM6zBXwP6au39jQKiWQM 5k=; b=EtWtdJa58YSyP036u5qRE2QkeI7746WFp5t8RWJzCO1uqbX6G9gfNwgcF wrNFQtgEQGwDOSOLyBkW3wMj4vWAGPWvLs5ly4OX5TOAXQTZQ1NkgUA6HlEqK3nS NIjrGufjIb7ydrvcWP3nrdvAmF2Sv10TV+gpsw3lTry6pC+EnN+MAugeuRt5MbBW 8B5ubzDyDFQa7M90P4D630AzDsJLcTXhFUE6WqcmAdcFdg/9gMxpl5DQp4n0kPy7 R+rLeKz4rfyCHTFlxH2+ei7OPLQiA53t2tLsRD9i8L5AN0zBScKHeqCtXREJrBYp qJ6Qj6Q84kr9fZhJNm71ai6ejjwag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdeggddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepveevfeevfeeugeffkeekhfegieeufffgteeujedvgffh ueejjefhkeejleegtdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Jul 2021 18:30:52 -0400 (EDT) Subject: Re: Getting "ERROR: upper bound of FOR loop cannot be null" when trying to use a stored proc in a check constraint def. To: David Gauthier , Postgres General References: From: Adrian Klaver Message-ID: Date: Fri, 16 Jul 2021 15:30:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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