forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit57b440e
committed
Fix plpgsql to allow new-style SQL CREATE FUNCTION as a SQL command.
plpgsql fails on new-style CREATE FUNCTION/PROCEDURE commands withina routine or DO block, because make_execsql_stmt believes that asemicolon token always terminates a SQL command. Now, that's actuallybeen wrong since the day it was written, because CREATE RULE has longallowed multiple rule actions separated by semicolons. But there arefew enough people using multi-action rules that there was never anattempt to fix it. New-style SQL functions, though, are popular.psql has this same problem of "does this semicolon really terminatethe command?". It deals with CREATE RULE by counting parenthesisnesting depth: a semicolon within parens doesn't end a command.Commitse717a9a and029c5ac created a similar heuristic to countmatching BEGIN/END pairs (but only within CREATEs, so as not to befooled by plain BEGIN). That's survived several releases now withouttrouble reports, so let's just absorb those heuristics into plpgsql.Per report from Samuel Dussault. Back-patch to v14 where new-styleSQL function syntax came in.Discussion:https://postgr.es/m/YT2PR01MB88552C3E9AD40A6C038774A781722@YT2PR01MB8855.CANPRD01.PROD.OUTLOOK.COM1 parente313a61 commit57b440e
File tree
5 files changed
+122
-11
lines changed- src/pl/plpgsql/src
- expected
- sql
5 files changed
+122
-11
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
36 |
| - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + |
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
| 79 | + | |
79 | 80 |
| |
80 | 81 |
| |
81 | 82 |
| |
82 | 83 |
| |
| 84 | + | |
83 | 85 |
| |
84 |
| - | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
|
Lines changed: 64 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
| 79 | + | |
| 80 | + | |
80 | 81 |
| |
81 | 82 |
| |
82 | 83 |
| |
| |||
1972 | 1973 |
| |
1973 | 1974 |
| |
1974 | 1975 |
| |
1975 |
| - | |
| 1976 | + | |
1976 | 1977 |
| |
1977 | 1978 |
| |
1978 | 1979 |
| |
1979 |
| - | |
| 1980 | + | |
1980 | 1981 |
| |
1981 | 1982 |
| |
1982 | 1983 |
| |
1983 |
| - | |
| 1984 | + | |
1984 | 1985 |
| |
1985 | 1986 |
| |
1986 | 1987 |
| |
| |||
1991 | 1992 |
| |
1992 | 1993 |
| |
1993 | 1994 |
| |
1994 |
| - | |
| 1995 | + | |
1995 | 1996 |
| |
1996 | 1997 |
| |
1997 | 1998 |
| |
| |||
2002 | 2003 |
| |
2003 | 2004 |
| |
2004 | 2005 |
| |
2005 |
| - | |
| 2006 | + | |
2006 | 2007 |
| |
2007 | 2008 |
| |
2008 | 2009 |
| |
| |||
2947 | 2948 |
| |
2948 | 2949 |
| |
2949 | 2950 |
| |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
2950 | 2956 |
| |
2951 |
| - | |
| 2957 | + | |
2952 | 2958 |
| |
2953 | 2959 |
| |
2954 | 2960 |
| |
| |||
2961 | 2967 |
| |
2962 | 2968 |
| |
2963 | 2969 |
| |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
2964 | 2975 |
| |
2965 | 2976 |
| |
2966 | 2977 |
| |
| 2978 | + | |
| 2979 | + | |
2967 | 2980 |
| |
2968 | 2981 |
| |
2969 | 2982 |
| |
| |||
2972 | 2985 |
| |
2973 | 2986 |
| |
2974 | 2987 |
| |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
2975 | 2994 |
| |
2976 | 2995 |
| |
2977 | 2996 |
| |
| |||
2997 | 3016 |
| |
2998 | 3017 |
| |
2999 | 3018 |
| |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
3000 | 3023 |
| |
3001 | 3024 |
| |
3002 | 3025 |
| |
3003 | 3026 |
| |
3004 | 3027 |
| |
3005 | 3028 |
| |
3006 |
| - | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
3007 | 3063 |
| |
3008 | 3064 |
| |
3009 | 3065 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + |
0 commit comments
Comments
(0)