hasura / hasura/graphql-engine
cannot track functions on schema that begin with "pg"
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
**Docker images**
hasura/graphql-engine:v1.1.0-beta.2
postgres:11.3
**Issue**
It is the first time I try to track a function on non-public schema. I have this function "item_search" on schema "pgw" :
```sql
CREATE OR REPLACE FUNCTION pgw.item_search (search text)
RETURNS SETOF pgw.item
LANGUAGE sql
STABLE
AS $BODY$
WITH RECURSIVE sel AS (
SELECT * FROM pgw.item WHERE to_tsvector(COALESCE(code, '') || ' ' || name) @@ websearch_to_tsquery($1)
UNION
SELECT rel.* FROM pgw.item AS rel, sel WHERE rel.id = sel.parent_id
)
SELECT * FROM sel;
$BODY$;
```
This function does not appears in the console.
I tried to track this function using the API :
**Request (track_function:v1)**
```http
POST http://localhost:8080/v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "track_function",
"args": {
"schema": "pgw",
"name": "item_search"
}
}
```
**Request (track_function:v2)**
```http
POST http://localhost:8080/v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "track_function",
"version": 2,
"args": {
"function": {
"schema": "pgw",
"name": "item_search"
}
}
}
```
**Response**
```http
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Date: Tue, 04 Feb 2020 13:02:51 GMT
Server: Warp/3.2.27
Content-Type: application/json; charset=utf-8
{
"internal": [
{
"definition": {
"schema": "pgw",
"name": "item_search"
},
"reason": "in function \"pgw.item_search\": no such function exists in postgres : \"pgw.item_search\"",
"type": "function"
}
],
"path": "$.args",
"error": "in function \"pgw.item_search\": no such function exists in postgres : \"pgw.item_search\"",
"code": "constraint-violation"
}
```
When I create this function on public schema (changing its name `pgp.item_search` to `pgp_item_search`), this works fine, as usual (the function appears in console and can be tracked using the API).
Contributor guide
Assessment
This issue has not been assessed yet.