Skip to content

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

Description

@gregoryforel

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!

Activity

  1. added
    c/consoleRelated to console
    k/bugSomething isn't working
    and removed
    k/bugSomething isn't working
    on Apr 21, 2021
  2. rikinsk commented on Apr 21, 2021

    @rikinsk
    Member

    @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?

  3. denis-ryzhkov commented on Feb 7, 2022

    @denis-ryzhkov

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions