Skip to content

Commit 8af995c

Browse files
committed
SQL: accept LANGUAGE represented as a string
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent b88745e commit 8af995c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
--sort=no
22
--fields=+S
3+
--extras=+g

Units/parser-sql.r/funcions.d/expected.tags

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ isalpha input.sql /^create or replace FUNCTION isalpha(ch CHAR)$/;" f typeref:ty
44
isalphanum input.sql /^create or replace FUNCTION isalphanum(ch CHAR)$/;" f typeref:typename:BOOLEAN signature:(ch CHAR)
55
isdigit input.sql /^create or replace function isdigit(ch CHAR)$/;" f typeref:typename:BOOLEAN signature:(ch CHAR)
66
rpmver_array input.sql /^create or replace FUNCTION rpmver_array (string1 IN VARCHAR)$/;" f typeref:typename:evr_array_item[] signature:(string1 IN VARCHAR)
7+
str1 input.sql /^ str1 VARCHAR := string1;$/;" v
8+
digits input.sql /^ digits VARCHAR(10) := '0123456789';$/;" v
9+
lc_alpha input.sql /^ lc_alpha VARCHAR(27) := 'abcdefghijklmnopqrstuvwxyz';$/;" v
10+
uc_alpha input.sql /^ uc_alpha VARCHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';$/;" v
11+
alpha input.sql /^ alpha VARCHAR(54) := lc_alpha || uc_alpha;$/;" v
12+
one input.sql /^ one VARCHAR;$/;" v
13+
isnum input.sql /^ isnum BOOLEAN;$/;" v
14+
ver_array input.sql /^ ver_array evr_array_item[] := ARRAY[]::evr_array_item[];$/;" v
15+
segment_loop input.sql /^ <<segment_loop>>$/;" L
716
dfunc0 input-0.sql /^create function dfunc0(a text DEFAULT '->''Hello', b text DEFAULT 'World''') returns text as $\$$/;" f typeref:typename:text signature:(a text DEFAULT '->''Hello', b text DEFAULT 'World''')
817
dfunc1 input-0.sql /^create function dfunc1(r numeric = 20.39, p numeric DEFAULT 99.88) returns numeric as $\$$/;" f typeref:typename:numeric signature:(r numeric = 20.39, p numeric DEFAULT 99.88)
918
dfunc2 input-0.sql /^create function dfunc2(anyelement = 'World'::text) returns text as $\$$/;" f typeref:typename:text signature:(anyelement = 'World'::text)

parsers/sql.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,11 @@ static langType getNamedLanguageFromToken (tokenInfo *const token)
13611361
{
13621362
langType lang = LANG_IGNORE;
13631363

1364-
if (isType (token, TOKEN_IDENTIFIER))
1364+
if (isType (token, TOKEN_IDENTIFIER)
1365+
/* https://www.postgresql.org/docs/current/sql-createprocedure.html
1366+
... Enclosing the name in single quotes is deprecated and requires matching
1367+
case. ...*/
1368+
|| isType (token, TOKEN_STRING))
13651369
{
13661370
if (vStringLength (token->string) > 2
13671371
&& vStringValue (token->string) [0] == 'p'

0 commit comments

Comments
 (0)