pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Thu, 02 Oct 2014 18:58:28 -0400
Message-ID: <5676.1412290708@sss.pgh.pa.us> (raw)
In-Reply-To: <20141002155521.2543.72522@wrigleys.postgresql.org>
References: <20141002155521.2543.72522@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (3+ messages)  latest in thread

Message-ID: <5676.1412290708@sss.pgh.pa.us>
Permalink:  ../5676.1412290708@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5676.1412290708@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gary.weaver@protolabs.com
  Subject: Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type
  In-Reply-To: <5676.1412290708@sss.pgh.pa.us>
  References: <20141002155521.2543.72522@wrigleys.postgresql.org> <5676.1412290708@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox