Re: "too many trigger records found for relation xyz"

From: "Mikko Partio" <mpartio(at)gmail(dot)com>
To: "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: "too many trigger records found for relation xyz"
Date: 2008-04-08 09:37:17
Message-ID: 2ca799770804080237p3e2c4f78w7d8a4da29904a705@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 8, 2008 at 12:20 PM, Mikko Partio <mpartio(at)gmail(dot)com> wrote:

>
>
> On Tue, Apr 8, 2008 at 11:27 AM, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com>
> wrote:
>
> >
> >
> > Mikko Partio napsal(a):
> >
> > > Hello all
> > >
> > > Postgres version 8.3.1
> > >
> > > I just created a bunch of tables (~10) with identical structure; all
> > > tables
> > > have 6 foreign key references to other tables and a primary key. To my
> > > surprise, some of the tables were created ok, some missed primary key
> > > and
> > > some didn't get created at all.
> > >
> >
> > Can you provide self contained reproduction scenario?
> >
>
>
> Unfortunately not -- if I try to dump one the referenced tables I get this
> error:
>
> pg_dump: SQL command failed
> pg_dump: Error message from server: ERROR: more than one row returned by
> a subquery used as an expression
> pg_dump: The command was: SELECT tableoid, oid, typname, typnamespace,
> (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as rolname,
> typinput::oid as typinput, typoutput::oid as typoutput, typelem, typrelid,
> CASE WHEN typrelid = 0 THEN ' '::"char" ELSE (SELECT relkind FROM pg_class
> WHERE oid = typrelid) END as typrelkind, typtype, typisdefined, typname[0] =
> '_' AND typelem != 0 AND (SELECT typarray FROM pg_type te WHERE oid =
> pg_type.typelem) = oid AS isarray FROM pg_type
>

I little investigation showed that there is duplicate row in pg_class:

# select oid from pg_class group by oid having count(*) > 1 ;
oid
--------
294397
(1 row)

# \x
Expanded display is on.

# select * from pg_class where oid = 294397;
-[ RECORD 1 ]--+-----------------------------------------
relname | abc
relnamespace | 2200
reltype | 294399
relowner | 16385
relam | 0
relfilenode | 294397
reltablespace | 0
relpages | 1
reltuples | 3
reltoastrelid | 294400
reltoastidxid | 0
relhasindex | t
relisshared | f
relkind | r
relnatts | 4
relchecks | 0
reltriggers | 6
relukeys | 0
relfkeys | 0
relrefs | 0
relhasoids | f
relhaspkey | t
relhasrules | f
relhassubclass | f
relfrozenxid | 3840767676
relacl | {removed}
reloptions |

-[ RECORD 2 ]--+-----------------------------------------
relname | abc
relnamespace | 2200
reltype | 294399
relowner | 16385
relam | 0
relfilenode | 294397
reltablespace | 0
relpages | 1
reltuples | 3
reltoastrelid | 294400
reltoastidxid | 0
relhasindex | t
relisshared | f
relkind | r
relnatts | 4
relchecks | 0
reltriggers | 12
relukeys | 0
relfkeys | 0
relrefs | 0
relhasoids | f
relhaspkey | t
relhasrules | f
relhassubclass | f
relfrozenxid | 3840767676
relacl | {removed}
reloptions |

Regards

Mikko

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zdenek Kotala 2008-04-08 10:19:41 Re: "too many trigger records found for relation xyz"
Previous Message Mr.Frog.to.you@googlemail.com 2008-04-08 09:28:57 High Availability / Replication with Sequoia