Skip to content

Commit

Permalink
Add test against issue #156, now fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed Oct 29, 2024
1 parent b796f27 commit 26fedf4
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# :Created: ven 04 ago 2017 08:37:10 CEST
# :Author: Lele Gaifax <[email protected]>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018, 2019, 2021, 2023 Lele Gaifax
# :Copyright: © 2017, 2018, 2019, 2021, 2023, 2024 Lele Gaifax
#

import json
Expand Down Expand Up @@ -59,6 +59,23 @@ def test_parse_plpgsql():
assert isinstance(function, dict)
assert function.keys() == {'PLpgSQL_function'}

# See https://github.com/lelit/pglast/issues/156
ptree = parse_plpgsql("""\
CREATE FUNCTION public.dz_sumfunc(
IN p_in INTEGER
,OUT p_out public.dz_sumthing
)
AS $BODY$
DECLARE
BEGIN
p_out.sumattribute := p_in;
END;
$BODY$
LANGUAGE plpgsql""")
function = ptree[0]
assert isinstance(function, dict)
assert function.keys() == {'PLpgSQL_function'}


def test_fingerprint():
sql1 = "SELECT a as b, c as d FROM atable AS btable WHERE a = 1 AND b in (1, 2)"
Expand Down

0 comments on commit 26fedf4

Please sign in to comment.