server: fix untrack_function for non-default source

https://github.com/hasura/graphql-engine-mono/pull/2152

GitOrigin-RevId: 339b365044443cec6a83e1a6b3ec06677dc51e1d
This commit is contained in:
David Overton 2021-08-19 20:27:54 +10:00 committed by hasura-bot
parent 50a9dae13b
commit 20f7a6e726
3 changed files with 38 additions and 4 deletions

View File

@ -5,6 +5,7 @@
(Add entries below in the order of server, console, cli, docs, others)
- server: optimize SQL query generation with LIMITs (close #5745)
- server: fix broken `untrack_function` for non-default source
## v2.0.7

View File

@ -162,7 +162,7 @@ runUntrackFunc (UnTrackFunction functionName sourceName) = do
void $ askFunctionInfo @b sourceName functionName
withNewInconsistentObjsCheck
$ buildSchemaCache
$ dropFunctionInMetadata @b defaultSource functionName
$ dropFunctionInMetadata @b sourceName functionName
pure successMsg
dropFunctionInMetadata

View File

@ -33,7 +33,14 @@
);
INSERT INTO author_s1 (name)
VALUES ('Author 1'), ('Author 2');
create function search_authors(search text)
returns setof author_s1 as $$
select *
from author_s1
where
name ilike ('%' || search || '%');
$$ language sql stable;
- description: track table
url: /v1/metadata
status: 200
@ -45,6 +52,32 @@
table: author_s1
source: pg1
- description: track function
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_track_function
args:
function:
schema: public
name: search_authors
source: pg1
- description: untrack function
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_untrack_function
args:
function:
schema: public
name: search_authors
source: pg1
- description: untrack table
url: /v1/metadata
status: 200
@ -67,7 +100,7 @@
args:
source: pg1
sql: |
drop table author_s1;
drop table author_s1 cascade;
- description: PG Drop Source
url: /v1/metadata
@ -77,4 +110,4 @@
query:
type: pg_drop_source
args:
name: pg1
name: pg1