Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

can somebody give me some insights why the creation of this rule fails with 'ERROR: SELECT rule's target list has too many entries'?

CREATE RULE "_RETURN" AS
  ON SELECT TO history_relation
  DO INSTEAD
    SELECT
      history_relation.id,
      history_relation.relname,
      pg_attribute.attname AS keyname
    FROM
      history_relation, pg_index, pg_class, pg_attribute
    WHERE
      pg_class.oid = history_relation.relname::regclass AND
      indrelid = pg_class.oid AND
      pg_attribute.attrelid = pg_class.oid AND
      pg_attribute.attnum = any(pg_index.indkey)
      AND indisprimary;

The purpose of this rule is to retrieve the primary key name upon the given table name (relname) stored in the table 'history_relation' upon SELECT only.

Kind regards,
Henrik




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux