On 12/05/2012 04:07 PM, Tom Lane wrote:
> Henrik Kuhn <henrik.kuhn@origenis.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