hasura / hasura/graphql-engine

Server: Hasura Event on View errors "...is a view. Views cannot have row-level BEFORE or AFTER triggers."

Open
#8,692 0 comments 0 reactions 0 assignees View on GitHub
a/eventing/data-triggers c/server k/bug t/native-dbs
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.8.4-cloud.1

### What is the current behaviour?

Hasura displays toast error".is a view. Views cannot have row-level BEFORE or AFTER triggers." from postgres when I try to create event on db view.

### What is the expected behaviour?

I can trigger event on certain rows (where condition) by db views or other way.

### How to reproduce the issue?

Try to create even for DB view because I want event only certain rows. Hasura displays toast error from postgres.

### Screenshots or Screencast

![image](https://user-images.githubusercontent.com/16844103/178844025-d74c0f18-8811-4d94-9b53-28cb0c29f54b.png)

### Any possible solutions?

Maybe use `INSTEAD OF` rather then `AFTER` in create trigger expression.
https://stackoverflow.com/questions/16887884/pl-pgsql-after-insert-trigger-on-a-view-with-a-storages-rule
https://www.postgresql.org/docs/current/sql-createtrigger.html

or add "where condition" to event form (which would be more conveniet for hasura users).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.