Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XZpKU-0000VZ-PW for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Oct 2014 22:58:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XZpKU-0005GK-A4 for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Oct 2014 22:58:34 +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 1XZpKT-0005GA-Oe for pgsql-bugs@postgresql.org; Thu, 02 Oct 2014 22:58:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XZpKQ-0003qa-0D for pgsql-bugs@postgresql.org; Thu, 02 Oct 2014 22:58:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s92MwSEt005677; Thu, 2 Oct 2014 18:58:28 -0400 From: Tom Lane To: gary.weaver@protolabs.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type In-reply-to: <20141002155521.2543.72522@wrigleys.postgresql.org> References: <20141002155521.2543.72522@wrigleys.postgresql.org> Comments: In-reply-to gary.weaver@protolabs.com message dated "Thu, 02 Oct 2014 15:55:21 -0000" Date: Thu, 02 Oct 2014 18:58:28 -0400 Message-ID: <5676.1412290708@sss.pgh.pa.us> X-Pg-Spam-Score: -2.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 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 != 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. > 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. 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 :-(. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs