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

btree index parser err #208

Open
liuhangyu opened this issue Aug 28, 2023 · 2 comments
Open

btree index parser err #208

liuhangyu opened this issue Aug 28, 2023 · 2 comments

Comments

@liuhangyu
Copy link

sql:

CREATE UNIQUE INDEX t_role_tcd_unique_index ON dino.t_role USING btree (tenant_id,
code,(CASE WHEN (del_flag = 1) THEN id ELSE (del_flag)::bigint END));
cannot be parsed

int main()
{
PgQueryPlpgsqlParseResult result;

//目前无法解析的sql
result =
    pg_query_parse_plpgsql("CREATE UNIQUE INDEX t_role_tcd_unique_index ON dino.t_role USING btree (tenant_id, \

code,(CASE WHEN (del_flag = 1) THEN id ELSE (del_flag)::bigint END));");
if (result.error) {
printf("error: %s at %d\n", result.error->message, result.error->cursorpos);
}
else {
printf("%s\n", result.plpgsql_funcs);
}

pg_query_free_plpgsql_parse_result(result);

return 0;

}

result.plpgsql_funcs output as []

@lelit
Copy link
Contributor

lelit commented Sep 1, 2023

Why are you using pg_query_parse_plpgsql() there instead of pg_query_parse()? That statement is “plain” SQL, isn't it?

@liuhangyu
Copy link
Author

Using the pg_query_parse function works fine, but I'm not sure if there is a bug in pg_query_parse_plpgsql

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

No branches or pull requests

2 participants