Skip site navigation (1) Skip section navigation (2)

BUG #2750: information_schema broken with primary and foreign key on the same column

From: "Stephen haberman" <stephen(at)exigencecorp(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2750: information_schema broken with primary and foreign key on the same column
Date: 2006-11-10 01:04:13
Message-ID: 200611100104.kAA14Dpo034315@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2750
Logged by:          Stephen haberman
Email address:      stephen(at)exigencecorp(dot)com
PostgreSQL version: 8.2 beta 3
Operating system:   win32
Description:        information_schema broken with primary and foreign key
on the same column
Details: 

Just tried postgresql 8.2 beta 3 and it is missing a patch I had sent to
pgsql-patches after trying 8.2 beta 2 a few weeks ago.

The information_schema `position_in_unique_constraint` is broken when a
column has both a primary key and a foreign key. Both constraints match in
the `SELECT a FROM generate_series` and caused a "subquery returns multiple
results for an expression" error.

(Or something like that--I don't have the exact error message handy.)

This patch fixes it:

--- information_schema-original.sql	Tue Oct 24 11:10:16 2006
+++ information_schema.sql	Fri Oct 27 02:24:52 2006
@@ -928,6 +928,7 @@
                (SELECT a FROM generate_series(1, array_upper(ss.confkey,1))
a) AS foo
              WHERE conrelid = ss.confrelid
              AND conkey[foo.a] = ss.confkey[(ss.x).n]
+             AND contype = 'f'
            ) AS position_in_unique_constraint
     FROM pg_attribute a,
          (SELECT r.oid, r.relname, nc.nspname AS nc_nspname,

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-11-10 06:17:48
Subject: Re: BUG #2742: psql -c is not case sensitive
Previous:From: HagenDate: 2006-11-09 10:07:23
Subject: BUG #2749: Function's final statement must be a SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group