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