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

Voyager doesn't recognize Hasura's syntax for stored procedures #765

Closed
dmagda opened this issue Feb 2, 2023 · 1 comment · Fixed by #768
Closed

Voyager doesn't recognize Hasura's syntax for stored procedures #765

dmagda opened this issue Feb 2, 2023 · 1 comment · Fixed by #768
Assignees

Comments

@dmagda
Copy link

dmagda commented Feb 2, 2023

I was migrating the following eCommerce application from PostgreSQL:
https://github.com/YugabyteDB-Samples/hasura-ecommerce

The application has a public schema with the app-specific data and hdb_catalog schema with Hasura metadata. The following command was used during the schema export step:

yb-voyager export schema --export-dir $VOYAGER_EXPORT_DIR \
    --source-db-type postgresql \
    --source-db-host 34.23.188.24 \
    --source-db-user postgres \
    --source-db-password 'password' \
    --source-db-name postgres \
    --source-db-schema 'public,hdb_catalog'

The tool exports the following stored procedure of Hasura to the voyager_export_dir\schema\functions\functions.sql file:

CREATE FUNCTION hdb_catalog.gen_hasura_uuid() RETURNS uuid
    LANGUAGE sql
    AS $$select gen_random_uuid()$$; 

The analyze-schema and import schema commands complete succesfully and don't report any issues. But the stored procedure above (and all the others that are defined below it) are not imported. The import fails silently.

As a workaround, the stored procedure's format needs to be changed to the following:

CREATE FUNCTION hdb_catalog.gen_hasura_uuid() RETURNS uuid
LANGUAGE sql
AS $$
        select gen_random_uuid()
$$;
@github-actions github-actions bot added the triage Needs to be triaged label Feb 2, 2023
sanyamsinghal pushed a commit that referenced this issue Feb 3, 2023
@sanyamsinghal sanyamsinghal removed the triage Needs to be triaged label Feb 3, 2023
@sanyamsinghal sanyamsinghal self-assigned this Feb 3, 2023
sanyamsinghal pushed a commit that referenced this issue Feb 3, 2023
sanyamsinghal added a commit that referenced this issue Feb 7, 2023
…dy is in one single line (#768)

- Also, added an automation test named pg-hasura-ecommerce for this fix
@sanyamsinghal
Copy link
Collaborator

fix merged to main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants