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 1hvQZM-000620-RX for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 18:21:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvQZL-0004Ur-N3 for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 18:21:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvQZL-0004Uk-BP for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 18:21:51 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvQZJ-0004YG-46 for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 18:21:50 +0000 Received: by mail-pl1-x642.google.com with SMTP id c2so41985628plz.13 for ; Wed, 07 Aug 2019 11:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=ty1Etqgeiv3XpSVWLkUUt/RVzj8/3q1JrBxpd7yBVTs=; b=Qxu75pyftIqSTOKkGZ8Dr8Er9FHbYoeTEjBERxRskzS4Pg9xpit+h/EShehyj13uQm WwOGXoIro9G+20iMuPaVpiiXqDEd1YFP4lw9+424w3ewcczM+N3D1hsTLyZDLqsyteMJ ubHxv+5/ePCl5gi98SzcyCQyw60/WIvPVroLKAU6SbQXKpDztlnHNo6dLFfUUovudN/2 D87hGsmC6disuJL+oHZJo/FGAN3pWLHDiL3CWLoQH4qrgsC/tt38/t7dooSlFylUuDbD dpIqLu9CgcOk48Ct9pftj8wUziH3V07op1uGg60yarIpAWmcs9NSgFtvVwitjlIuRdQN 6jwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ty1Etqgeiv3XpSVWLkUUt/RVzj8/3q1JrBxpd7yBVTs=; b=Xr17cavBZbjun5R1yssjjvikRHNfWVL2TVSxpIqI1zEXbb3mU7FgPM7e6ip3YrACnk P8ls7+gzuXnerNS9J7Ic31902v/HV7xngwGGZ8gvD66qyQmGypK9NZ2Y6JWl3e4t2aDG /B3+CqwzKsK2aHvbTFVuh1XIKLcBkYJfLruzLv1fYNuXpALABrNZIj2XK1bRzsHK7ISK H2qhaqEfqeYrBVa9ONiAFjl1zqw3TcqG+TLdFII5SqyJqEn5MH5WiQg88E62JxJWMLLr LB7zdydnfsi6qee1sD5BvOl7+AuMzAxqbhBbcOYcf3Pb1zyHPIiqQlBkCy4GUIuXbtz2 R5lQ== X-Gm-Message-State: APjAAAVSqWDuEkGtcJcLt+QfU8hWXYkzessMtEH1Cp+U8V/JYaliqrja Se1rZoud75Ub5SYxybnmyeBwtQ7Z X-Google-Smtp-Source: APXvYqxVRGtxzO2jRDtnchKZ1nevT+chqbU92cVU4MFVola5oxhgRsprU/cCRjHaeZKhfCxLcM0BlQ== X-Received: by 2002:a62:e901:: with SMTP id j1mr10868628pfh.189.1565202105501; Wed, 07 Aug 2019 11:21:45 -0700 (PDT) Received: from [10.104.134.41] ([155.100.47.1]) by smtp.gmail.com with ESMTPSA id e5sm21249368pgt.91.2019.08.07.11.21.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 11:21:45 -0700 (PDT) Subject: Re: Input validation To: pgsql-general@lists.postgresql.org References: <20190807180717.GA21152@panix.com> From: Rob Sargent Message-ID: Date: Wed, 7 Aug 2019 12:21:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190807180717.GA21152@panix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/7/19 12:07 PM, 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? > > Does the employee interactively specify the "work type" then some time-spent value? Can the work-type be chosen from a drop-down generated by     select work_type from table where employee = Otherwise you'll need a trigger on the insert into "enter their work" table.  Sad thing here is the user has likely left the scene.