graphql-engine/server/tests-py/queries/event_triggers/basic/partition_table_setup.yaml
Karthikeyan Chinnakonda 44347d2d74 server: template the schema and table names in the event trigger PG functions
Earlier, while creating the event trigger's internal postgres trigger, we used to get the name of the table from the `TG_TABLE_NAME` special trigger variable. Using this with normal tables works fine, but it breaks when the parent table is partitioned because we associate the ET configuration in the schema only with the original table (as it should be).

In this PR, we supply the table name and schema name through template variables instead of using `TG_TABLE_NAME` and `TG_TABLE_SCHEMA`, so that event triggers work with a partitioned table as well.

TODO:

- [x] Changelog
- [x] unit test (ET on partition table)

GitOrigin-RevId: 556376881a85525300dcf64da0611ee9ad387eb0
2021-01-06 20:22:34 +00:00

38 lines
892 B
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE TABLE hge_tests.measurement (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate);
CREATE TABLE hge_tests.measurement_y2006m02 PARTITION OF hge_tests.measurement
FOR VALUES FROM ('2006-02-01') TO ('2006-03-01');
CREATE TABLE hge_tests.measurement_y2006m03 PARTITION OF hge_tests.measurement
FOR VALUES FROM ('2006-03-01') TO ('2006-04-01');
- type: track_table
args:
schema: hge_tests
name: measurement
- type: create_event_trigger
args:
name: measurement_all
table:
schema: hge_tests
name: measurement
insert:
columns: "*"
update:
columns: "*"
delete:
columns: "*"
webhook: http://127.0.0.1:5592