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

Rebased Unpermitted node type #197

Closed

Conversation

emin100
Copy link
Contributor

@emin100 emin100 commented Jun 12, 2023

SQL:
CREATE PROCEDURE insert_data(a integer, b integer) LANGUAGE SQL
BEGIN ATOMIC
INSERT INTO tbl VALUES (a);
INSERT INTO tbl VALUES (b);
END;

ERROR for "CREATE PROCEDURE insert_data(a int, b int) LANGUAGE sql BEGIN ATOMIC INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); END"
deparse: unpermitted node type in a_expr/b_expr: 231
parsetree: {"version":150001,"stmts":[{"stmt":{"CreateFunctionStmt":{"is_procedure":true,"funcname":[{"String":{"sval":"insert_data"}}],"parameters":[{"FunctionParameter":{"name":"a","argType":{"names":[{"String":{"sval":"pg_catalog"}},{"String":{"sval":"int4"}}],"typemod":-1,"location":31},"mode":"FUNC_PARAM_DEFAULT"}},{"FunctionParameter":{"name":"b","argType":{"names":[{"String":{"sval":"pg_catalog"}},{"String":{"sval":"int4"}}],"typemod":-1,"location":38},"mode":"FUNC_PARAM_DEFAULT"}}],"options":[{"DefElem":{"defname":"language","arg":{"String":{"sval":"sql"}},"defaction":"DEFELEM_UNSPEC","location":43}}],"sql_body":{"List":{"items":[{"List":{"items":[{"InsertStmt":{"relation":{"relname":"tbl","inh":true,"relpersistence":"p","location":81},"selectStmt":{"SelectStmt":{"valuesLists":[{"List":{"items":[{"ColumnRef":{"fields":[{"String":{"sval":"a"}}],"location":93}}]}}],"limitOption":"LIMIT_OPTION_DEFAULT","op":"SETOP_NONE"}},"override":"OVERRIDING_NOT_SET"}},{"InsertStmt":{"relation":{"relname":"tbl","inh":true,"relpersistence":"p","location":109},"selectStmt":{"SelectStmt":{"valuesLists":[{"List":{"items":[{"ColumnRef":{"fields":[{"String":{"sval":"b"}}],"location":121}}]}}],"limitOption":"LIMIT_OPTION_DEFAULT","op":"SETOP_NONE"}},"override":"OVERRIDING_NOT_SET"}}]}}]}}}}}]}

CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
BEGIN ATOMIC
  INSERT INTO tbl VALUES (a);
  INSERT INTO tbl VALUES (b);
END;

ERROR for "CREATE PROCEDURE insert_data(a int, b int) LANGUAGE sql BEGIN ATOMIC INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); END"
  deparse: unpermitted node type in a_expr/b_expr: 231
  parsetree: {"version":150001,"stmts":[{"stmt":{"CreateFunctionStmt":{"is_procedure":true,"funcname":[{"String":{"sval":"insert_data"}}],"parameters":[{"FunctionParameter":{"name":"a","argType":{"names":[{"String":{"sval":"pg_catalog"}},{"String":{"sval":"int4"}}],"typemod":-1,"location":31},"mode":"FUNC_PARAM_DEFAULT"}},{"FunctionParameter":{"name":"b","argType":{"names":[{"String":{"sval":"pg_catalog"}},{"String":{"sval":"int4"}}],"typemod":-1,"location":38},"mode":"FUNC_PARAM_DEFAULT"}}],"options":[{"DefElem":{"defname":"language","arg":{"String":{"sval":"sql"}},"defaction":"DEFELEM_UNSPEC","location":43}}],"sql_body":{"List":{"items":[{"List":{"items":[{"InsertStmt":{"relation":{"relname":"tbl","inh":true,"relpersistence":"p","location":81},"selectStmt":{"SelectStmt":{"valuesLists":[{"List":{"items":[{"ColumnRef":{"fields":[{"String":{"sval":"a"}}],"location":93}}]}}],"limitOption":"LIMIT_OPTION_DEFAULT","op":"SETOP_NONE"}},"override":"OVERRIDING_NOT_SET"}},{"InsertStmt":{"relation":{"relname":"tbl","inh":true,"relpersistence":"p","location":109},"selectStmt":{"SelectStmt":{"valuesLists":[{"List":{"items":[{"ColumnRef":{"fields":[{"String":{"sval":"b"}}],"location":121}}]}}],"limitOption":"LIMIT_OPTION_DEFAULT","op":"SETOP_NONE"}},"override":"OVERRIDING_NOT_SET"}}]}}]}}}}}]}
@emin100 emin100 mentioned this pull request Jun 12, 2023
src/postgres_deparse.c Show resolved Hide resolved
test/deparse_tests.c Show resolved Hide resolved
@emin100
Copy link
Contributor Author

emin100 commented Jul 5, 2023

@lfittl is this patch OK or waiting some action from me? Thanks.

@lfittl
Copy link
Member

lfittl commented Jul 8, 2023

Rebased and merged as 1b508f8 - thanks for the contribution!

@lfittl lfittl closed this Jul 8, 2023
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

Successfully merging this pull request may close these issues.

2 participants