-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test against issue #156, now fixed
- Loading branch information
Showing
1 changed file
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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)" | ||
|