Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aZggV-0005vt-23 for pgsql-sql@arkaria.postgresql.org; Sat, 27 Feb 2016 15:21:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aZggT-0008Dj-Uh for pgsql-sql@arkaria.postgresql.org; Sat, 27 Feb 2016 15:21:29 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1aZggR-0008CD-Nn for pgsql-sql@postgresql.org; Sat, 27 Feb 2016 15:21:28 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aZggO-0002NO-FM for pgsql-sql@postgresql.org; Sat, 27 Feb 2016 15:21:27 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9B60C205D4 for ; Sat, 27 Feb 2016 10:21:22 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Sat, 27 Feb 2016 10:21:22 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=oE1TeXhBqXzcVp6p5Ihm0atmGJ4=; b=AYtMym tG+lPkyHpCSTYtlTG3Hnp3/PGULmihpL0QN7U+jgEvT96IxA1myLCcvdyFTqBZSW 8EKUrvuwnegF+lCvmYVqZT9zEZUm8/JBX8K8rKnevuuGMcGbY7xGqeWNDIa6Ipdm oen8wIUSf00pVO0Hs7UXNFFTDdi7q3NQzP25I= DKIM-Signature: v=1; a=rsa-sha1; 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-sasl-enc:x-sasl-enc; s=smtpout; bh=oE1TeXhBqXzcVp6 p5Ihm0atmGJ4=; b=sAbD1f8/reRnIRcAv3QYirU0Iwyg/rkzVWMVPcl/JO/goaT B9+jF9gvGqcP3Q/vZuEG2B7dlyfpDCmI9tl9NZWzaRBlN+7DmRVGv/8ATBEaqwGo QX0h1mArlZ5B9pnT50U94FFynnmrUmrIo3EHKCTJ8wE31EbfQF9Lc8PJYnfY= X-Sasl-enc: GfjGuIozPbAtpzWYIH1rBP0EP9sUAUfHwG3cBphFwAzh 1456586482 Received: from [192.168.1.2] (174-21-70-246.tukw.qwest.net [174.21.70.246]) by mail.messagingengine.com (Postfix) with ESMTPA id 2232BC00014; Sat, 27 Feb 2016 10:21:22 -0500 (EST) Subject: Re: Query about foreign key details for php framework To: David Binney , pgsql-sql@postgresql.org References: <56CFA136.4000508@aklaver.com> <56CFA4E1.8040204@aklaver.com> <56CFC24A.6030508@aklaver.com> <56D06C02.5040107@aklaver.com> <56D0C4B8.7020200@aklaver.com> From: Adrian Klaver Message-ID: <56D1BEA6.5020707@aklaver.com> Date: Sat, 27 Feb 2016 07:20:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 02/26/2016 08:29 PM, David Binney wrote: > Hey adrian, > > You are correct that the distinct will chomp the resultset down to the > correct count, I am just concerned that there will be cases where it > might not be accurate between the "rc" and the "kcu" joins as there is > no table reference. I have simplified the query right down to just the > join that i am unsure about. You can see below that as soon as i add the > rc.unique_constraint_name, the distinct is no longer returning one row. > In this case its fine because the rc values are the same and would > distinct away, but there might be a case where they are diferent and you > would have two rows and not know which values are correct? > Well it comes down to the question that was asked several times upstream: what is the information you want to see? I am not talking about a query, but a description of what attributes you want on what database objects. Also given, from previous post: "I am a little in the dark as well since this is just a broken piece of ORM i am attempting to fix, in the framework." Is this not something that should be discussed with the framework developers, or are we already doing that:)? -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql