Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xa4GM-0007N6-3J for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Oct 2014 14:55:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xa4GL-0001Ma-Hw for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Oct 2014 14:55:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xa3Jr-0002qm-Dx for pgsql-bugs@postgresql.org; Fri, 03 Oct 2014 13:54:51 +0000 Received: from mail.protolabs.com ([173.84.22.8]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xa3Ji-0007Lf-77 for pgsql-bugs@postgresql.org; Fri, 03 Oct 2014 13:54:49 +0000 Received: from mail.protolabs.com (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 675F01B27993_42EAA9FB; Fri, 3 Oct 2014 13:54:39 +0000 (GMT) Received: from mail1svrus.pmdomhq.protomold.com (mail1svrus.pmdomhq.protomold.com [192.168.222.17]) by mail.protolabs.com (Sophos Email Appliance) with ESMTP id 3C2061B2798A_42EAA9FF; Fri, 3 Oct 2014 13:54:39 +0000 (GMT) Received: from MAIL1SVRUS.pmdomhq.protomold.com ([::1]) by mail1svrus.pmdomhq.protomold.com ([::1]) with mapi id 14.03.0195.001; Fri, 3 Oct 2014 08:54:39 -0500 From: Gary Weaver To: Tom Lane CC: "pgsql-bugs@postgresql.org" Subject: Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type Thread-Topic: [BUGS] BUG #11554: Enforce that number and type of both columns involved in fkey are same type Thread-Index: AQHP3pRm8VvaiBQNkkGe4GyqW62f+pwed44A Date: Fri, 3 Oct 2014 13:54:39 +0000 Message-ID: References: <20141002155521.2543.72522@wrigleys.postgresql.org> <5676.1412290708@sss.pgh.pa.us> In-Reply-To: <5676.1412290708@sss.pgh.pa.us> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.0.76] Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-companybanner: X-companybanner X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Tom, On 10/2/14, 6:58 PM, "Tom Lane" wrote: >gary.weaver@protolabs.com writes: >> To help adhere to the statement, "Of course, the number and type of the >> constrained columns need to match the number and type of the referenced >> columns." as noted in >> http://www.postgresql.org/docs/9.3/static/ddl-constraints.html >>shouldn't PG >> enforce that both columns involved in a foreign key constraint are of >>the >> same number and type (e.g. int !=3D bigint) at time of constraint >>creation? > >No. SQL92 did say that, but in SQL99 and later, the requirement is only >that the column types be comparable. Which is what PG enforces. Ah, ok. Thanks for the clarification! > >> The problem is that if you are forced to use a tool that syncs data >>between >> databases of different types, other databases sometimes enforce that the >> types cannot be different. While this is not a frequent use case, it >>just >> makes sense in most cases that you'd want the two column types/sizes to >>be >> the same. > >It would be more productive to lobby those other systems to become more >standards-compliant than to ask us to become less so. Understand, but I don't want to try swimming upstream. :) > >In any case, this hardly seems like it would be the dominant problem >if you're trying to make schemas be exactly the same across multiple >products :-(. Completely agree. We=B9re in a transitional state for a while where using a sync was chosen as the option for the short-term, and the sync tool complains. It was easy enough to fix, but it would have been nice if there were an option to tell PG to warn us when the fkey column number/type doesn=B9t match the id number/type, since currently we have no need for those to be different. *However*, this would slow down PG a little to have to make that check, so since you=B9re saying its behavior is consistent with the standard, I withdraw that request. Thanks for the info, and thanks for all of your work on PG! Confidentiality Notice: This email, including any attachments, is for the s= ole use of the intended recipient(s) and may contain confidential, propriet= ary or privileged information. It should be used or disseminated for the pu= rpose of conducting business with Proto Labs. It may contain Information go= verned by U.S. Export Control laws and regulations. If export controlled in= formation, it must not be transferred to a foreign person without the prope= r authorization of the applicable U.S. Government organization. Any unautho= rized review, use, disclosure, or distribution is prohibited. If you receiv= ed this email and are not the intended recipient, please inform the sender = by email and destroy all copies of the original message. Thank you for your= cooperation. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs