From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Henrik Kuhn <henrik(dot)kuhn(at)origenis(dot)de> |
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:58:54 |
Message-ID: | 6213.1354723134@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Henrik Kuhn <henrik(dot)kuhn(at)origenis(dot)de> writes:
> 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?
> 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?
Yes. I think you misunderstand what that command is for: it's going to
convert the table into a view, and as a safety check it is not allowed
for the resulting view to have a different column set than the table
did.
I think what you need to do is create the underlying table with some
other name, create history_relation as a plain view, and then perhaps
you want some INSTEAD OF triggers on the view to convert insertions
etc into updates of the underlying table.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | JP | 2012-12-05 16:03:42 | Extending the KD Tree index in Postgresql 9.2.1 |
Previous Message | Henrik Kuhn | 2012-12-05 15:25:58 | Re: CREATE RULE fails with 'ERROR: SELECT rule's target list has too many entries' |