Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvQW6-0005wr-SV for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 18:18:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvQW5-00080o-E8 for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 18:18:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvQW3-0007wf-OU for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 18:18:29 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hvQW0-0008Pz-Gi for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 18:18:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 84480449; Wed, 7 Aug 2019 14:18:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 07 Aug 2019 14:18:22 -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=L EITQuu0djHc9kHjcfo/CnrCpTlcKUUBdCjW30rIp4Y=; b=JLoiEcTchjP+rKd57 DQxRGZGZLmbrLt4HaINEE3vntGSBsUHTOlFZ6YMLwsHZQ1qQc0hYzJOgD09eRVwU VcXGOwcfkahcMAfJZqFEXjlgIZlPtH2zKMtgAH+uFaSZwHh7J6w2p5zqw9GD5vb8 +2wrtLOlhbGqQ/AH/XEZ1VCY7EppBRyd2xn/7chAJ8K0Kxes5mA2zrWJnsMn7zIY ILuza6tTAKJZPSlPhc1kWNRjwg1i340sCNOurALsZzeFc900thGVaf6SwKMFuscA OjWrUkJ3sO3yG3BHbBuNIjiSF6zYbPob7xa1fp11dg9O7UnzfQI+03SXMAqt9+XM 9XHGg== 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=LEITQuu0djHc9kHjcfo/CnrCpTlcKUUBdCjW30rIp 4Y=; b=ybY7+wPAuB89gj/X7HwFgNMP5qtGl3S73R7vvLDXSoYNR1iUYycJ77Sw7 bjyzcK27kUlhWiqFX9HamVPjzipE40WpTS381HcbYPEnZqq5C1OzZJka0y+Qbv38 aBw+44T+j0SX42v9af0utituOLxx28xP1nRp6jepB7MR02KO1hAWqURO+FWgHRrU iJxyCA7GpvIrKhunpbBMSrJM4cldxt8L47xLu0FIOmdssQHyd6bohn49ogMDXOIY NkbOvF1tc2idXex1Rzt5HY4XfAIgv5A9NgqYZ/5U6YbHIQ05FySO6JXNt6o1pJNP ZQd7R3L0B18m1CUCGfCDJDRCsX/sQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudduvddguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvg hsqhhlrdhorhhgnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenuc evlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 950658005C; Wed, 7 Aug 2019 14:18:18 -0400 (EDT) Subject: Re: Input validation To: stan , pgsql-general@lists.postgresql.org References: <20190807180717.GA21152@panix.com> From: Adrian Klaver Message-ID: <6ab6f7dd-4041-20c5-66d3-e530aee5a085@aklaver.com> Date: Wed, 7 Aug 2019 11:18:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190807180717.GA21152@panix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/7/19 11:07 AM, stan wrote: > Have table that contains employee keys, paired up with work type keys > (both foreign keys) and a 3rd column that you enter a billing rate in. > Then I have a table where employees enter their work. I need to validate > that the employee, work type pair exists, before allowing the new record > to be inserted. > > Any thoughts as to good way to do this? INSERT UPDATE trigger: https://www.postgresql.org/docs/11/sql-createtrigger.html https://www.postgresql.org/docs/11/plpgsql-trigger.html > > -- Adrian Klaver adrian.klaver@aklaver.com