Re: CREATE RULE fails with 'ERROR: SELECT rule's target list has too many entries'

From: Henrik Kuhn <henrik(dot)kuhn(at)origenis(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE RULE fails with 'ERROR: SELECT rule's target list has too many entries'
Date: 2012-12-05 15:25:58
Message-ID: 50BF6786.7000609@origenis.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/05/2012 04:07 PM, Tom Lane wrote:
> Henrik Kuhn <henrik(dot)kuhn(at)origenis(dot)de> writes:
>> can somebody give me some insights why the creation of this rule fails
>> with 'ERROR: SELECT rule's target list has too many entries'?
> Probably that history_relation has fewer than three columns? But if
> you want something more than guessing, you'd have to provide more
> context, such as the definitions of the underlying tables. Why are
> you trying to execute this command anyway?
>
> regards, tom lane
The history_relatio-DDL is quite simple:

CREATE TABLE history_relation (
id UUID NOT NULL DEFAULT uuid_generate_v4()
, relname name NOT NULL CHECK ( relname::regclass IS NOT NULL
) -- use regclass to validate

, PRIMARY KEY (id)
);

But are your really sure, that the error is thrown just because of there
are not more than 3 cols in history_relation? And then why is the error
text '... too many entries' ? It sounds more that the RULE parser can
not handle the join over four tables?

The purpose is:
I want to set up an own polymorphic foreign key reference validation
system. The key point to this is using uuid as prim. key over all tables
to reference to. Because the corresponding prim key names may be
different I need to query for its name to build the corresponding join
stmt. The TABLE history_relation is for keeping track of the foreign tables.

Regards,
Henrik

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-12-05 15:58:54 Re: CREATE RULE fails with 'ERROR: SELECT rule's target list has too many entries'
Previous Message Tom Lane 2012-12-05 15:07:37 Re: CREATE RULE fails with 'ERROR: SELECT rule's target list has too many entries'