Skip to content

Commit 0f95654

Browse files
committed
SQL: consdier name including '.' when extracting type kind tags
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
1 parent ead3784 commit 0f95654

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ obj input.sql /^ obj bigobj$/;" E table:big_objs roles:def
2222
casttesttype input.sql /^CREATE TYPE casttesttype;$/;" k roles:decl
2323
casttesttype_in input.sql /^CREATE FUNCTION casttesttype_in(cstring)$/;" f typeref:typename:casttesttype roles:def
2424
textin input.sql /^ AS 'textin'$/;" f roles:foreigncall
25+
tststats input-0.sql /^CREATE schema tststats;$/;" S roles:def
26+
ty input-0.sql /^CREATE TYPE tststats.ty AS (a int, b int, c text);$/;" k roles:def
27+
a input-0.sql /^CREATE TYPE tststats.ty AS (a int, b int, c text);$/;" E type:ty roles:def
28+
b input-0.sql /^CREATE TYPE tststats.ty AS (a int, b int, c text);$/;" E type:ty roles:def
29+
c input-0.sql /^CREATE TYPE tststats.ty AS (a int, b int, c text);$/;" E type:ty roles:def
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Taken from postgresql/src/test/regress/sql/stats_ext.sql
2+
CREATE schema tststats;
3+
CREATE TYPE tststats.ty AS (a int, b int, c text);

parsers/sql.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,13 +1732,22 @@ static void parseType (tokenInfo *const token)
17321732
/* If a scope has been set, add it to the name */
17331733
addToScope (name, token->scope, token->scopeKind);
17341734
saveScopeKind = token->scopeKind;
1735-
readToken (name);
1735+
readIdentifier (name);
1736+
1737+
while (isType (name, TOKEN_IDENTIFIER))
1738+
{
1739+
readToken (token);
1740+
if (!isType (token, TOKEN_PERIOD))
1741+
break;
1742+
/* FIXME: Throw away valuable scope information. */
1743+
readIdentifier (name);
1744+
}
1745+
17361746
if (isType (name, TOKEN_IDENTIFIER))
17371747
{
17381748
int r = makeSqlTag (name, SQLTAG_TYPE);
17391749
sqlKind scopeKind = SQLTAG_TYPE;
17401750

1741-
readToken (token);
17421751
if (isKeyword (token, KEYWORD_is))
17431752
{
17441753
readToken (token);

0 commit comments

Comments
 (0)