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 1m3XVz-0006E7-Lr for pgsql-general@arkaria.postgresql.org; Wed, 14 Jul 2021 05:32:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3XVy-0004vx-Kr for pgsql-general@arkaria.postgresql.org; Wed, 14 Jul 2021 05:32:58 +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 1m3XVy-0004vp-Bq for pgsql-general@lists.postgresql.org; Wed, 14 Jul 2021 05:32:58 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m3XVv-0001Rj-42 for pgsql-general@postgresql.org; Wed, 14 Jul 2021 05:32:57 +0000 Received: by mail-wm1-x32e.google.com with SMTP id g12so769464wme.2 for ; Tue, 13 Jul 2021 22:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=aIZUAv57wi5AwHHZopDD/9WQKaAZDIiS2DBUv1aV1Wc=; b=y879pyCatcskClweC4GimpnX2wiJpd56WHvOi/wqoqBW04Vlc7MAWUg9v5TLRR0tk9 EcmNNSSBo/h1KQv8R4WOCbsgSb77PylX9ryBN8eHZpKNMSHrQm0fQm6qcbTVzwwZNDt4 +v05Q8vsZDsUUpyACbZx1JHObFasDEo7v/9C2ayZkJ6xSZEg/tnzVeMcqQMh9gzcFxqR cSe3+eMrPKZCj6PZ/qb0CWM7REvTwWIwfKL2cct7dnYkWDu1XI3jxYrnlz/0a4uAaagH HQLW7JZQLo5qH1qr7SiREEjyiNy1GOGWFNJNRTUKbJiTI1923aX+AVP4LdOB/xLC5lvP /AFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=aIZUAv57wi5AwHHZopDD/9WQKaAZDIiS2DBUv1aV1Wc=; b=E6Fa9XG3AUO3Rh0q7a6ljjOv/CZg1lTnh2lsOriwNIDdkqbY2O46+gdI4eGZ00pxRH mG9aEXJ7wUg5qlFl2ZRQ2qNd86bH5hvyFtNe02Oyk8ulEgOQyYx/6K2wSRFv873znvyM HMoagU+NsTYKPZI7raNXRQIFmT21BVWPJxtQ1vtKtrZdJ4kOh9o/SU+F0LqfzwA05iQr K1ptVvPofJtzvbJfmDx+C9BwLbZxM1C06BOvWLS6TwVSlmByDuXSZ0HrDtNZg/Wccm9P R2MSvMskJedb7MDRoRhKdZSy47lHQfCCZ21ndv6dHr6f9mWxU0dhlv0KvBemeddtMmQk is5A== X-Gm-Message-State: AOAM530pQ13rctbTLN3OG5Dom7yUkQa86rggB4SfiHHGrXPuBNNWGywP YF83SvQyXTXeWCCdviOJ5rzu5w== X-Google-Smtp-Source: ABdhPJyYH3s+fr4SiTa2JshzKjPPWZhZLtxDMCtkO6zkaVe5QSLmTO14+uZjBtK4vrnAQWTV2POuEQ== X-Received: by 2002:a05:600c:2105:: with SMTP id u5mr4797138wml.18.1626240773756; Tue, 13 Jul 2021 22:32:53 -0700 (PDT) Received: from localhost.localdomain (217-149-168-54.nat.highway.telekom.at. [217.149.168.54]) by smtp.gmail.com with ESMTPSA id n23sm916242wmc.38.2021.07.13.22.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 22:32:53 -0700 (PDT) Message-ID: Subject: Re: Need to check each element of an array satisfies a foreign key constraint From: Laurenz Albe To: David Gauthier , Postgres General Date: Wed, 14 Jul 2021 07:32:52 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2021-07-13 at 10:00 -0400, David Gauthier wrote: > I have a column in a table which is a csv of values and I need to make sure each element of the csv = the PK of that same table. This won't work, and it is broken by design. Change your data model to adhere to the first normal form, and the exercise will be simple. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com