Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computed fields: Function name dropdown does not show the available functions for selection #6769

Open
gregoryforel opened this issue Apr 9, 2021 · 2 comments
Labels
a/data c/console Related to console support/needs-more-info Needs more details/info/repro instructions

Comments

@gregoryforel
Copy link

I'm trying to add a computed field with Hasura cloud v2.0.0-cloud.2.

I've already added some custom functions, but none are available for selection in the Function name dropdown.

My functions:
image

Empty list of functions:
image

Thank you!

@rikinsk rikinsk added c/console Related to console k/bug Something isn't working and removed k/bug Something isn't working labels Apr 21, 2021
@rikinsk
Copy link
Member

rikinsk commented Apr 21, 2021

@gregoryforel the console only displays functions that are valid to be added as computed fields for the table. Can you confirm your functions meet the requirments as described in the docs?

@rikinsk rikinsk added the support/needs-more-info Needs more details/info/repro instructions label Apr 21, 2021
@denis-ryzhkov
Copy link

I've got the same issue, and was collecting proofs to report it here,
but then I noticed the "optionally schema-qualified" note in the CREATE FUNCTION: argtype docs

In my case, the table is "public"."record",
I specified the schema for the function itself,
but not for its table argument:

CREATE OR REPLACE FUNCTION "public"."get_record_foo"("record" record, "hasura_session" json)

I checked the API response Hasura Console uses to populate this "Function Name" dropdown
and found that record type was taken from built-in pg_catalog schema:

{\"function_name\":\"get_record_foo\",..
\"input_arg_types\":[{\"schema\" : \"pg_catalog\", \"name\" : \"record\"...

After I added the correct schema name "public" to the argument type:

CREATE OR REPLACE FUNCTION "public"."get_record_foo"("record" "public"."record", "hasura_session" json)

...the issue got fixed: the function is now available in the "Function Name" dropdown,
and that API response shows correct schema too:

\"input_arg_types\":[{\"schema\" : \"public\", \"name\" : \"record\"

I hope this will help to people that found this issue page for a similar reason

@rikinsk, could you please update Hasura docs to help others to avoid this trap:
in the line "Table Argument: One input argument with a table row type"
please add "(optionally schema-qualified to avoid confusion with built-in types like record)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/data c/console Related to console support/needs-more-info Needs more details/info/repro instructions
Projects
None yet
Development

No branches or pull requests

4 participants