graphql-engine/server/tests-py/queries/subscriptions/udf_session_args/setup.yaml
Anon Ray 63594e1828 server: fix referenced session vars for live queries when UDF has specified session argument
GitOrigin-RevId: 23efdf4d3b3902b5ce7ec14061faa53b18258e86
2021-05-24 07:34:33 +00:00

41 lines
769 B
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE TABLE profile (
id TEXT,
name TEXT
);
INSERT INTO profile (id, name) VALUES ('10', 'Miles'), ('42', 'Charlie');
CREATE FUNCTION me(hasura_session json)
RETURNS SETOF profile AS $$
SELECT * FROM profile
WHERE id = hasura_session ->> 'x-hasura-user-id'
$$ LANGUAGE sql STABLE;
- type: track_table
args:
schema: public
name: profile
- type: create_select_permission
args:
table: profile
role: user
permission:
columns: [id, name]
filter: {}
- type: track_function
version: 2
args:
function:
name: me
schema: public
configuration:
session_argument: hasura_session